zooid 0.7.1 → 0.7.2

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/dist/bin.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  SpawnRegistry,
6
6
  buildAcpRegistry,
7
7
  createMatrixTransport,
8
+ ensureDefaultChannel,
8
9
  ensureWorkforceSpace,
9
10
  findConfigFile,
10
11
  findHttpTransport,
@@ -14,7 +15,7 @@ import {
14
15
  renderRegistration,
15
16
  startDaemonSocketServer,
16
17
  startWorkforcePublisher
17
- } from "./chunk-SUPTPSN3.js";
18
+ } from "./chunk-O6E4CDTV.js";
18
19
 
19
20
  // src/bin.ts
20
21
  import { resolve as resolve5 } from "path";
@@ -557,12 +558,13 @@ async function startDaemon(opts = {}) {
557
558
  hsToken: matrix.transport.hs_token,
558
559
  adminUserId: opts.adminUserId
559
560
  });
560
- const requestedPort = matrix.transport.port ?? 8080;
561
+ const requestedPort = matrix.transport.port ?? 9e3;
561
562
  server = serve({ fetch: transport.app.fetch, port: requestedPort, hostname: "0.0.0.0" });
562
563
  port = await listenAsync(server);
563
564
  const serverName = matrix.transport.user_namespace.split(":").slice(1).join(":").replace(/\\?\)?$/, "") || new URL(matrix.transport.homeserver).hostname;
564
565
  const asUserId = `@${matrix.transport.sender_localpart}:${serverName}`;
565
566
  const spaceLocalpart = matrix.transport.space ?? "dev";
567
+ const adminUserIds = opts.adminUserId ? [opts.adminUserId] : [];
566
568
  let spaceRoomId;
567
569
  try {
568
570
  spaceRoomId = await ensureWorkforceSpace({
@@ -570,14 +572,27 @@ async function startDaemon(opts = {}) {
570
572
  asUserId,
571
573
  serverName,
572
574
  spaceLocalpart,
573
- preset: "public_chat"
575
+ preset: "public_chat",
576
+ admins: adminUserIds
574
577
  });
575
578
  console.log(`[matrix] ensured workforce space #${spaceLocalpart}:${serverName} \u2192 ${spaceRoomId}`);
576
579
  } catch (err) {
577
580
  console.warn("[matrix] workforce space provisioning failed:", err);
578
581
  }
579
- await transport.bootstrap({ spaceRoomId, asUserId });
582
+ await transport.bootstrap({ spaceRoomId, asUserId, adminUserIds });
580
583
  if (spaceRoomId) {
584
+ try {
585
+ const generalRoomId = await ensureDefaultChannel({
586
+ client,
587
+ asUserId,
588
+ serverName,
589
+ spaceId: spaceRoomId,
590
+ admins: adminUserIds
591
+ });
592
+ console.log(`[matrix] ensured default channel #general:${serverName} \u2192 ${generalRoomId}`);
593
+ } catch (err) {
594
+ console.warn("[matrix] default channel provisioning failed:", err);
595
+ }
581
596
  try {
582
597
  const publisher = await startWorkforcePublisher({
583
598
  client,