@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.
package/README.md CHANGED
@@ -6,7 +6,9 @@ carries the rider's few driver-canister endpoints (U-14: `getRide`, `cancelRide`
6
6
  `getLicence`), built from `protocol/tigi-driver.did`, so the consumer never sees a driver
7
7
  canister's id.
8
8
 
9
- Status: the rider's side (night 1, U-42). Version 0.1.0 is the first to publish.
9
+ Status: the rider's side (night 1, U-42); 0.2.0 (stage 2a, U-43) adds the rider's own
10
+ rating and WHERE the chat with a driver is; 0.3.0 (U-45) adds `DriverCanistersActor` — the
11
+ demo lease and the one-time claim code. Version 0.1.0 was the first to publish.
10
12
 
11
13
  ## The rider
12
14
 
@@ -39,6 +41,7 @@ await request.getLicenceAsyncUnsafe(); // from accepted to
39
41
  await request.rateDriverAsyncUnsafe(5); // after completed, once
40
42
 
41
43
  const page = await profiles.getMyRidesAsyncUnsafe(); // the history in the core, 20 a page
44
+ const mine = await profiles.getMyRatingAsyncUnsafe(); // PF-4: { average: 4.87, count, sum } | undefined ("Brak ocen")
42
45
  await rides.getPastRideAsyncUnsafe(page.rides[0].rideRef); // its details from the driver canister
43
46
  ```
44
47
 
@@ -56,6 +59,82 @@ Errors: `CanisterError` (with `errorKey`; `refusalKeyOf(err)` gives the worker's
56
59
  `NOT_COMPLETED`, `EXPIRED`, `BLOCKED`), `CallRefusedAtInspectionStage`,
57
60
  `CriticalCanisterError`.
58
61
 
62
+ ## For the fronts: the chat (U-43)
63
+
64
+ One chat room per DRIVER in `chat-sharded` (not per ride): its recipient is the owner of
65
+ the driver canister, and every Tigi account may open a chat there (the chat asks the Tigi
66
+ coordinator WHERE the accounts are and the core `isUser`). The core makes the rooms through
67
+ the coordinator; this package only says WHERE — the fronts send and read messages with
68
+ `@jsm-mit/chat-sharded-package` themselves (this package does not wrap the chat).
69
+
70
+ ```ts
71
+ import { ChatPlacesActor, driverRoomId } from "@jsm-mit/tigi-sharded-package";
72
+ import { ChatsActor, MessagesActor } from "@jsm-mit/chat-sharded-package";
73
+
74
+ // The rider (PR-25): from `accepted` to the end of the ride.
75
+ const place = await request.getChatPlaceAsyncUnsafe(); // { chatCoordinatorId, projectId, roomId } | undefined
76
+ if (place) {
77
+ const chats = new ChatsActor(place.chatCoordinatorId, identity, { host });
78
+ const chat = await chats.openChatAsyncUnsafe({ projectId: place.projectId, roomId: place.roomId, customerName: profile.name });
79
+ // … MessagesActor(place.chatCoordinatorId, identity).postAsyncUnsafe / pollNewMessagesAsyncUnsafe
80
+ }
81
+
82
+ // The driver (FK-20): the room of their own canister; they are its recipient.
83
+ const driverPlace = await new ChatPlacesActor(coordinatorId, identity, { host }).getDriverChatPlaceAsyncUnsafe(myDriverCanisterId);
84
+ // list the chats of driverPlace.roomId (ChatsActor.getMyChatsAsyncUnsafe({ projectId, roomId }))
85
+ // and show only the current rider's chat
86
+ ```
87
+
88
+ - `undefined` = no chat in this environment yet (no chat config in the core) or a
89
+ simulated driver (no chat in MVP).
90
+ - The room id is deterministic: `driverRoomId(canister)` = `drv-<canister id>` (the
91
+ core's `ChatRoomFunctions.driverRoomId`).
92
+ - The rider needs a Tigi profile (`setMyProfileAsyncUnsafe`) — without one the chat
93
+ refuses to open it (`CanisterError`, `NotAuthorized`).
94
+ - One chat per (room, rider, recipients): the rider has one chat with a driver over all
95
+ their rides. A demo pool canister taken over by another tester gets that tester as
96
+ the recipient; the chats with the previous tester stay with them.
97
+ - The room may appear a few seconds after the driver's canister (the core's outbox);
98
+ `openChatAsyncUnsafe` answers `NotFound` until then — try again.
99
+
100
+ ## For the fronts: the driver's own canister (U-45)
101
+
102
+ Internet Identity gives one person a different principal on every origin. The demo lease is
103
+ taken on the rider's site; the driver signs in on the canister's own front
104
+ (`https://<canister>.icp0.io`) with another principal. A fresh lease answers a one-time
105
+ claim code (15 min, single use; the core keeps only its sha256) that hands the canister to
106
+ whoever claims it there (`fabryka.md` F-20).
107
+
108
+ ```ts
109
+ import { DriverCanistersActor, claimLinkOf, claimCodeOfHash } from "@jsm-mit/tigi-sharded-package";
110
+
111
+ // The rider's site (the lease holder).
112
+ const canisters = new DriverCanistersActor(coordinatorId, identity, { host });
113
+ const lease = await canisters.leaseDemoAsyncUnsafe(); // { kind: "leased", canister, claim? } | { kind: "busy", untilMs }
114
+ if (lease.kind === "leased" && lease.claim) {
115
+ link = claimLinkOf(lease.canister.canisterId, lease.claim.code); // "Otwórz swój kanister"
116
+ }
117
+ const fresh = await canisters.newClaimCodeAsyncUnsafe(); // "Nowy link": the old code stops working
118
+ await canisters.extendDemoAsyncUnsafe(); // F-8: 15 min more
119
+ await canisters.getMineAsyncUnsafe(); // the held demo canister (or the own one) | undefined
120
+
121
+ // The driver's front, signed in as a non-owner, with #claim=<code> in the address.
122
+ const code = claimCodeOfHash(window.location.hash);
123
+ if (code) {
124
+ await new DriverCanistersActor(coordinatorId, identity, { host }).claimAsyncUnsafe(canisterId, code);
125
+ // clear the fragment, reload: the driver is the owner now
126
+ }
127
+ ```
128
+
129
+ - A refused claim is always `CanisterError` `NotAuthorized` — wrong, expired, used or not
130
+ this canister's code alike.
131
+ - The lease stays with its holder: `getMineAsyncUnsafe`, `extendDemoAsyncUnsafe` and
132
+ `newClaimCodeAsyncUnsafe` keep working from the rider's site; `ownerPrincipal` names
133
+ the driver after the claim. The chat room of the canister gets the driver as its
134
+ recipient.
135
+ - The same holder leasing again (no reinstall) gets no code: `newClaimCodeAsyncUnsafe`.
136
+ - These views carry the driver canister's id: it is the driver's own address.
137
+
59
138
  The Test Manager (stage and the test modes): `TestManagerActor.hasSimulatedDriversAsyncUnsafe`,
