@jsm-mit/tigi-sharded-package 0.1.0 → 0.3.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.
@@ -18,6 +18,25 @@ export type BlockTarget = { 'driverCanister' : Principal } |
18
18
  { 'driver' : { 'driverKey' : string, 'canister' : Principal } } |
19
19
  { 'rider' : Principal };
20
20
  export interface CanisterArgs { 'canister' : Principal }
21
+ export interface ChatConfig {
22
+ 'chatCoordinatorId' : Principal,
23
+ 'projectId' : string,
24
+ }
25
+ export interface ChatRoomsStatus {
26
+ 'failures' : bigint,
27
+ 'pending' : bigint,
28
+ 'lastError' : [] | [string],
29
+ 'config' : [] | [ChatConfig],
30
+ 'pendingSinceNs' : [] | [bigint],
31
+ 'rooms' : bigint,
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 }
21
40
  export interface DriverCanister {
22
41
  'moduleHash' : [] | [Uint8Array | number[]],
23
42
  'owner' : Principal,
@@ -39,6 +58,14 @@ export interface DriverCanistersPage {
39
58
  'total' : bigint,
40
59
  'canisters' : Array<DriverCanister>,
41
60
  }
61
+ export interface DriverRoomView {
62
+ 'recipient' : Principal,
63
+ 'driverKey' : string,
64
+ 'canister' : Principal,
65
+ 'lastError' : [] | [string],
66
+ 'roomId' : string,
67
+ 'synced' : boolean,
68
+ }
42
69
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
43
70
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
44
71
  { 'RemoteCanisterError' : string } |
@@ -64,7 +91,18 @@ export interface InitArgs {
64
91
  'coordinator' : [] | [Principal],
65
92
  }
66
93
  export type LeaseAnswer = { 'busy' : { 'untilNs' : bigint } } |
67
- { 'leased' : DriverCanister };
94
+ { 'leased' : LeasedCanister };
95
+ export interface LeasedCanister {
96
+ 'moduleHash' : [] | [Uint8Array | number[]],
97
+ 'owner' : Principal,
98
+ 'blocked' : boolean,
99
+ 'kind' : DriverCanisterKind,
100
+ 'claim' : [] | [ClaimCode],
101
+ 'createdAtNs' : bigint,
102
+ 'canister' : Principal,
103
+ 'installedAtNs' : [] | [bigint],
104
+ 'leaseUntilNs' : [] | [bigint],
105
+ }
68
106
  export type Mode = { 'localTest' : null } |
69
107
  { 'prod' : null } |
70
108
  { 'test' : null } |
@@ -79,6 +117,7 @@ export interface Profile {
79
117
  }
80
118
  export interface ProfileEntry { 'principal' : Principal, 'name' : string }
81
119
  export interface ProfilesArgs { 'principals' : Array<Principal> }
120
+ export interface Rating { 'sum' : bigint, 'count' : bigint }
82
121
  export interface RatingEntry {
83
122
  'requestId' : string,
84
123
  'side' : RatingSide,
@@ -98,46 +137,56 @@ export type Result = { 'ok' : bigint } |
98
137
  { 'err' : Error };
99
138
  export type Result_1 = { 'ok' : Uint8Array | number[] } |
100
139
  { 'err' : Error };
101
- export type Result_10 = { 'ok' : Wiring } |
140
+ export type Result_10 = { 'ok' : LeaseAnswer } |
102
141
  { 'err' : Error };
103
- export type Result_11 = { 'ok' : Array<ProfileEntry> } |
142
+ export type Result_11 = { 'ok' : RideBatchResult } |
104
143
  { 'err' : Error };
105
- export type Result_12 = { 'ok' : RidesPage } |
144
+ export type Result_12 = {
145
+ 'ok' : {
146
+ 'subjects' : bigint,
147
+ 'headSeq' : bigint,
148
+ 'lastError' : [] | [string],
149
+ 'laggingWorkers' : bigint,
150
+ }
151
+ } |
152
+ { 'err' : Error };
153
+ export type Result_13 = { 'ok' : Wiring } |
106
154
  { 'err' : Error };
107
- export type Result_13 = { 'ok' : DriverCanister } |
155
+ export type Result_14 = { 'ok' : Array<ProfileEntry> } |
108
156
  { 'err' : Error };
109
- export type Result_14 = { 'ok' : FactoryStatus } |
157
+ export type Result_15 = { 'ok' : RidesPage } |
110
158
  { 'err' : Error };
111
- export type Result_15 = { 'ok' : [] | [RolloutView] } |
159
+ export type Result_16 = { 'ok' : [] | [Rating] } |
112
160
  { 'err' : Error };
113
- export type Result_16 = { 'ok' : Array<Principal> } |
161
+ export type Result_17 = { 'ok' : DriverCanister } |
114
162
  { 'err' : Error };
115
- export type Result_17 = { 'ok' : Principal } |
163
+ export type Result_18 = { 'ok' : FactoryStatus } |
116
164
  { 'err' : Error };
117
- export type Result_18 = { 'ok' : WasmInfo } |
165
+ export type Result_19 = { 'ok' : [] | [RolloutView] } |
118
166
  { 'err' : Error };
119
167
  export type Result_2 = { 'ok' : boolean } |
120
168
  { 'err' : Error };
169
+ export type Result_20 = { 'ok' : ChatRoomsStatus } |
170
+ { 'err' : Error };
171
+ export type Result_21 = { 'ok' : Array<Principal> } |
172
+ { 'err' : Error };
173
+ export type Result_22 = { 'ok' : Principal } |
174
+ { 'err' : Error };
175
+ export type Result_23 = { 'ok' : WasmInfo } |
176
+ { 'err' : Error };
121
177
  export type Result_3 = { 'ok' : RolloutView } |
122
178
  { 'err' : Error };
123
179
  export type Result_4 = { 'ok' : Profile } |
124
180
  { 'err' : Error };
125
- export type Result_5 = { 'ok' : DriverCanistersPage } |
181
+ export type Result_5 = { 'ok' : ChatConfig } |
126
182
  { 'err' : Error };
127
- export type Result_6 = { 'ok' : Array<Block> } |
183
+ export type Result_6 = { 'ok' : ClaimCode } |
128
184
  { 'err' : Error };
129
- export type Result_7 = { 'ok' : LeaseAnswer } |
185
+ export type Result_7 = { 'ok' : Array<DriverRoomView> } |
130
186
  { 'err' : Error };
131
- export type Result_8 = { 'ok' : RideBatchResult } |
187
+ export type Result_8 = { 'ok' : DriverCanistersPage } |
132
188
  { 'err' : Error };
133
- export type Result_9 = {
134
- 'ok' : {
135
- 'subjects' : bigint,
136
- 'headSeq' : bigint,
137
- 'lastError' : [] | [string],
138
- 'laggingWorkers' : bigint,
139
- }
140
- } |
189
+ export type Result_9 = { 'ok' : Array<Block> } |
141
190
  { 'err' : Error };
142
191
  export interface RideBatch {
143
192
  'ratings' : Array<RatingEntry>,
@@ -200,7 +249,7 @@ export interface TigiCore {
200
249
  /**
201
250
  * / Admins: a canister the core controls joins the demo pool (U-35).
202
251
  */
203
- 'addPoolCanister' : ActorMethod<[CanisterArgs], Result_13>,
252
+ 'addPoolCanister' : ActorMethod<[CanisterArgs], Result_17>,
204
253
  /**
205
254
  * / Admins: a driver canister, or one driver in it (`driverKey`), is blocked; the workers
206
255
  * / drop it at once (WO-2).
@@ -210,49 +259,69 @@ export interface TigiCore {
210
259
  * / Admins: a rider is blocked (core.md, accepted 2026-10-22).
211
260
  */
212
261
  'blockRider' : ActorMethod<[BlockRiderArgs], Result_2>,
262
+ /**
263
+ * / F-20 (U-45): the caller — the driver signed in on the canister's own front — takes
264
+ * / over the demo canister with the code of the link. Single use, 15 min; every refusal
265
+ * / answers the same NotAuthorized. The room of the canister gets the caller (C-15).
266
+ */
267
+ 'claimDriverCanister' : ActorMethod<[ClaimArgs], Result_17>,
213
268
  'clearLogs' : ActorMethod<[], undefined>,
214
269
  /**
215
270
  * / Admins: the chunks become THE module of their kind. A new driver wasm is released
216
271
  * / (F-11) and its hash goes to the workers.
217
272
  */
218
- 'commitDriverWasm' : ActorMethod<[WasmCommitArgs], Result_18>,
273
+ 'commitDriverWasm' : ActorMethod<[WasmCommitArgs], Result_23>,
219
274
  /**
220
275
  * / Admins, localTest: an empty canister from the core's cycles joins the demo pool.
221
276
  */
222
- 'createLocalPoolCanister' : ActorMethod<[], Result_13>,
277
+ 'createLocalPoolCanister' : ActorMethod<[], Result_17>,
223
278
  /**
224
279
  * / F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
225
280
  */
226
- 'createMyDriverCanister' : ActorMethod<[], Result_13>,
281
+ 'createMyDriverCanister' : ActorMethod<[], Result_17>,
227
282
  /**
228
283
  * / Admins: the simulator, created once (F-18).
229
284
  */
230
- 'ensureSimulator' : ActorMethod<[], Result_17>,
285
+ 'ensureSimulator' : ActorMethod<[], Result_22>,
231
286
  /**
232
287
  * / F-8: 15 min more for the holder of a demo canister.
233
288
  */
234
- 'extendDemoLease' : ActorMethod<[], Result_13>,
235
- 'getAdmins' : ActorMethod<[], Result_16>,
289
+ 'extendDemoLease' : ActorMethod<[], Result_17>,
290
+ 'getAdmins' : ActorMethod<[], Result_21>,
291
+ /**
292
+ * / For the fronts (through the package): where the chat of this environment is. Null =
293
+ * / no chat here yet. The room of a driver is `ChatRoomFunctions.driverRoomId`.
294
+ */
295
+ 'getChatConfig' : ActorMethod<[], [] | [ChatConfig]>,
296
+ /**
297
+ * / Admins: how far the driver rooms are (C-15).
298
+ */
299
+ 'getChatRoomsStatus' : ActorMethod<[], Result_20>,
236
300
  /**
237
301
  * / WO-1, WO-2: what the core knows of a canister — for the workers and anybody.
238
302
  */
239
303
  'getDriverCanisterStatus' : ActorMethod<[CanisterArgs], DriverCanisterStatus>,
240
- 'getDriverRollout' : ActorMethod<[], Result_15>,
241
- 'getFactoryStatus' : ActorMethod<[], Result_14>,
304
+ 'getDriverRollout' : ActorMethod<[], Result_19>,
305
+ 'getFactoryStatus' : ActorMethod<[], Result_18>,
242
306
  'getLogs' : ActorMethod<[], string>,
243
307
  /**
244
308
  * / The caller's own canister, or the demo canister the caller holds now.
245
309
  */
246
- 'getMyDriverCanister' : ActorMethod<[], Result_13>,
310
+ 'getMyDriverCanister' : ActorMethod<[], Result_17>,
247
311
  'getMyProfile' : ActorMethod<[], Result_4>,
312
+ /**
313
+ * / C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
314
+ * / rating yet). Ratings reach the core in the workers' batches, up to a minute late.
315
+ */
316
+ 'getMyRating' : ActorMethod<[], Result_16>,
248
317
  /**
249
318
  * / C-8: the caller's rides, newest first.
250
319
  */
251
- 'getMyRides' : ActorMethod<[RidesPageArgs], Result_12>,
320
+ 'getMyRides' : ActorMethod<[RidesPageArgs], Result_15>,
252
321
  /**
253
322
  * / C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
254
323
  */
255
- 'getProfiles' : ActorMethod<[ProfilesArgs], Result_11>,
324
+ 'getProfiles' : ActorMethod<[ProfilesArgs], Result_14>,
256
325
  /**
257
326
  * / F-11: the driver wasms released so far, oldest first.
258
327
  */
@@ -264,11 +333,11 @@ export interface TigiCore {
264
333
  /**
265
334
  * / Admins: the coordinator, the workers confirmed so far, the mode.
266
335
  */
267
- 'getWiring' : ActorMethod<[], Result_10>,
336
+ 'getWiring' : ActorMethod<[], Result_13>,
268
337
  /**
269
338
  * / Admins: how far the outbox to the workers is (C-6, C-7).
270
339
  */
271
- 'getWorkerOutbox' : ActorMethod<[], Result_9>,
340
+ 'getWorkerOutbox' : ActorMethod<[], Result_12>,
272
341
  /**
273
342
  * / Workers of the group: the core asks the coordinator once and remembers the worker,
274
343
  * / which then gets the network state through the outbox. A worker calls it once after
@@ -280,15 +349,42 @@ export interface TigiCore {
280
349
  * / Idempotent: a known requestId and a counted rating count once. Invalid entries are
281
350
  * / rejected and logged; the worker drops the whole batch after an ok.
282
351
  */
283
- 'ingestRideBatch' : ActorMethod<[RideBatch], Result_8>,
352
+ 'ingestRideBatch' : ActorMethod<[RideBatch], Result_11>,
353
+ /**
354
+ * / C-14: the accounts gate of the chat (U-43). The chat core asks this group's
355
+ * / coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
356
+ * / account with a name exists for the principal and the rider is not blocked.
357
+ */
358
+ 'isUser' : ActorMethod<[Principal], boolean>,
359
+ /**
360
+ * / F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
361
+ * / one-time claim code (F-20, U-45).
362
+ */
363
+ 'leaseDemoDriverCanister' : ActorMethod<[], Result_10>,
364
+ 'listBlocks' : ActorMethod<[PageArgs], Result_9>,
365
+ 'listDriverCanisters' : ActorMethod<[PageArgs], Result_8>,
284
366
  /**
285
- * / F-5 … F-7: a demo canister for 15 min (outside prod).
367
+ * / Admins: the driver rooms as the core wants them, 100 a page at most.
286
368
  */
287
- 'leaseDemoDriverCanister' : ActorMethod<[], Result_7>,
288
- 'listBlocks' : ActorMethod<[PageArgs], Result_6>,
289
- 'listDriverCanisters' : ActorMethod<[PageArgs], Result_5>,
369
+ 'listDriverRooms' : ActorMethod<[PageArgs], Result_7>,
370
+ /**
371
+ * / F-20: a fresh claim code for the caller's running demo lease; the old one stops
372
+ * / working.
373
+ */
374
+ 'newClaimCode' : ActorMethod<[], Result_6>,
290
375
  'removeAdmin' : ActorMethod<[PrincipalArgs], Result_2>,
291
376
  'resumeDriverRollout' : ActorMethod<[], Result_3>,
377
+ /**
378
+ * / Admins: the chat of this environment — the chat group's coordinator and the project
379
+ * / (whose admin and accounts field are this group's coordinator). Every call sends every
380
+ * / driver room again (a new project, a chat group set up again).
381
+ */
382
+ 'setChatConfig' : ActorMethod<[ChatConfig], Result_5>,
383
+ /**
384
+ * / Admins, localTest only: new claim codes live this long (the local check of an
385
+ * / expired code). Heap only: an upgrade brings back 15 min.
386
+ */
387
+ 'setClaimCodeTtl' : ActorMethod<[ClaimTtlArgs], Result>,
292
388
  'setLoggingEnabled' : ActorMethod<[boolean], Result_2>,
293
389
  /**
294
390
  * / The coordinator only: the balance below which the core asks for cycles.
@@ -61,7 +61,7 @@ export const idlFactory = ({ IDL }) => {
61
61
  'installedAtNs' : IDL.Opt(IDL.Int),
62
62
  'leaseUntilNs' : IDL.Opt(IDL.Int),
63
63
  });
64
- const Result_13 = IDL.Variant({ 'ok' : DriverCanister, 'err' : Error });
64
+ const Result_17 = IDL.Variant({ 'ok' : DriverCanister, 'err' : Error });
65
65
  const BlockDriverArgs = IDL.Record({
66
66
  'driverKey' : IDL.Opt(IDL.Text),
67
67
  'canister' : IDL.Principal,
@@ -71,6 +71,10 @@ export const idlFactory = ({ IDL }) => {
71
71
  'rider' : IDL.Principal,
72
72
  'reason' : IDL.Text,
73
73
  });
74
+ const ClaimArgs = IDL.Record({
75
+ 'code' : IDL.Text,
76
+ 'canister' : IDL.Principal,
77
+ });
74
78
  const WasmKind = IDL.Variant({ 'simulator' : IDL.Null, 'driver' : IDL.Null });
75
79
  const WasmCommitArgs = IDL.Record({
76
80
  'sha256' : IDL.Vec(IDL.Nat8),
@@ -83,18 +87,31 @@ export const idlFactory = ({ IDL }) => {
83
87
  'size' : IDL.Nat,
84
88
  'committedAtNs' : IDL.Int,
85
89
  });
86
- const Result_18 = IDL.Variant({ 'ok' : WasmInfo, 'err' : Error });
87
- const Result_17 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
88
- const Result_16 = IDL.Variant({
90
+ const Result_23 = IDL.Variant({ 'ok' : WasmInfo, 'err' : Error });
91
+ const Result_22 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
92
+ const Result_21 = IDL.Variant({
89
93
  'ok' : IDL.Vec(IDL.Principal),
90
94
  'err' : Error,
91
95
  });
96
+ const ChatConfig = IDL.Record({
97
+ 'chatCoordinatorId' : IDL.Principal,
98
+ 'projectId' : IDL.Text,
99
+ });
100
+ const ChatRoomsStatus = IDL.Record({
101
+ 'failures' : IDL.Nat,
102
+ 'pending' : IDL.Nat,
103
+ 'lastError' : IDL.Opt(IDL.Text),
104
+ 'config' : IDL.Opt(ChatConfig),
105
+ 'pendingSinceNs' : IDL.Opt(IDL.Int),
106
+ 'rooms' : IDL.Nat,
107
+ });
108
+ const Result_20 = IDL.Variant({ 'ok' : ChatRoomsStatus, 'err' : Error });
92
109
  const DriverCanisterStatus = IDL.Record({
93
110
  'moduleHash' : IDL.Opt(IDL.Vec(IDL.Nat8)),
94
111
  'blocked' : IDL.Bool,
95
112
  'registered' : IDL.Bool,
96
113
  });
97
- const Result_15 = IDL.Variant({ 'ok' : IDL.Opt(RolloutView), 'err' : Error });
114
+ const Result_19 = IDL.Variant({ 'ok' : IDL.Opt(RolloutView), 'err' : Error });
98
115
  const FactoryStatus = IDL.Record({
99
116
  'simulator' : IDL.Opt(IDL.Principal),
100
117
  'mode' : Mode,
@@ -106,13 +123,15 @@ export const idlFactory = ({ IDL }) => {
106
123
  'driverWasm' : IDL.Opt(WasmInfo),
107
124
  'registered' : IDL.Nat,
108
125
  });
109
- const Result_14 = IDL.Variant({ 'ok' : FactoryStatus, 'err' : Error });
126
+ const Result_18 = IDL.Variant({ 'ok' : FactoryStatus, 'err' : Error });
110
127
  const Profile = IDL.Record({
111
128
  'updatedAtNs' : IDL.Int,
112
129
  'name' : IDL.Text,
113
130
  'createdAtNs' : IDL.Int,
114
131
  });
115
132
  const Result_4 = IDL.Variant({ 'ok' : Profile, 'err' : Error });
133
+ const Rating = IDL.Record({ 'sum' : IDL.Nat, 'count' : IDL.Nat });
134
+ const Result_16 = IDL.Variant({ 'ok' : IDL.Opt(Rating), 'err' : Error });
116
135
  const RidesPageArgs = IDL.Record({
117
136
  'beforeIndex' : IDL.Opt(IDL.Nat),
118
137
  'limit' : IDL.Nat,
@@ -136,13 +155,13 @@ export const idlFactory = ({ IDL }) => {
136
155
  'nextBeforeIndex' : IDL.Opt(IDL.Nat),
137
156
  'rides' : IDL.Vec(RideEntry),
138
157
  });
139
- const Result_12 = IDL.Variant({ 'ok' : RidesPage, 'err' : Error });
158
+ const Result_15 = IDL.Variant({ 'ok' : RidesPage, 'err' : Error });
140
159
  const ProfilesArgs = IDL.Record({ 'principals' : IDL.Vec(IDL.Principal) });
141
160
  const ProfileEntry = IDL.Record({
142
161
  'principal' : IDL.Principal,
143
162
  'name' : IDL.Text,
144
163
  });
145
- const Result_11 = IDL.Variant({
164
+ const Result_14 = IDL.Variant({
146
165
  'ok' : IDL.Vec(ProfileEntry),
147
166
  'err' : Error,
148
167
  });
@@ -156,8 +175,8 @@ export const idlFactory = ({ IDL }) => {
156
175
  'knownWorkers' : IDL.Vec(IDL.Principal),
157
176
  'coordinator' : IDL.Opt(IDL.Principal),
158
177
  });
159
- const Result_10 = IDL.Variant({ 'ok' : Wiring, 'err' : Error });
160
- const Result_9 = IDL.Variant({
178
+ const Result_13 = IDL.Variant({ 'ok' : Wiring, 'err' : Error });
179
+ const Result_12 = IDL.Variant({
161
180
  'ok' : IDL.Record({
162
181
  'subjects' : IDL.Nat,
163
182
  'headSeq' : IDL.Nat64,
@@ -188,12 +207,28 @@ export const idlFactory = ({ IDL }) => {
188
207
  'rejected' : IDL.Nat,
189
208
  'ratingsCounted' : IDL.Nat,
190
209
  });
191
- const Result_8 = IDL.Variant({ 'ok' : RideBatchResult, 'err' : Error });
210
+ const Result_11 = IDL.Variant({ 'ok' : RideBatchResult, 'err' : Error });
211
+ const ClaimCode = IDL.Record({
212
+ 'expiresAtNs' : IDL.Int,
213
+ 'code' : IDL.Text,
214
+ 'canister' : IDL.Principal,
215
+ });
216
+ const LeasedCanister = IDL.Record({
217
+ 'moduleHash' : IDL.Opt(IDL.Vec(IDL.Nat8)),
218
+ 'owner' : IDL.Principal,
219
+ 'blocked' : IDL.Bool,
220
+ 'kind' : DriverCanisterKind,
221
+ 'claim' : IDL.Opt(ClaimCode),
222
+ 'createdAtNs' : IDL.Int,
223
+ 'canister' : IDL.Principal,
224
+ 'installedAtNs' : IDL.Opt(IDL.Int),
225
+ 'leaseUntilNs' : IDL.Opt(IDL.Int),
226
+ });
192
227
  const LeaseAnswer = IDL.Variant({
193
228
  'busy' : IDL.Record({ 'untilNs' : IDL.Int }),
194
- 'leased' : DriverCanister,
229
+ 'leased' : LeasedCanister,
195
230
  });
196
- const Result_7 = IDL.Variant({ 'ok' : LeaseAnswer, 'err' : Error });
231
+ const Result_10 = IDL.Variant({ 'ok' : LeaseAnswer, 'err' : Error });
197
232
  const PageArgs = IDL.Record({ 'offset' : IDL.Nat, 'limit' : IDL.Nat });
198
233
  const BlockTarget = IDL.Variant({
199
234
  'driverCanister' : IDL.Principal,
@@ -209,12 +244,28 @@ export const idlFactory = ({ IDL }) => {
209
244
  'target' : BlockTarget,
210
245
  'reason' : IDL.Text,
211
246
  });
212
- const Result_6 = IDL.Variant({ 'ok' : IDL.Vec(Block), 'err' : Error });
247
+ const Result_9 = IDL.Variant({ 'ok' : IDL.Vec(Block), 'err' : Error });
213
248
  const DriverCanistersPage = IDL.Record({
214
249
  'total' : IDL.Nat,
215
250
  'canisters' : IDL.Vec(DriverCanister),
216
251
  });
217
- const Result_5 = IDL.Variant({ 'ok' : DriverCanistersPage, 'err' : Error });
252
+ const Result_8 = IDL.Variant({ 'ok' : DriverCanistersPage, 'err' : Error });
253
+ const DriverRoomView = IDL.Record({
254
+ 'recipient' : IDL.Principal,
255
+ 'driverKey' : IDL.Text,
256
+ 'canister' : IDL.Principal,
257
+ 'lastError' : IDL.Opt(IDL.Text),
258
+ 'roomId' : IDL.Text,
259
+ 'synced' : IDL.Bool,
260
+ });
261
+ const Result_7 = IDL.Variant({
262
+ 'ok' : IDL.Vec(DriverRoomView),
263
+ 'err' : Error,
264
+ });
265
+ const Result_6 = IDL.Variant({ 'ok' : ClaimCode, 'err' : Error });
266
+ const Result_5 = IDL.Variant({ 'ok' : ChatConfig, 'err' : Error });
267
+ const ClaimTtlArgs = IDL.Record({ 'seconds' : IDL.Nat });
268
+ const Result = IDL.Variant({ 'ok' : IDL.Nat, 'err' : Error });
218
269
  const SetProfileArgs = IDL.Record({ 'name' : IDL.Text });
219
270
  const UnblockDriverArgs = IDL.Record({
220
271
  'driverKey' : IDL.Opt(IDL.Text),
@@ -227,43 +278,51 @@ export const idlFactory = ({ IDL }) => {
227
278
  'bytes' : IDL.Vec(IDL.Nat8),
228
279
  'index' : IDL.Nat32,
229
280
  });
230
- const Result = IDL.Variant({ 'ok' : IDL.Nat, 'err' : Error });
231
281
  const TigiCore = IDL.Service({
232
282
  'abortDriverRollout' : IDL.Func([], [Result_3], []),
233
283
  'addAdmin' : IDL.Func([PrincipalArgs], [Result_2], []),
234
- 'addPoolCanister' : IDL.Func([CanisterArgs], [Result_13], []),
284
+ 'addPoolCanister' : IDL.Func([CanisterArgs], [Result_17], []),
235
285
  'blockDriver' : IDL.Func([BlockDriverArgs], [Result_2], []),
236
286
  'blockRider' : IDL.Func([BlockRiderArgs], [Result_2], []),
287
+ 'claimDriverCanister' : IDL.Func([ClaimArgs], [Result_17], []),
237
288
  'clearLogs' : IDL.Func([], [], []),
238
- 'commitDriverWasm' : IDL.Func([WasmCommitArgs], [Result_18], []),
239
- 'createLocalPoolCanister' : IDL.Func([], [Result_13], []),
240
- 'createMyDriverCanister' : IDL.Func([], [Result_13], []),
241
- 'ensureSimulator' : IDL.Func([], [Result_17], []),
242
- 'extendDemoLease' : IDL.Func([], [Result_13], []),
243
- 'getAdmins' : IDL.Func([], [Result_16], ['query']),
289
+ 'commitDriverWasm' : IDL.Func([WasmCommitArgs], [Result_23], []),
290
+ 'createLocalPoolCanister' : IDL.Func([], [Result_17], []),
291
+ 'createMyDriverCanister' : IDL.Func([], [Result_17], []),
292
+ 'ensureSimulator' : IDL.Func([], [Result_22], []),
293
+ 'extendDemoLease' : IDL.Func([], [Result_17], []),
294
+ 'getAdmins' : IDL.Func([], [Result_21], ['query']),
295
+ 'getChatConfig' : IDL.Func([], [IDL.Opt(ChatConfig)], ['query']),
296
+ 'getChatRoomsStatus' : IDL.Func([], [Result_20], ['query']),
244
297
  'getDriverCanisterStatus' : IDL.Func(
245
298
  [CanisterArgs],
246
299
  [DriverCanisterStatus],
247
300
  ['query'],
248
301
  ),
249
- 'getDriverRollout' : IDL.Func([], [Result_15], ['query']),
250
- 'getFactoryStatus' : IDL.Func([], [Result_14], ['query']),
302
+ 'getDriverRollout' : IDL.Func([], [Result_19], ['query']),
303
+ 'getFactoryStatus' : IDL.Func([], [Result_18], ['query']),
251
304
  'getLogs' : IDL.Func([], [IDL.Text], ['query']),
252
- 'getMyDriverCanister' : IDL.Func([], [Result_13], ['query']),
305
+ 'getMyDriverCanister' : IDL.Func([], [Result_17], ['query']),
253
306
  'getMyProfile' : IDL.Func([], [Result_4], ['query']),
254
- 'getMyRides' : IDL.Func([RidesPageArgs], [Result_12], ['query']),
255
- 'getProfiles' : IDL.Func([ProfilesArgs], [Result_11], ['query']),
307
+ 'getMyRating' : IDL.Func([], [Result_16], ['query']),
308
+ 'getMyRides' : IDL.Func([RidesPageArgs], [Result_15], ['query']),
309
+ 'getProfiles' : IDL.Func([ProfilesArgs], [Result_14], ['query']),
256
310
  'getReleasedDriverWasms' : IDL.Func([], [IDL.Vec(ReleasedWasm)], ['query']),
257
311
  'getSimulator' : IDL.Func([], [IDL.Opt(IDL.Principal)], ['query']),
258
- 'getWiring' : IDL.Func([], [Result_10], ['query']),
259
- 'getWorkerOutbox' : IDL.Func([], [Result_9], ['query']),
312
+ 'getWiring' : IDL.Func([], [Result_13], ['query']),
313
+ 'getWorkerOutbox' : IDL.Func([], [Result_12], ['query']),
260
314
  'helloFromWorker' : IDL.Func([], [Result_2], []),
261
- 'ingestRideBatch' : IDL.Func([RideBatch], [Result_8], []),
262
- 'leaseDemoDriverCanister' : IDL.Func([], [Result_7], []),
263
- 'listBlocks' : IDL.Func([PageArgs], [Result_6], ['query']),
264
- 'listDriverCanisters' : IDL.Func([PageArgs], [Result_5], ['query']),
315
+ 'ingestRideBatch' : IDL.Func([RideBatch], [Result_11], []),
316
+ 'isUser' : IDL.Func([IDL.Principal], [IDL.Bool], ['query']),
317
+ 'leaseDemoDriverCanister' : IDL.Func([], [Result_10], []),
318
+ 'listBlocks' : IDL.Func([PageArgs], [Result_9], ['query']),
319
+ 'listDriverCanisters' : IDL.Func([PageArgs], [Result_8], ['query']),
320
+ 'listDriverRooms' : IDL.Func([PageArgs], [Result_7], ['query']),
321
+ 'newClaimCode' : IDL.Func([], [Result_6], []),
265
322
  'removeAdmin' : IDL.Func([PrincipalArgs], [Result_2], []),
266
323
  'resumeDriverRollout' : IDL.Func([], [Result_3], []),
324
+ 'setChatConfig' : IDL.Func([ChatConfig], [Result_5], []),
325
+ 'setClaimCodeTtl' : IDL.Func([ClaimTtlArgs], [Result], []),
267
326
  'setLoggingEnabled' : IDL.Func([IDL.Bool], [Result_2], []),
268
327
  'setLowCyclesBelow' : IDL.Func([IDL.Nat], [Result_2], []),
269
328
  'setMyProfile' : IDL.Func([SetProfileArgs], [Result_4], []),
@@ -0,0 +1,77 @@
1
+ import type { Identity } from "@icp-sdk/core/agent";
2
+ import type { ClaimCode as CandidClaimCode, DriverCanister as CandidDriverCanister } from "../../declarations/core/core.did.js";
3
+ import { type GroupOptions } from "../group/canister-actor.js";
4
+ import type { ClaimCodeView, DemoLeaseView, DriverCanisterView } from "../interfaces.js";
5
+ /** The fragment key of a claim link: `https://<canister>.icp0.io/#claim=<code>`. */
6
+ export declare const CLAIM_FRAGMENT_KEY = "claim";
7
+ /** F-20a: a code is 32 characters of base64url; the core refuses more than this. */
8
+ export declare const MAX_CLAIM_CODE_CHARS = 64;
9
+ /**
10
+ * F-20: the link the rider's site shows after a lease ("Otwórz swój kanister"). The code
11
+ * rides in the fragment, which the browser never sends to a server.
12
+ * @param frontOrigin the origin of the driver canister's front; default `https://<canister>.icp0.io`
13
+ */
14
+ export declare function claimLinkOf(canisterId: string, code: string, frontOrigin?: string): string;
15
+ /**
16
+ * F-20: the claim code in a location hash (`#claim=<code>`, also among other `&` parts), or
17
+ * undefined. The driver's front clears the fragment after the claim.
18
+ */
19
+ export declare function claimCodeOfHash(hash: string): string | undefined;
20
+ /** @internal */
21
+ export declare function driverCanisterOf(record: Pick<CandidDriverCanister, "canister" | "owner" | "kind" | "leaseUntilNs" | "blocked">): DriverCanisterView;
22
+ /** @internal */
23
+ export declare function claimCodeOf(claim: CandidClaimCode): ClaimCodeView;
24
+ export declare class DriverCanistersActor {
25
+ private readonly group;
26
+ constructor(coordinatorId: string, identity: Identity, options?: GroupOptions);
27
+ /**
28
+ * F-5 … F-7, F-20a: a demo canister for 15 minutes, reinstalled with the caller as its
29
+ * owner — or the caller's lease already (no reinstall, no code: `newClaimCodeAsyncUnsafe`).
30
+ * @returns `leased` with `claim` after a fresh lease (undefined when the core could make
31
+ * no code — ask `newClaimCodeAsyncUnsafe`); `busy` with the time the pool frees up
32
+ * @throws Error with message `CanisterError` — `NotAuthorized` (prod), `NotFound` (no pool),
33
+ * `InvalidData` (no driver wasm), `RemoteCanisterError` (the install failed)
34
+ * @throws Error with message `CallRefusedAtInspectionStage` — anonymous, or the daily limit (30)
35
+ * @throws Error with message `CriticalCanisterError` — the core could not be reached
36
+ */
37
+ leaseDemoAsyncUnsafe(): Promise<DemoLeaseView>;
38
+ /**
39
+ * F-8: 15 minutes more for the holder of the demo canister (at most 30 ahead), also after
40
+ * the end while nobody took it over. The owner stays (F-20f).
41
+ * @throws Error with message `CanisterError` — `NotFound` (no lease of the caller), `InvalidData` (being installed)
42
+ * @throws Error with message `CallRefusedAtInspectionStage` — anonymous, or the daily limit (30)
43
+ * @throws Error with message `CriticalCanisterError` — the core could not be reached
44
+ */
45
+ extendDemoAsyncUnsafe(): Promise<DriverCanisterView>;
46
+ /**
47
+ * The caller's own driver canister, or the demo canister the caller holds now (as the
48
+ * lease holder — after a claim the canister's owner is the driver, `ownerPrincipal`).
49
+ * @returns undefined when the caller has none
50
+ * @throws Error with message `CanisterError` — `NotAuthorized` (anonymous)
51
+ * @throws Error with message `CriticalCanisterError` — the core could not be reached
52
+ */
53
+ getMineAsyncUnsafe(): Promise<DriverCanisterView | undefined>;
54
+ /**
55
+ * F-20c: a new claim code for the caller's running demo lease ("Nowy link"); the code
56
+ * before it stops working. Good for 15 minutes, once.
57
+ * @throws Error with message `CanisterError` — `NotFound` (no running lease of the caller),
58
+ * `InvalidData` (being installed), `RemoteCanisterError` (no randomness — try again)
59
+ * @throws Error with message `CallRefusedAtInspectionStage` — anonymous, or the daily limit (30)
60
+ * @throws Error with message `CriticalCanisterError` — the core could not be reached
61
+ */
62
+ newClaimCodeAsyncUnsafe(): Promise<ClaimCodeView>;
63
+ /**
64
+ * F-20d, F-20e: the caller — the driver signed in on the canister's own front — takes
65
+ * over the demo canister with the code of the link. The canister's owner becomes the
66
+ * caller, and so does the recipient of its chat room; the lease stays with its holder.
67
+ * @returns the canister with the caller as `ownerPrincipal`
68
+ * @throws Error with message `CanisterError` — `NotAuthorized` (the code is wrong, expired,
69
+ * used, or not for this canister — one answer for all), `InvalidData` (the canister
70
+ * is busy — try again), `RemoteCanisterError` (the driver canister did not take it;
71
+ * the code stays good)
72
+ * @throws Error with message `CallRefusedAtInspectionStage` — anonymous, or the daily limit (30)
73
+ * @throws Error with message `CriticalCanisterError` — the core could not be reached
74
+ */
75
+ claimAsyncUnsafe(canisterId: string, code: string): Promise<DriverCanisterView>;
76
+ }
77
+ //# sourceMappingURL=driver-canisters-actor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver-canisters-actor.d.ts","sourceRoot":"","sources":["../../src/actors/driver-canisters-actor.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChI,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/F,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGzF,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,GAAE,MAAwC,GAAG,MAAM,CAE3H;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBhE;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC,GAAG,kBAAkB,CAUnJ;AAED,gBAAgB;AAChB,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CAEjE;AAED,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;gBAEtB,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAE,YAAiB;IAIjF;;;;;;;;;OASG;IACU,oBAAoB,IAAI,OAAO,CAAC,aAAa,CAAC;IAS3D;;;;;;OAMG;IACU,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIjE;;;;;;OAMG;IACU,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAS1E;;;;;;;OAOG;IACU,uBAAuB,IAAI,OAAO,CAAC,aAAa,CAAC;IAI9D;;;;;;;;;;;OAWG;IACU,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAU/F"}