@ours.network/cowork 0.3.1 → 0.3.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/README.md +3 -1
- package/dist/cli.js +35 -6
- package/dist/daemon.js +39 -2
- package/dist/mufl_code/BBAE58CF78DEE59692F456EAFFA9A6109835B66846FC3989F6D201B8F4523A55.muflo +0 -0
- package/dist/web/assets/app.js +8 -8
- package/docs/05-room-workflow.md +3 -3
- package/docs/11-web-console.md +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,9 @@ ours-cowork web
|
|
|
7
7
|
ours-cowork docs
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
`ours-cowork web` starts the daemon if it is absent, waits for the console, and opens `http://127.0.0.1:3052/`. Create a room first, then add each invitation requirement from its Invite panel. The Communication view contains the human-readable room chat; operational records remain in Events and the complete ordered stream remains in Archive.
|
|
10
|
+
`ours-cowork web` starts the daemon if it is absent, waits for the console, and opens `http://127.0.0.1:3052/`. Create a room with a friendly display name first, then add each invitation requirement from its Invite panel. Names are trimmed, normalized to Unicode NFC, and may contain 1–64 Unicode characters excluding control and format characters. Duplicate names are allowed. The Communication view contains the human-readable room chat; operational records remain in Events and the complete ordered stream remains in Archive.
|
|
11
|
+
|
|
12
|
+
The friendly `room_name` is presentation metadata. The opaque `room_id` remains the stable key for routing, URLs, storage, and identity correlation, and the underlying technical room identity is never renamed. Rooms created before friendly names existed migrate deterministically to `Room <first 8 room_id characters>`.
|
|
11
13
|
|
|
12
14
|
The localhost HTTP console has no authentication. Keep it bound to `127.0.0.1`; do not proxy, forward, or expose the port to other hosts. Room state is refreshed by periodic polling, not pushed to the browser.
|
|
13
15
|
|
package/dist/cli.js
CHANGED
|
@@ -4280,6 +4280,7 @@ var MAX_MANAGEMENT_RESPONSE_BYTES = MAX_HISTORY_PAGE_BYTES + 1024 * 1024;
|
|
|
4280
4280
|
var MAX_FILE_NAME_BYTES = 255;
|
|
4281
4281
|
var MAX_MIME_BYTES = 255;
|
|
4282
4282
|
var MAX_ROLE_BYTES = 256;
|
|
4283
|
+
var MAX_ROOM_NAME_CHARACTERS = 64;
|
|
4283
4284
|
function utf8Bounded(label, maximumBytes) {
|
|
4284
4285
|
return external_exports.string().refine((value) => Buffer.byteLength(value, "utf8") >= 1, `${label} must be at least 1 UTF-8 byte`).refine(
|
|
4285
4286
|
(value) => Buffer.byteLength(value, "utf8") <= maximumBytes,
|
|
@@ -4311,6 +4312,21 @@ function isStrictRfc3339(value) {
|
|
|
4311
4312
|
return day >= 1 && day <= days[month - 1];
|
|
4312
4313
|
}
|
|
4313
4314
|
var Rfc3339Schema = external_exports.string().refine(isStrictRfc3339, "must be a valid RFC3339 timestamp");
|
|
4315
|
+
function normalizeRoomName(value) {
|
|
4316
|
+
return value.trim().normalize("NFC");
|
|
4317
|
+
}
|
|
4318
|
+
var RoomNameSchema = external_exports.string().refine(
|
|
4319
|
+
(value) => !/[\p{Cc}\p{Cf}]/u.test(value),
|
|
4320
|
+
"room name must not contain Unicode control or format characters"
|
|
4321
|
+
).transform(normalizeRoomName).superRefine((value, context) => {
|
|
4322
|
+
const length = Array.from(value).length;
|
|
4323
|
+
if (length < 1 || length > MAX_ROOM_NAME_CHARACTERS) {
|
|
4324
|
+
context.addIssue({
|
|
4325
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4326
|
+
message: `room name must contain 1-${MAX_ROOM_NAME_CHARACTERS} Unicode characters after normalization`
|
|
4327
|
+
});
|
|
4328
|
+
}
|
|
4329
|
+
});
|
|
4314
4330
|
var RoleSchema = utf8Bounded("role", MAX_ROLE_BYTES);
|
|
4315
4331
|
var MissionTextSchema = utf8Bounded("mission text", MAX_TEXT_BYTES);
|
|
4316
4332
|
var MessageTextSchema = utf8Bounded("message text", MAX_TEXT_BYTES);
|
|
@@ -4520,8 +4536,9 @@ var RoomV1Schema = external_exports.object({
|
|
|
4520
4536
|
mission: MissionV1Schema,
|
|
4521
4537
|
seats: external_exports.array(SeatV1Schema)
|
|
4522
4538
|
}).strict().superRefine(refineRoomLineage);
|
|
4523
|
-
var
|
|
4539
|
+
var CurrentRoomSchema = external_exports.object({
|
|
4524
4540
|
...RoomCommonShape,
|
|
4541
|
+
room_name: RoomNameSchema,
|
|
4525
4542
|
version: external_exports.literal(2),
|
|
4526
4543
|
mission: MissionSchema,
|
|
4527
4544
|
role_briefings: external_exports.record(RoleSchema, RoleBriefingSchema),
|
|
@@ -4601,13 +4618,24 @@ var RoomSchema = external_exports.object({
|
|
|
4601
4618
|
}
|
|
4602
4619
|
}
|
|
4603
4620
|
});
|
|
4621
|
+
function defaultRoomName(roomId) {
|
|
4622
|
+
return `Room ${LowerCrockfordUlidSchema.parse(roomId).slice(0, 8)}`;
|
|
4623
|
+
}
|
|
4624
|
+
var RoomSchema = external_exports.preprocess((value) => {
|
|
4625
|
+
if (typeof value !== "object" || value === null || Object.hasOwn(value, "room_name")) return value;
|
|
4626
|
+
const roomId = value.room_id;
|
|
4627
|
+
if (typeof roomId !== "string" || !LowerCrockfordUlidSchema.safeParse(roomId).success) return value;
|
|
4628
|
+
return { ...value, room_name: defaultRoomName(roomId) };
|
|
4629
|
+
}, CurrentRoomSchema);
|
|
4604
4630
|
var CreateRoomInputSchema = external_exports.object({
|
|
4631
|
+
name: RoomNameSchema.optional(),
|
|
4605
4632
|
goal: MissionTextSchema,
|
|
4606
4633
|
briefing: MissionTextSchema,
|
|
4607
4634
|
anonymous: external_exports.boolean().optional(),
|
|
4608
4635
|
quiet_membership: external_exports.boolean().optional()
|
|
4609
4636
|
}).strict();
|
|
4610
4637
|
var UpdateRoomInputSchema = external_exports.object({
|
|
4638
|
+
name: RoomNameSchema.optional(),
|
|
4611
4639
|
goal: MissionTextSchema.optional(),
|
|
4612
4640
|
briefing: MissionTextSchema.optional(),
|
|
4613
4641
|
status: NonEmptyStringSchema.optional(),
|
|
@@ -4935,8 +4963,8 @@ Usage:
|
|
|
4935
4963
|
ours-cowork [--json] docs [topic]
|
|
4936
4964
|
|
|
4937
4965
|
Room commands:
|
|
4938
|
-
create --goal <text> --briefing <text> [--anonymous] [--quiet-membership]
|
|
4939
|
-
settings <room-id> [--goal <text>] [--briefing <text>] [--status <text>] [--quiet-membership true|false]
|
|
4966
|
+
create [--name <display-name>] --goal <text> --briefing <text> [--anonymous] [--quiet-membership]
|
|
4967
|
+
settings <room-id> [--name <display-name>] [--goal <text>] [--briefing <text>] [--status <text>] [--quiet-membership true|false]
|
|
4940
4968
|
role-briefing <room-id> --role <label> (--text <text> | --delete)
|
|
4941
4969
|
invite <room-id> [--role <label>] [--mode one_time|public] [--min-accepts <n>]
|
|
4942
4970
|
revoke <room-id> <invite-id>
|
|
@@ -5025,9 +5053,10 @@ function roomRequest(command, args) {
|
|
|
5025
5053
|
if (!command) usageError("room requires a command");
|
|
5026
5054
|
switch (command) {
|
|
5027
5055
|
case "create": {
|
|
5028
|
-
const parsed = parseOptions(args, ["--goal", "--briefing"], ["--anonymous", "--quiet-membership"]);
|
|
5056
|
+
const parsed = parseOptions(args, ["--name", "--goal", "--briefing"], ["--anonymous", "--quiet-membership"]);
|
|
5029
5057
|
exactPositionals(parsed, 0, "room create");
|
|
5030
5058
|
return { method: "room.create", params: {
|
|
5059
|
+
...parsed.values["--name"] === void 0 ? {} : { name: parsed.values["--name"] },
|
|
5031
5060
|
goal: requiredFlag(parsed, "--goal", "room create"),
|
|
5032
5061
|
briefing: requiredFlag(parsed, "--briefing", "room create"),
|
|
5033
5062
|
...parsed.booleans.has("--anonymous") ? { anonymous: true } : {},
|
|
@@ -5035,10 +5064,10 @@ function roomRequest(command, args) {
|
|
|
5035
5064
|
} };
|
|
5036
5065
|
}
|
|
5037
5066
|
case "settings": {
|
|
5038
|
-
const parsed = parseOptions(args, ["--goal", "--briefing", "--status", "--quiet-membership"]);
|
|
5067
|
+
const parsed = parseOptions(args, ["--name", "--goal", "--briefing", "--status", "--quiet-membership"]);
|
|
5039
5068
|
const [roomId] = exactPositionals(parsed, 1, "room settings");
|
|
5040
5069
|
const params = { room_id: roomId };
|
|
5041
|
-
for (const [flag, key] of [["--goal", "goal"], ["--briefing", "briefing"], ["--status", "status"]]) {
|
|
5070
|
+
for (const [flag, key] of [["--name", "name"], ["--goal", "goal"], ["--briefing", "briefing"], ["--status", "status"]]) {
|
|
5042
5071
|
if (parsed.values[flag] !== void 0) params[key] = parsed.values[flag];
|
|
5043
5072
|
}
|
|
5044
5073
|
const quiet = parsed.values["--quiet-membership"];
|
package/dist/daemon.js
CHANGED
|
@@ -4793,6 +4793,9 @@ function isStrictRfc3339(value) {
|
|
|
4793
4793
|
const days = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4794
4794
|
return day >= 1 && day <= days[month - 1];
|
|
4795
4795
|
}
|
|
4796
|
+
function normalizeRoomName(value) {
|
|
4797
|
+
return value.trim().normalize("NFC");
|
|
4798
|
+
}
|
|
4796
4799
|
function refineRoomLineage(room, context) {
|
|
4797
4800
|
const pendingIdentityName = `cowork-room-${room.room_id}`;
|
|
4798
4801
|
const exactPacketPending = room.state === "provisioning" && room.status === "packet_pending" && room.identity_name === pendingIdentityName && room.invites.length === 0 && room.seats.length === 0 && room.activated_at === void 0 && room.closed_at === void 0;
|
|
@@ -4842,6 +4845,9 @@ function refineRoomLineage(room, context) {
|
|
|
4842
4845
|
}
|
|
4843
4846
|
}
|
|
4844
4847
|
}
|
|
4848
|
+
function defaultRoomName(roomId) {
|
|
4849
|
+
return `Room ${LowerCrockfordUlidSchema.parse(roomId).slice(0, 8)}`;
|
|
4850
|
+
}
|
|
4845
4851
|
function migrateRoomV1(room, mintParticipantId) {
|
|
4846
4852
|
return RoomSchema.parse({
|
|
4847
4853
|
...room,
|
|
@@ -4918,7 +4924,7 @@ function refineMessageCategory(message, context) {
|
|
|
4918
4924
|
}
|
|
4919
4925
|
}
|
|
4920
4926
|
}
|
|
4921
|
-
var MAX_TEXT_BYTES, MAX_FILE_BYTES, MAX_HISTORY_PAGE_BYTES, MAX_MANAGEMENT_RESPONSE_BYTES, MAX_FILE_NAME_BYTES, MAX_MIME_BYTES, MAX_ROLE_BYTES, NonEmptyStringSchema, PositiveSafeIntegerSchema, LowerCrockfordUlidSchema, Rfc3339Schema, RoleSchema, MissionTextSchema, MessageTextSchema, FileNameSchema, FileMimeSchema, RoomStateSchema, SeatStateSchema, InviteModeSchema, DEFAULT_ROLE, InviteStateSchema, RelayStatusSchema, SeatV1Schema, SeatSchema, RoomInviteSchema, MissionV1Schema, MissionSchema, RoleBriefingSchema, RoomCommonShape, RoomV1Schema, RoomSchema, CreateRoomInputSchema, UpdateRoomInputSchema, RoleBriefingSetInputSchema, RoleBriefingDeleteInputSchema, PostMessageInputSchema, AuthorSnapshotSchema, RecordCommonShape, AppendCommonShape, MembershipNoticeSchema, AuthorAliasSchema, MessageShape, RelayIntentShape, RelayResultStatusSchema, RelayResultShape, FileShape, MembershipIntentShape, MembershipResultShape, CloseNoticeIntentShape, CloseNoticeResultShape, MessageRecordSchema, FileRecordSchema, RelayIntentRecordSchema, RelayResultRecordSchema, MembershipIntentRecordSchema, MembershipResultRecordSchema, CloseNoticeIntentRecordSchema, CloseNoticeResultRecordSchema, RawCommunicationRecordSchema, CommunicationRecordSchema, AppendRecordSchema;
|
|
4927
|
+
var MAX_TEXT_BYTES, MAX_FILE_BYTES, MAX_HISTORY_PAGE_BYTES, MAX_MANAGEMENT_RESPONSE_BYTES, MAX_FILE_NAME_BYTES, MAX_MIME_BYTES, MAX_ROLE_BYTES, MAX_ROOM_NAME_CHARACTERS, NonEmptyStringSchema, PositiveSafeIntegerSchema, LowerCrockfordUlidSchema, Rfc3339Schema, RoomNameSchema, RoleSchema, MissionTextSchema, MessageTextSchema, FileNameSchema, FileMimeSchema, RoomStateSchema, SeatStateSchema, InviteModeSchema, DEFAULT_ROLE, InviteStateSchema, RelayStatusSchema, SeatV1Schema, SeatSchema, RoomInviteSchema, MissionV1Schema, MissionSchema, RoleBriefingSchema, RoomCommonShape, RoomV1Schema, CurrentRoomSchema, RoomSchema, CreateRoomInputSchema, UpdateRoomInputSchema, RoleBriefingSetInputSchema, RoleBriefingDeleteInputSchema, PostMessageInputSchema, AuthorSnapshotSchema, RecordCommonShape, AppendCommonShape, MembershipNoticeSchema, AuthorAliasSchema, MessageShape, RelayIntentShape, RelayResultStatusSchema, RelayResultShape, FileShape, MembershipIntentShape, MembershipResultShape, CloseNoticeIntentShape, CloseNoticeResultShape, MessageRecordSchema, FileRecordSchema, RelayIntentRecordSchema, RelayResultRecordSchema, MembershipIntentRecordSchema, MembershipResultRecordSchema, CloseNoticeIntentRecordSchema, CloseNoticeResultRecordSchema, RawCommunicationRecordSchema, CommunicationRecordSchema, AppendRecordSchema;
|
|
4922
4928
|
var init_contracts = __esm({
|
|
4923
4929
|
"src/contracts.ts"() {
|
|
4924
4930
|
"use strict";
|
|
@@ -4930,6 +4936,7 @@ var init_contracts = __esm({
|
|
|
4930
4936
|
MAX_FILE_NAME_BYTES = 255;
|
|
4931
4937
|
MAX_MIME_BYTES = 255;
|
|
4932
4938
|
MAX_ROLE_BYTES = 256;
|
|
4939
|
+
MAX_ROOM_NAME_CHARACTERS = 64;
|
|
4933
4940
|
NonEmptyStringSchema = external_exports.string().min(1);
|
|
4934
4941
|
PositiveSafeIntegerSchema = external_exports.number().int().positive().safe();
|
|
4935
4942
|
LowerCrockfordUlidSchema = external_exports.string().regex(
|
|
@@ -4937,6 +4944,18 @@ var init_contracts = __esm({
|
|
|
4937
4944
|
"must be a 26-character lowercase Crockford ULID"
|
|
4938
4945
|
);
|
|
4939
4946
|
Rfc3339Schema = external_exports.string().refine(isStrictRfc3339, "must be a valid RFC3339 timestamp");
|
|
4947
|
+
RoomNameSchema = external_exports.string().refine(
|
|
4948
|
+
(value) => !/[\p{Cc}\p{Cf}]/u.test(value),
|
|
4949
|
+
"room name must not contain Unicode control or format characters"
|
|
4950
|
+
).transform(normalizeRoomName).superRefine((value, context) => {
|
|
4951
|
+
const length = Array.from(value).length;
|
|
4952
|
+
if (length < 1 || length > MAX_ROOM_NAME_CHARACTERS) {
|
|
4953
|
+
context.addIssue({
|
|
4954
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4955
|
+
message: `room name must contain 1-${MAX_ROOM_NAME_CHARACTERS} Unicode characters after normalization`
|
|
4956
|
+
});
|
|
4957
|
+
}
|
|
4958
|
+
});
|
|
4940
4959
|
RoleSchema = utf8Bounded("role", MAX_ROLE_BYTES);
|
|
4941
4960
|
MissionTextSchema = utf8Bounded("mission text", MAX_TEXT_BYTES);
|
|
4942
4961
|
MessageTextSchema = utf8Bounded("message text", MAX_TEXT_BYTES);
|
|
@@ -5098,8 +5117,9 @@ var init_contracts = __esm({
|
|
|
5098
5117
|
mission: MissionV1Schema,
|
|
5099
5118
|
seats: external_exports.array(SeatV1Schema)
|
|
5100
5119
|
}).strict().superRefine(refineRoomLineage);
|
|
5101
|
-
|
|
5120
|
+
CurrentRoomSchema = external_exports.object({
|
|
5102
5121
|
...RoomCommonShape,
|
|
5122
|
+
room_name: RoomNameSchema,
|
|
5103
5123
|
version: external_exports.literal(2),
|
|
5104
5124
|
mission: MissionSchema,
|
|
5105
5125
|
role_briefings: external_exports.record(RoleSchema, RoleBriefingSchema),
|
|
@@ -5179,13 +5199,21 @@ var init_contracts = __esm({
|
|
|
5179
5199
|
}
|
|
5180
5200
|
}
|
|
5181
5201
|
});
|
|
5202
|
+
RoomSchema = external_exports.preprocess((value) => {
|
|
5203
|
+
if (typeof value !== "object" || value === null || Object.hasOwn(value, "room_name")) return value;
|
|
5204
|
+
const roomId = value.room_id;
|
|
5205
|
+
if (typeof roomId !== "string" || !LowerCrockfordUlidSchema.safeParse(roomId).success) return value;
|
|
5206
|
+
return { ...value, room_name: defaultRoomName(roomId) };
|
|
5207
|
+
}, CurrentRoomSchema);
|
|
5182
5208
|
CreateRoomInputSchema = external_exports.object({
|
|
5209
|
+
name: RoomNameSchema.optional(),
|
|
5183
5210
|
goal: MissionTextSchema,
|
|
5184
5211
|
briefing: MissionTextSchema,
|
|
5185
5212
|
anonymous: external_exports.boolean().optional(),
|
|
5186
5213
|
quiet_membership: external_exports.boolean().optional()
|
|
5187
5214
|
}).strict();
|
|
5188
5215
|
UpdateRoomInputSchema = external_exports.object({
|
|
5216
|
+
name: RoomNameSchema.optional(),
|
|
5189
5217
|
goal: MissionTextSchema.optional(),
|
|
5190
5218
|
briefing: MissionTextSchema.optional(),
|
|
5191
5219
|
status: NonEmptyStringSchema.optional(),
|
|
@@ -6707,6 +6735,7 @@ var init_service = __esm({
|
|
|
6707
6735
|
const provisional = RoomSchema.parse({
|
|
6708
6736
|
version: 2,
|
|
6709
6737
|
room_id: roomId,
|
|
6738
|
+
room_name: settings.name ?? defaultRoomName(roomId),
|
|
6710
6739
|
identity_name: identityName,
|
|
6711
6740
|
// PacketRegistry needs the durable room directory to exist first. A
|
|
6712
6741
|
// valid, explicitly provisional value lets startup resume this exact
|
|
@@ -6818,6 +6847,7 @@ var init_service = __esm({
|
|
|
6818
6847
|
};
|
|
6819
6848
|
const next = await this.store.save(RoomSchema.parse({
|
|
6820
6849
|
...room,
|
|
6850
|
+
room_name: settings.name ?? room.room_name,
|
|
6821
6851
|
mission,
|
|
6822
6852
|
...settings.quiet_membership === void 0 ? {} : { quiet_membership: settings.quiet_membership },
|
|
6823
6853
|
...settings.status === void 0 ? {} : { status: settings.status }
|
|
@@ -7987,12 +8017,18 @@ var init_storage = __esm({
|
|
|
7987
8017
|
throw this.wrap(`malformed metadata for room "${roomId}"`, error);
|
|
7988
8018
|
}
|
|
7989
8019
|
const room = this.isVersion1(decoded) ? this.migrateUnlocked(roomId, decoded, bytes) : RoomSchema.parse(decoded);
|
|
8020
|
+
if (!this.isVersion1(decoded) && this.persistedRoomName(decoded) !== room.room_name) {
|
|
8021
|
+
this.atomicMetadataWrite(this.metadataPath(roomId), room);
|
|
8022
|
+
}
|
|
7990
8023
|
if (room.room_id !== roomId) throw new CoworkStorageError(`metadata room_id does not match room "${roomId}"`);
|
|
7991
8024
|
return room;
|
|
7992
8025
|
}
|
|
7993
8026
|
isVersion1(decoded) {
|
|
7994
8027
|
return typeof decoded === "object" && decoded !== null && decoded.version === 1;
|
|
7995
8028
|
}
|
|
8029
|
+
persistedRoomName(decoded) {
|
|
8030
|
+
return typeof decoded === "object" && decoded !== null ? decoded.room_name : void 0;
|
|
8031
|
+
}
|
|
7996
8032
|
/**
|
|
7997
8033
|
* Lazy additive v1 → v2 migration (spec §7): preserve the exact pre-migration
|
|
7998
8034
|
* bytes once as room.json.v1.bak, then atomically persist the v2 metadata.
|
|
@@ -8501,6 +8537,7 @@ function createServiceRoutes(service) {
|
|
|
8501
8537
|
"room.settings": { auth: true, run: (params) => {
|
|
8502
8538
|
const { room_id, ...input } = external_exports.object({
|
|
8503
8539
|
room_id: external_exports.string(),
|
|
8540
|
+
name: external_exports.unknown().optional(),
|
|
8504
8541
|
goal: external_exports.unknown().optional(),
|
|
8505
8542
|
briefing: external_exports.unknown().optional(),
|
|
8506
8543
|
status: external_exports.unknown().optional(),
|