60
139
  `spawnDriversAsyncUnsafe` (12 drivers), `setSpeedUpAsyncUnsafe(request, 10)` before choosing.
61
140
  Offers of the simulator have `simulated: true`.
@@ -68,7 +147,9 @@ npm run test-unit # no replica needed
68
147
  npm run test-drivers # (a) 5 real driver canisters, driver-bots, route-stub
69
148
  npm run test-simulator # (b) the simulator, 20 requests, 20 rides
70
149
  npm run test-split # (c) an area split during traffic
150
+ npm run test-claim # (d) the demo lease and the claim code (U-45)
71
151
  npm run test-smoke # one whole ride with the simulator (run by publish-public)
152
+ npm run load-local # the load test: 200 simulated drivers, 100 riders (docs/load-test-2026-10-24.md)
72
153
  npm run publish-public # human-run: publish from master (see below)
73
154
  npm run sync-declarations # after a change of a .did (`… protocol` for the protocol and the simulator only)
74
155
  ```
@@ -76,7 +157,9 @@ npm run sync-declarations # after a change of a .did (`… protocol` for the pr
76
157
  The end-to-end suites run on the LOCAL replica only (`scripts/run-tests-local.sh`): a fresh
77
158
  group, local cycles, the driver and simulator wasms of `../../tigi-driver-rust` (built
78
159
  there, never changed). Logs and measurements go to `/tmp/claude-1000/tigi/`
79
- (`TEST_LOG_DIR`).
160
+ (`TEST_LOG_DIR`). The load test builds its group with its own coordinator
161
+ (`tigi-sharded-coordinator-load`), so the shared local group stays; its settings are
162
+ environment variables (`scripts/load-local.ts`, `scripts/run-load-local.sh`).
80
163
 
81
164
  ## Publishing
82
165
 
@@ -1,5 +1,19 @@
1
+ // WHERE the accounts of a principal are (rule `sharding.md`, "A WHERE answer is a place"):
2
+ // a canister to ask, or a referral to another coordinator to ask the same question (after
3
+ // the core budded into a peer group). The client follows at most 2 referrals.
4
+ type AccountsPlace = variant {
5
+ // Ask this canister `isUser` (today: the core of the group).
6
+ canister : principal;
7
+ // Ask this coordinator `accountsCanisterFor` again.
8
+ coordinator : principal;
9
+ };
1
10
  type AssignPrefixArgs = record { prefix : text; worker : principal };
2
11
  type CanisterArgs = record { canister : principal };
12
+ // The chat group's admin methods this coordinator calls for its core (rule `sharding.md`,
13
+ // "Between two groups": the coordinator calls for its group). A fixed list: the core
14
+ // composes the arguments and keeps the logic, the coordinator only forwards. A new
15
+ // method of the chat group is a new case here, never a free method name.
16
+ type ChatAdminMethod = variant { updateRoom; createRoom; deleteRoom };
3
17
  type CommitWasmArgs = record {
4
18
  // Of the whole module. The coordinator refuses a module that does not match.
5
19
  sha256 : blob;
@@ -121,6 +135,16 @@ type Event = record {
121
135
  kind : text;
122
136
  "text" : text;
123
137
  };
138
+ // The arguments of the method are the core's, Candid-encoded (`to_candid` in Motoko) —
139
+ // the coordinator does not read them and keeps no copy of the chat group's types.
140
+ type ForwardChatAdminArgs = record {
141
+ method : ChatAdminMethod;
142
+ // The one argument of the method, Candid-encoded.
143
+ args : blob;
144
+ // The chat group's COORDINATOR (the core's chat config) — the group's address. The
145
+ // coordinator asks it where the chat core is.
146
+ chatCoordinator : principal;
147
+ };
124
148
  type GeohashesArgs = record { geohashes : vec text };
125
149
  // DEPLOYED: fresh from the deploy, the deploy admins rule, no worker exists or is created.
126
150
  // LIVE: a person claimed the superadmin role; the group works.
@@ -320,25 +344,26 @@ type ReportOutboxStuckArgs = record {
320
344
  };
321
345
  type Result = variant { Ok : vec principal; Err : CoordinatorError };
322
346
  type Result_1 = variant { Ok : Roles; Err : CoordinatorError };
323
- type Result_10 = variant { Ok : bool; Err : CoordinatorError };
324
- type Result_11 = variant { Ok : vec WorkerRecord; Err : CoordinatorError };
325
- type Result_12 = variant { Ok : CoreRecord; Err : CoordinatorError };
326
- type Result_13 = variant { Ok : WorkerStatus; Err : CoordinatorError };
327
- type Result_14 = variant { Ok : Dependents; Err : CoordinatorError };
328
- type Result_15 = variant { Ok : Config; Err : CoordinatorError };
329
- type Result_16 = variant { Ok : SetWorkerConfigResult; Err : CoordinatorError };
330
- type Result_17 = variant { Ok : WorkerView; Err : CoordinatorError };
331
- type Result_18 = variant { Ok : SplitResult; Err : CoordinatorError };
332
- type Result_19 = variant { Ok : nat; Err : CoordinatorError };
347
+ type Result_10 = variant { Ok : vec WorkerLive; Err : CoordinatorError };
348
+ type Result_11 = variant { Ok : bool; Err : CoordinatorError };
349
+ type Result_12 = variant { Ok : vec WorkerRecord; Err : CoordinatorError };
350
+ type Result_13 = variant { Ok : CoreRecord; Err : CoordinatorError };
351
+ type Result_14 = variant { Ok : WorkerStatus; Err : CoordinatorError };
352
+ type Result_15 = variant { Ok : Dependents; Err : CoordinatorError };
353
+ type Result_16 = variant { Ok : Config; Err : CoordinatorError };
354
+ type Result_17 = variant { Ok : SetWorkerConfigResult; Err : CoordinatorError };
355
+ type Result_18 = variant { Ok : WorkerView; Err : CoordinatorError };
356
+ type Result_19 = variant { Ok : SplitResult; Err : CoordinatorError };
333
357
  type Result_2 = variant { Ok : vec PrefixEntry; Err : CoordinatorError };
334
- type Result_20 = variant { Ok : nat64; Err : CoordinatorError };
358
+ type Result_20 = variant { Ok : nat; Err : CoordinatorError };
359
+ type Result_21 = variant { Ok : nat64; Err : CoordinatorError };
335
360
  type Result_3 = variant { Ok : WasmInfo; Err : CoordinatorError };
336
361
  type Result_4 = variant { Ok : principal; Err : CoordinatorError };
337
362
  type Result_5 = variant { Ok : DeletedWorker; Err : CoordinatorError };
338
363
  type Result_6 = variant { Ok : vec text; Err : CoordinatorError };
339
- type Result_7 = variant { Ok : CoreLive; Err : CoordinatorError };
340
- type Result_8 = variant { Ok : Status; Err : CoordinatorError };
341
- type Result_9 = variant { Ok : vec WorkerLive; Err : CoordinatorError };
364
+ type Result_7 = variant { Ok : blob; Err : CoordinatorError };
365
+ type Result_8 = variant { Ok : CoreLive; Err : CoordinatorError };
366
+ type Result_9 = variant { Ok : Status; Err : CoordinatorError };
342
367
  // Somebody asked for the superadmin role.
343
368
  type RoleRequest = record { "principal" : principal; atNs : nat64 };
344
369
  // Who rules the group — for the front.
@@ -477,6 +502,11 @@ type WorkerView = record {
477
502
  "record" : WorkerRecord;
478
503
  };
479
504
  service : (InitArgs) -> {
505
+ // KO-16: WHERE the accounts of a principal are — a place: `canister` (ask it `isUser`) or
506
+ // `coordinator` (a referral: ask that coordinator again). Asked by the chat core for a
507
+ // customer of the project whose accounts field names this coordinator. Today `canister` =
508
+ // the core of the group for every principal (null = no core yet). Never the answer itself.
509
+ accountsCanisterFor : (principal) -> (opt AccountsPlace) query;
480
510
  // An admin of the core, added by a superadmin through the coordinator.
481
511
  addCoreAdmin : (PrincipalArgs) -> (Result);
482
512
  // A deploy admin more — a machine that runs seeds or tests. Not in a live prod group.
@@ -506,8 +536,15 @@ service : (InitArgs) -> {
506
536
  // KO-9: every prefix of the worker goes to `target`, and the worker is closed. The
507
537
  // emptied worker stays until a superadmin deletes it or opens it again.
508
538
  drainWorker : (DrainWorkerArgs) -> (Result_6);
539
+ // KO-16: the core only — one admin call on the chat group, made by this coordinator, the
540
+ // admin of the project there. The core composes the argument (`to_candid`) and reads the
541
+ // answer (`from_candid`); the coordinator checks the method against its fixed list, finds
542
+ // the chat core through the chat coordinator, and answers with the chat core's reply as it
543
+ // came (`Ok`), whatever it says. `Err` = the chat group could not be reached: a rejected
544
+ // call forgets the chat core, asks the chat coordinator again and tries once more.
545
+ forwardChatAdmin : (ForwardChatAdminArgs) -> (Result_7);
509
546
  // What the core says of itself right now — one composite query for the front.
510
- getCoreStatus : () -> (Result_7) composite_query;
547
+ getCoreStatus : () -> (Result_8) composite_query;
511
548
  // The core of the group.
512
549
  getHomeCanister : () -> (opt principal) query;
513
550
  // The whole prefix map: which worker serves which area.
@@ -516,10 +553,10 @@ service : (InitArgs) -> {
516
553
  // ask. The principal who asked is for the superadmin only.
517
554
  getRoles : () -> (Roles) query;
518
555
  // Everything the superadmin front shows.
519
- getStatus : () -> (Result_8) query;
556
+ getStatus : () -> (Result_9) query;
520
557
  // What every worker says of itself right now — one composite query, the workers' own
521
558
  // `getStatus` queries inside it. A worker that cannot be asked carries the reason instead.
522
- getWorkersStatus : () -> (Result_9) composite_query;
559
+ getWorkersStatus : () -> (Result_10) composite_query;
523
560
  // The superadmin hands the role over to the one who asked.
524
561
  handOverSuperadmin : () -> (Result_1);
525
562
  // Whether this coordinator still has dependents — the core it owns, or workers, code or
@@ -532,7 +569,7 @@ service : (InitArgs) -> {
532
569
  // A test mode only (`prod` and `stage` refuse, and so does the worker): a load put on
533
570
  // ONE worker — its per-prefix counters grow, and it reports the level given to the
534
571
  // coordinator as a real minute would. What a local script uses to force a split.
535
- injectWorkerTestLoad : (InjectTestLoadArgs) -> (Result_10);
572
+ injectWorkerTestLoad : (InjectTestLoadArgs) -> (Result_11);
536
573
  // Installs the core wasm on the core: a core without code, or — outside prod — a core
537
574
  // that has code (handed over at the install, or a reset). A fresh state, the same canister.
538
575
  installCore : () -> (Result_3);
@@ -550,11 +587,11 @@ service : (InitArgs) -> {
550
587
  // reaches the areas of several workers (WO-12).
551
588
  locateGeohashes : (GeohashesArgs) -> (vec opt principal) query;
552
589
  // A superadmin reads the query load of every installed worker now.
553
- readQueryLoads : () -> (Result_11);
590
+ readQueryLoads : () -> (Result_12);
554
591
  // What the management canister says of the core: its balance and its module.
555
- refreshCore : () -> (Result_12);
592
+ refreshCore : () -> (Result_13);
556
593
  // What a worker says of itself now. The coordinator keeps the memory and the cycles.
557
- refreshWorker : (CanisterArgs) -> (Result_13);
594
+ refreshWorker : (CanisterArgs) -> (Result_14);
558
595
  removeCoreAdmin : (PrincipalArgs) -> (Result);
559
596
  removeDeployAdmin : (PrincipalArgs) -> (Result_1);
560
597
  // KO-10, C-11: the core's balance is below `lowCyclesBelow`: it gets `cyclesPerWorker`,
@@ -582,28 +619,28 @@ service : (InitArgs) -> {
582
619
  // installed again from scratch — the same ids, the same cycles, no create fee — and the
583
620
  // map starts again: the first worker holds the world. One canister at a time; refused
584
621
  // while a split, a drain or an upgrade runs.
585
- resetGroup : () -> (Result_14);
622
+ resetGroup : () -> (Result_15);
586
623
  // Changes what a superadmin may: `spread`, the cycles of a worker, the own reserve,
587
624
  // `maxWorkers`, the query thresholds. Only the fields given are changed.
588
- setConfig : (SetConfigArgs) -> (Result_15);
589
- setCoreLoggingEnabled : (CoreLoggingArgs) -> (Result_10);
625
+ setConfig : (SetConfigArgs) -> (Result_16);
626
+ setCoreLoggingEnabled : (CoreLoggingArgs) -> (Result_11);
590
627
  // The config of the workers of the group: the load thresholds, logging. Only the fields
591
628
  // given are changed. The result is stored, given to every worker that has its code, and
592
629
  // to every worker created later.
593
- setWorkerConfig : (WorkerConfigArgs) -> (Result_16);
630
+ setWorkerConfig : (WorkerConfigArgs) -> (Result_17);
594
631
  // Opens a worker to the prefixes of a split again, or closes it without giving anything
595
632
  // away.
596
- setWorkerOpen : (SetWorkerOpenArgs) -> (Result_17);
633
+ setWorkerOpen : (SetWorkerOpenArgs) -> (Result_18);
597
634
  // A superadmin splits a worker now, whatever its load and `spread` (KO-17): a fresh worker
598
635
  // takes about half of its prefixes. Answers with the new worker and the prefixes it got.
599
- splitWorker : (CanisterArgs) -> (Result_18);
636
+ splitWorker : (CanisterArgs) -> (Result_19);
600
637
  // A worker of the group sends its cycles here before it is deleted (`giveBackCycles`).
601
638
  // The workers only: somebody else's cycles are refused (they go back to the sender).
602
639
  takeCycles : () -> (nat);
603
640
  // Cycles for the core, by hand: `cyclesPerWorker`, like a worker's top-up.
604
- topUpCore : () -> (Result_19);
641
+ topUpCore : () -> (Result_20);
605
642
  // Cycles for a worker, by hand.
606
- topUpWorker : (CanisterArgs) -> (Result_19);
643
+ topUpWorker : (CanisterArgs) -> (Result_20);
607
644
  // KO-11: a new build of the core: stop → upgrade → start; its state stays (C-12).
608
645
  upgradeCore : () -> (Result_3);
609
646
  // KO-11: a new worker build on a worker that runs: stop → upgrade → start. Its state
@@ -611,10 +648,10 @@ service : (InitArgs) -> {
611
648
  // a split or a drain holds the worker.
612
649
  upgradeWorker : (CanisterArgs) -> (Result_3);
613
650
  // The core wasm, in chunks like the worker's.
614
- uploadCoreWasmChunk : (WasmChunkArgs) -> (Result_20);
651
+ uploadCoreWasmChunk : (WasmChunkArgs) -> (Result_21);
615
652
  // One chunk of a NEW worker wasm. The first chunk (index 0) drops what was uploaded
616
653
  // before; the module counts only after `commitWorkerWasm`.
617
- uploadWorkerWasmChunk : (WasmChunkArgs) -> (Result_20);
654
+ uploadWorkerWasmChunk : (WasmChunkArgs) -> (Result_21);
618
655
  // KO-1, KO-2: the worker of the area a geohash lies in — the longest prefix of the map
619
656
  // wins. None = no installed worker serves the area (no worker yet, or its worker is being
620
657
  // installed). Uncertified: the package checks the answer against `listWorkers`, and a
@@ -2,8 +2,34 @@ import type { Principal } from '@icp-sdk/core/principal';
2
2
  import type { ActorMethod } from '@icp-sdk/core/agent';
3
3
  import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
+ /**
6
+ * WHERE the accounts of a principal are (rule `sharding.md`, "A WHERE answer is a place"):
7
+ * a canister to ask, or a referral to another coordinator to ask the same question (after
8
+ * the core budded into a peer group). The client follows at most 2 referrals.
9
+ */
10
+ export type AccountsPlace = {
11
+ /**
12
+ * Ask this canister `isUser` (today: the core of the group).
13
+ */
14
+ 'canister' : Principal
15
+ } |
16
+ {
17
+ /**
18
+ * Ask this coordinator `accountsCanisterFor` again.
19
+ */
20
+ 'coordinator' : Principal
21
+ };
5
22
  export interface AssignPrefixArgs { 'prefix' : string, 'worker' : Principal }
6
23
  export interface CanisterArgs { 'canister' : Principal }
24
+ /**
25
+ * The chat group's admin methods this coordinator calls for its core (rule `sharding.md`,
26
+ * "Between two groups": the coordinator calls for its group). A fixed list: the core
27
+ * composes the arguments and keeps the logic, the coordinator only forwards. A new
28
+ * method of the chat group is a new case here, never a free method name.
29
+ */
30
+ export type ChatAdminMethod = { 'updateRoom' : null } |
31
+ { 'createRoom' : null } |
32
+ { 'deleteRoom' : null };
7
33
  export interface CommitWasmArgs {
8
34
  /**
9
35
  * Of the whole module. The coordinator refuses a module that does not match.
@@ -201,6 +227,22 @@ export interface Event {
201
227
  'kind' : string,
202
228
  'text' : string,
203
229
  }
230
+ /**
231
+ * The arguments of the method are the core's, Candid-encoded (`to_candid` in Motoko) —
232
+ * the coordinator does not read them and keeps no copy of the chat group's types.
233
+ */
234
+ export interface ForwardChatAdminArgs {
235
+ 'method' : ChatAdminMethod,
236
+ /**
237
+ * The one argument of the method, Candid-encoded.
238
+ */
239
+ 'args' : Uint8Array | number[],
240
+ /**
241
+ * The chat group's COORDINATOR (the core's chat config) — the group's address. The
242
+ * coordinator asks it where the chat core is.
243
+ */
244
+ 'chatCoordinator' : Principal,
245
+ }
204
246
  export interface GeohashesArgs { 'geohashes' : Array<string> }
205
247
  /**
206
248
  * DEPLOYED: fresh from the deploy, the deploy admins rule, no worker exists or is created.
@@ -464,30 +506,32 @@ export type Result = { 'Ok' : Array<Principal> } |
464
506
  { 'Err' : CoordinatorError };
465
507
  export type Result_1 = { 'Ok' : Roles } |
466
508
  { 'Err' : CoordinatorError };
467
- export type Result_10 = { 'Ok' : boolean } |
509
+ export type Result_10 = { 'Ok' : Array<WorkerLive> } |
468
510
  { 'Err' : CoordinatorError };
469
- export type Result_11 = { 'Ok' : Array<WorkerRecord> } |
511
+ export type Result_11 = { 'Ok' : boolean } |
470
512
  { 'Err' : CoordinatorError };
471
- export type Result_12 = { 'Ok' : CoreRecord } |
513
+ export type Result_12 = { 'Ok' : Array<WorkerRecord> } |
472
514
  { 'Err' : CoordinatorError };
473
- export type Result_13 = { 'Ok' : WorkerStatus } |
515
+ export type Result_13 = { 'Ok' : CoreRecord } |
474
516
  { 'Err' : CoordinatorError };
475
- export type Result_14 = { 'Ok' : Dependents } |
517
+ export type Result_14 = { 'Ok' : WorkerStatus } |
476
518
  { 'Err' : CoordinatorError };
477
- export type Result_15 = { 'Ok' : Config } |
519
+ export type Result_15 = { 'Ok' : Dependents } |
478
520
  { 'Err' : CoordinatorError };
479
- export type Result_16 = { 'Ok' : SetWorkerConfigResult } |
521
+ export type Result_16 = { 'Ok' : Config } |
480
522
  { 'Err' : CoordinatorError };
481
- export type Result_17 = { 'Ok' : WorkerView } |
523
+ export type Result_17 = { 'Ok' : SetWorkerConfigResult } |
482
524
  { 'Err' : CoordinatorError };
483
- export type Result_18 = { 'Ok' : SplitResult } |
525
+ export type Result_18 = { 'Ok' : WorkerView } |
484
526
  { 'Err' : CoordinatorError };
485
- export type Result_19 = { 'Ok' : bigint } |
527
+ export type Result_19 = { 'Ok' : SplitResult } |
486
528
  { 'Err' : CoordinatorError };
487
529
  export type Result_2 = { 'Ok' : Array<PrefixEntry> } |
488
530
  { 'Err' : CoordinatorError };
489
531
  export type Result_20 = { 'Ok' : bigint } |
490
532
  { 'Err' : CoordinatorError };
533
+ export type Result_21 = { 'Ok' : bigint } |
534
+ { 'Err' : CoordinatorError };
491
535
  export type Result_3 = { 'Ok' : WasmInfo } |
492
536
  { 'Err' : CoordinatorError };
493
537
  export type Result_4 = { 'Ok' : Principal } |
@@ -496,11 +540,11 @@ export type Result_5 = { 'Ok' : DeletedWorker } |
496
540
  { 'Err' : CoordinatorError };
497
541
  export type Result_6 = { 'Ok' : Array<string> } |
498
542
  { 'Err' : CoordinatorError };
499
- export type Result_7 = { 'Ok' : CoreLive } |
543
+ export type Result_7 = { 'Ok' : Uint8Array | number[] } |
500
544
  { 'Err' : CoordinatorError };
501
- export type Result_8 = { 'Ok' : Status } |
545
+ export type Result_8 = { 'Ok' : CoreLive } |
502
546
  { 'Err' : CoordinatorError };
503
- export type Result_9 = { 'Ok' : Array<WorkerLive> } |
547
+ export type Result_9 = { 'Ok' : Status } |
504
548
  { 'Err' : CoordinatorError };
505
549
  /**
506
550
  * Somebody asked for the superadmin role.
@@ -711,6 +755,13 @@ export interface WorkerView {
711
755
  'record' : WorkerRecord,
712
756
  }
713
757
  export interface _SERVICE {
758
+ /**
759
+ * KO-16: WHERE the accounts of a principal are — a place: `canister` (ask it `isUser`) or
760
+ * `coordinator` (a referral: ask that coordinator again). Asked by the chat core for a
761
+ * customer of the project whose accounts field names this coordinator. Today `canister` =
762
+ * the core of the group for every principal (null = no core yet). Never the answer itself.
763
+ */
764
+ 'accountsCanisterFor' : ActorMethod<[Principal], [] | [AccountsPlace]>,
714
765
  /**
715
766
  * An admin of the core, added by a superadmin through the coordinator.
716
767
  */
@@ -760,10 +811,19 @@ export interface _SERVICE {
760
811
  * emptied worker stays until a superadmin deletes it or opens it again.
761
812
  */
762
813
  'drainWorker' : ActorMethod<[DrainWorkerArgs], Result_6>,
814
+ /**
815
+ * KO-16: the core only — one admin call on the chat group, made by this coordinator, the
816
+ * admin of the project there. The core composes the argument (`to_candid`) and reads the
817
+ * answer (`from_candid`); the coordinator checks the method against its fixed list, finds
818
+ * the chat core through the chat coordinator, and answers with the chat core's reply as it
819
+ * came (`Ok`), whatever it says. `Err` = the chat group could not be reached: a rejected
820
+ * call forgets the chat core, asks the chat coordinator again and tries once more.
821
+ */
822
+ 'forwardChatAdmin' : ActorMethod<[ForwardChatAdminArgs], Result_7>,
763
823
  /**
764
824
  * What the core says of itself right now — one composite query for the front.
765
825
  */
766
- 'getCoreStatus' : ActorMethod<[], Result_7>,
826
+ 'getCoreStatus' : ActorMethod<[], Result_8>,
767
827
  /**
768
828
  * The core of the group.
769
829
  */
@@ -780,12 +840,12 @@ export interface _SERVICE {
780
840
  /**
781
841
  * Everything the superadmin front shows.
782
842
  */
783
- 'getStatus' : ActorMethod<[], Result_8>,
843
+ 'getStatus' : ActorMethod<[], Result_9>,
784
844
  /**
785
845
  * What every worker says of itself right now — one composite query, the workers' own
786
846
  * `getStatus` queries inside it. A worker that cannot be asked carries the reason instead.
787
847
  */
788
- 'getWorkersStatus' : ActorMethod<[], Result_9>,
848
+ 'getWorkersStatus' : ActorMethod<[], Result_10>,
789
849
  /**
790
850
  * The superadmin hands the role over to the one who asked.
791
851
  */
@@ -806,7 +866,7 @@ export interface _SERVICE {
806
866
  * ONE worker — its per-prefix counters grow, and it reports the level given to the
807
867
  * coordinator as a real minute would. What a local script uses to force a split.
808
868
  */
809
- 'injectWorkerTestLoad' : ActorMethod<[InjectTestLoadArgs], Result_10>,
869
+ 'injectWorkerTestLoad' : ActorMethod<[InjectTestLoadArgs], Result_11>,
810
870
  /**
811
871
  * Installs the core wasm on the core: a core without code, or — outside prod — a core
812
872
  * that has code (handed over at the install, or a reset). A fresh state, the same canister.
@@ -838,15 +898,15 @@ export interface _SERVICE {
838
898
  /**
839
899
  * A superadmin reads the query load of every installed worker now.
840
900
  */
841
- 'readQueryLoads' : ActorMethod<[], Result_11>,
901
+ 'readQueryLoads' : ActorMethod<[], Result_12>,
842
902
  /**
843
903
  * What the management canister says of the core: its balance and its module.
844
904
  */
845
- 'refreshCore' : ActorMethod<[], Result_12>,
905
+ 'refreshCore' : ActorMethod<[], Result_13>,
846
906
  /**
847
907
  * What a worker says of itself now. The coordinator keeps the memory and the cycles.
848
908
  */
849
- 'refreshWorker' : ActorMethod<[CanisterArgs], Result_13>,
909
+ 'refreshWorker' : ActorMethod<[CanisterArgs], Result_14>,
850
910
  'removeCoreAdmin' : ActorMethod<[PrincipalArgs], Result>,
851
911
  'removeDeployAdmin' : ActorMethod<[PrincipalArgs], Result_1>,
852
912
  /**
@@ -888,29 +948,29 @@ export interface _SERVICE {
888
948
  * map starts again: the first worker holds the world. One canister at a time; refused
889
949
  * while a split, a drain or an upgrade runs.
890
950
  */
891
- 'resetGroup' : ActorMethod<[], Result_14>,
951
+ 'resetGroup' : ActorMethod<[], Result_15>,
892
952
  /**
893
953
  * Changes what a superadmin may: `spread`, the cycles of a worker, the own reserve,
894
954
  * `maxWorkers`, the query thresholds. Only the fields given are changed.
895
955
  */
896
- 'setConfig' : ActorMethod<[SetConfigArgs], Result_15>,
897
- 'setCoreLoggingEnabled' : ActorMethod<[CoreLoggingArgs], Result_10>,
956
+ 'setConfig' : ActorMethod<[SetConfigArgs], Result_16>,
957
+ 'setCoreLoggingEnabled' : ActorMethod<[CoreLoggingArgs], Result_11>,
898
958
  /**
899
959
  * The config of the workers of the group: the load thresholds, logging. Only the fields
900
960
  * given are changed. The result is stored, given to every worker that has its code, and
901
961
  * to every worker created later.
902
962
  */
903
- 'setWorkerConfig' : ActorMethod<[WorkerConfigArgs], Result_16>,
963
+ 'setWorkerConfig' : ActorMethod<[WorkerConfigArgs], Result_17>,
904
964
  /**
905
965
  * Opens a worker to the prefixes of a split again, or closes it without giving anything
906
966
  * away.
907
967
  */
908
- 'setWorkerOpen' : ActorMethod<[SetWorkerOpenArgs], Result_17>,
968
+ 'setWorkerOpen' : ActorMethod<[SetWorkerOpenArgs], Result_18>,
909
969
  /**
910
970
  * A superadmin splits a worker now, whatever its load and `spread` (KO-17): a fresh worker
911
971
  * takes about half of its prefixes. Answers with the new worker and the prefixes it got.
912
972
  */
913
- 'splitWorker' : ActorMethod<[CanisterArgs], Result_18>,
973
+ 'splitWorker' : ActorMethod<[CanisterArgs], Result_19>,
914
974
  /**
915
975
  * A worker of the group sends its cycles here before it is deleted (`giveBackCycles`).
916
976
  * The workers only: somebody else's cycles are refused (they go back to the sender).
@@ -919,11 +979,11 @@ export interface _SERVICE {
919
979
  /**
920
980
  * Cycles for the core, by hand: `cyclesPerWorker`, like a worker's top-up.
921
981
  */
922
- 'topUpCore' : ActorMethod<[], Result_19>,
982
+ 'topUpCore' : ActorMethod<[], Result_20>,
923
983
  /**
924
984
  * Cycles for a worker, by hand.
925
985
  */
926
- 'topUpWorker' : ActorMethod<[CanisterArgs], Result_19>,
986
+ 'topUpWorker' : ActorMethod<[CanisterArgs], Result_20>,
927
987
  /**
928
988
  * KO-11: a new build of the core: stop → upgrade → start; its state stays (C-12).
929
989
  */
@@ -937,12 +997,12 @@ export interface _SERVICE {
937
997
  /**
938
998
  * The core wasm, in chunks like the worker's.
939
999
  */
940
- 'uploadCoreWasmChunk' : ActorMethod<[WasmChunkArgs], Result_20>,
1000
+ 'uploadCoreWasmChunk' : ActorMethod<[WasmChunkArgs], Result_21>,
941
1001
  /**
942
1002
  * One chunk of a NEW worker wasm. The first chunk (index 0) drops what was uploaded
943
1003
  * before; the module counts only after `commitWorkerWasm`.
944
1004
  */
945
- 'uploadWorkerWasmChunk' : ActorMethod<[WasmChunkArgs], Result_20>,
1005
+ 'uploadWorkerWasmChunk' : ActorMethod<[WasmChunkArgs], Result_21>,
946
1006
  /**
947
1007
  * KO-1, KO-2: the worker of the area a geohash lies in — the longest prefix of the map
948
1008
  * wins. None = no installed worker serves the area (no worker yet, or its worker is being