@ours.network/cowork 1.1.0 → 1.1.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/cli.js CHANGED
@@ -4289,6 +4289,41 @@ function lstatIfPresent(fs2, path) {
4289
4289
 
4290
4290
  // src/contracts.ts
4291
4291
  import { createHash } from "node:crypto";
4292
+
4293
+ // src/command-names.ts
4294
+ var SHARED_ROOM_COMMANDS = [
4295
+ "room.settings",
4296
+ "room.briefing.role.set",
4297
+ "room.briefing.role.delete",
4298
+ "room.invite",
4299
+ "room.accept",
4300
+ "room.rebind",
4301
+ "room.close",
4302
+ "room.delete",
4303
+ "room.participant.remove",
4304
+ "room.revoke",
4305
+ "room.recover",
4306
+ "room.recover.confirm",
4307
+ "room.show",
4308
+ "room.participants",
4309
+ "room.command.grants",
4310
+ "room.command.role.grants",
4311
+ "room.command.role.set",
4312
+ "room.command.grant",
4313
+ "room.command.revoke",
4314
+ "room.history",
4315
+ "room.message",
4316
+ "room.say",
4317
+ "room.role.rest.add",
4318
+ "room.role.rest.remove"
4319
+ ];
4320
+ var RUNTIME_COMMAND_NAMES = [
4321
+ "list-members",
4322
+ "remove-member",
4323
+ ...SHARED_ROOM_COMMANDS
4324
+ ];
4325
+
4326
+ // src/contracts.ts
4292
4327
  var MAX_TEXT_BYTES = 262144;
4293
4328
  var MAX_FILE_BYTES = 2 * 1024 * 1024;
4294
4329
  var MAX_HISTORY_PAGE_BYTES = 3 * 1024 * 1024;
@@ -4312,7 +4347,7 @@ var LowerCrockfordUlidSchema = external_exports.string().regex(
4312
4347
  "must be a 26-character lowercase Crockford ULID"
4313
4348
  );
4314
4349
  var ContainerIdSchema = external_exports.string().regex(/^[0-9a-f]{64}$/i, "must be a 64-character hexadecimal CID").transform((value) => value.toUpperCase());
4315
- var RuntimeCommandNameSchema = external_exports.enum(["list-members", "remove-member"]);
4350
+ var RuntimeCommandNameSchema = external_exports.enum(RUNTIME_COMMAND_NAMES);
4316
4351
  var RuntimeCommandGrantSchema = external_exports.object({
4317
4352
  caller_cid: ContainerIdSchema,
4318
4353
  command: RuntimeCommandNameSchema
@@ -4654,6 +4689,14 @@ var CurrentRoomSchema = external_exports.object({
4654
4689
  }),
4655
4690
  /** Operator-managed, default-deny grants for the room identity's runtime commands. */
4656
4691
  command_grants: external_exports.array(RuntimeCommandGrantSchema),
4692
+ lifecycle_request: external_exports.object({
4693
+ request_id: external_exports.string().min(1).max(256),
4694
+ command: external_exports.enum(["room.close", "room.delete"]),
4695
+ caller_cid: ContainerIdSchema,
4696
+ accepted_at: Rfc3339Schema,
4697
+ state: external_exports.enum(["pending", "failed", "completed"]),
4698
+ error: external_exports.literal("lifecycle_failed").optional()
4699
+ }).strict().optional(),
4657
4700
  /** Operator-managed command policy inherited by authenticated active seats of an exact role. */
4658
4701
  role_command_grants: external_exports.array(RuntimeRoleCommandGrantSchema).superRefine((grants, context) => {
4659
4702
  const seen = /* @__PURE__ */ new Set();
@@ -5155,9 +5198,9 @@ Room commands:
5155
5198
  participants <room-id>
5156
5199
  command-grants <room-id>
5157
5200
  role-command-grants <room-id>
5158
- role-command-set <room-id> --role <label> --commands <list-members,remove-member|none>
5159
- command-grant <room-id> <caller-cid> <list-members|remove-member>
5160
- command-revoke <room-id> <caller-cid> <list-members|remove-member>
5201
+ role-command-set <room-id> --role <label> --commands <command,...|none>
5202
+ command-grant <room-id> <caller-cid> <command>
5203
+ command-revoke <room-id> <caller-cid> <command>
5161
5204
  history <room-id> [--after <seq>] [--limit <n>] [--view operator|participant]
5162
5205
  message <room-id> --text <text>
5163
5206
  say <room-id> --role <label> --text <text>
@@ -5353,8 +5396,8 @@ async function roomRequest(command, args) {
5353
5396
  const role = requiredFlag(parsed, "--role", "room role-command-set");
5354
5397
  const value = requiredFlag(parsed, "--commands", "room role-command-set");
5355
5398
  const commands = value === "none" ? [] : value.split(",");
5356
- if (new Set(commands).size !== commands.length || commands.some((item) => item !== "list-members" && item !== "remove-member")) {
5357
- usageError("--commands must be a unique comma-separated subset of list-members,remove-member or none");
5399
+ if (new Set(commands).size !== commands.length || commands.some((item) => !RuntimeCommandNameSchema.safeParse(item).success)) {
5400
+ usageError("--commands must be a unique comma-separated list of built-in command names or none");
5358
5401
  }
5359
5402
  return { method: "room.command.role.set", params: { room_id: roomId, role, commands } };
5360
5403
  }
@@ -5365,8 +5408,8 @@ async function roomRequest(command, args) {
5365
5408
  3,
5366
5409
  `room ${command}`
5367
5410
  );
5368
- if (runtimeCommand !== "list-members" && runtimeCommand !== "remove-member") {
5369
- usageError("runtime command must be list-members or remove-member");
5411
+ if (!RuntimeCommandNameSchema.safeParse(runtimeCommand).success) {
5412
+ usageError("runtime command must be a supported built-in command name");
5370
5413
  }
5371
5414
  return {
5372
5415
  method: command === "command-grant" ? "room.command.grant" : "room.command.revoke",