Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/cli/lib/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,15 @@ export async function execute(args: string[], rt: Runtime): Promise<unknown> {
}
if (isGuest) {
const prefix = "/api/guest-channels";
if (orgCommand === "list") return call(options["--after"] ? "?after=" + encodeURIComponent(options["--after"]) : "", {}, prefix);
if (orgCommand === "list") {
const query = new URLSearchParams();
if (options["--after"]) query.set("after", options["--after"]);
if (options["--org"]) {
if (!/^org_[A-Za-z0-9]+$/.test(options["--org"])) throw new ClientError("INVALID_ORGANIZATION");
query.set("organizationId", options["--org"]);
}
return call(query.size ? "?" + query : "", {}, prefix);
}
const id = options["--id"];
if (!id || !/^ch_[a-f0-9]{64}$/.test(id)) throw new ClientError("INVALID_CHANNEL");
if (orgCommand === "show") return call("/" + id, {}, prefix);
Expand Down
7 changes: 6 additions & 1 deletion apps/service/src/guests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,16 @@ export const guestChannels = new Hono<{ Bindings: Env }>()
.use("*", limit)
.get("/", async c => {
const identity = await admit(c.req.header("Authorization"), c.env);
const organizationId = c.req.query("organizationId");
if (organizationId !== undefined && !/^org_[A-Za-z0-9]+$/.test(organizationId)) throw new AccessError("INVALID_ORGANIZATION", 400);
const rows = await drizzle(c.env.INSTANCE_DB).select().from(channelInvitationDirectory).where(and(eq(channelInvitationDirectory.acceptedUserId, identity.userId), gt(channelInvitationDirectory.invitationId, cursor(c.req.query("after"))))).orderBy(asc(channelInvitationDirectory.invitationId)).limit(51).all();
const channels = [];
for (const row of rows.slice(0, 50)) {
const view = await c.env.CHANNELS.getByName(row.channelId).guestView(row.channelId, identity.userId);
if (view?.invitationId === row.invitationId && await localOrg(c.env, view.organizationId)) channels.push(view);
if (view?.invitationId === row.invitationId && (!organizationId || view.organizationId === organizationId) && await localOrg(c.env, view.organizationId)) {
const org = await c.env.ORGS.getByName(view.organizationId).read(view.organizationId);
channels.push({ ...view, organizationName: org.name });
}
}
return c.json({ channels, nextCursor: rows.length > 50 ? rows[49].invitationId : null });
})
Expand Down
8 changes: 8 additions & 0 deletions docs/channel-guests.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ The linked PR evidence records intermediate runtime provenance and first failure
## Confirmed invitation scope

The Human clarified that a channel-level invitation admits its recipient only to that channel. It does not grant organization membership, organization directory access or access to other channels. “Invite group channel” is not a group-to-group bridge or federation requirement. Existing organization members still see all organization channels; the guest grant is the only additional scope needed for this slice.

## Workspace directory projection

`GET /api/guest-channels` now includes `organizationName` on each currently authorized channel. The service checks the current Channel DO grant and local organization before reading its name from Org DO. It never enumerates other organizations or adds WorkOS membership. `?organizationId=org_…` optionally narrows the same authorized projection; malformed IDs return 400 and unrelated organizations return no channels.

`node apps/cli/tob.mjs guest-channel list --server "$TOB_SERVER" --org "$TOB_ORG"` exposes the same filter. `--after` remains supported. Cursors advance through the recipient directory, so an empty page can still have a next cursor; clients must offer continuation until it is null. Revoked grants disappear on the next listing. No schema migration is needed.

Source verification: 62 Worker tests and 20 CLI tests pass, covering authorized metadata, filter, unrelated user/org and revocation. UAT runtime `bf6d896e813457382cd2bb2e7c74b22c03ba01ca` was deployed and read back; [formal CLI evidence](evidence/2026-10-18-workspace-directory-uat.json) verifies the authorized organization name, filter, unrelated-org empty result, absent org membership, sibling denial and revoked-channel removal. Only this run's synthetic invitation was revoked; existing CLI sessions were preserved. Mobile native drawer acceptance remains pending.
11 changes: 11 additions & 0 deletions docs/evidence/2026-10-18-workspace-directory-uat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"at": "2026-10-18T06:22:15.204Z",
"releaseSha": "bf6d896e813457382cd2bb2e7c74b22c03ba01ca",
"authorizedOrganizationName": true,
"organizationFilter": true,
"unrelatedOrganizationEmpty": true,
"noOrganizationMembership": true,
"siblingDenied": true,
"revokedChannelRemoved": true,
"ownTestGrantRevoked": true
}
17 changes: 17 additions & 0 deletions docs/multi-user-collaboration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ This supersedes the admin-only application admission restriction in T1. The prot

The Human confirmed that "group channel invitation" means inviting a recipient only to the selected channel. Acceptance must not create organization membership or reveal sibling channels. This is the existing direct-channel guest scope, not federation or a group-to-group bridge.

## Current acceptance map — 2026-10-18

This table separates recorded slice evidence from remaining work; it is not a fresh rerun of every historical UAT check. The overall goal remains open.

| Required behavior | Recorded evidence | Remaining boundary |
| --- | --- | --- |
| Ordinary user gets a default workspace; multiple workspaces | Ordinary-user continuation below; mobile #2131 and independent CLI | Full T1 identity-event and interrupted-deployment recovery gates remain separate |
| Owner creates multiple channels; organization members see them | Channel HTTP slice below; mobile #2138 | Automatic WebSocket delivery is not implemented by the HTTP proof |
| A invites B to the organization | [Organization invitations](organization-invitations.md), mobile #2146 | Existing synthetic users do not prove provider email delivery or every new-account path |
| A invites a guest only to one channel | [Channel guests](channel-guests.md), mobile #2150 and #2169 | No org membership/sibling access; this is the confirmed meaning of “group channel invitation” |
| Invite Agents into a channel and interact | [Channel Agents](channel-agents.md), mobile #2152 | Organization-wide Agent admission is still unimplemented; channel credentials do not satisfy it |
| Phone → A → B → same-channel result through two isolated Hosts | [Native phone/Host qualification](work-forwarding.md#phone--two-native-hosts-follow-up--2026-10-18), mobile #2157 | Bounded health check only; hardware diversity, arbitrary commands and WebSocket remain unproven |
| Natural invitation entry and shared workspace navigation | Invitation #2169; guest projection UAT [evidence](evidence/2026-10-18-workspace-directory-uat.json); mobile #2170 source tests | New drawer native switch/revoke/account isolation/text-size/theme evidence pending; disk capacity currently prevents assignment |
| Share and join with URL/QR | Recipient-bound URL preview/accept is recorded in [CLI contract](t1-cli-session.md) | Sender native copy/share, QR rendering/save, new-instance Hosted AuthKit continuation and camera/Android gates remain open |

The next assigned device run must use the final #2170 source SHA, not an earlier green candidate. Display-scope hardening is distinct from authorization: saved account identity partitions local view state while verified live identity and current server checks continue to authorize requests. Normal refresh must retain a draft; account replacement must not reveal the previous user's cached view.

## First slice contract

`POST /api/onboarding` runs after authenticated sign-in and on explicit session checks. A fixed server-derived user operation provisions "My workspace" once; it cannot be selected by caller-provided user IDs. `GET /api/me` remains read-only. Existing instance deployments retain admin-only admission until a protected operator policy change enables authenticated users and additional org creation. WorkOS registration configuration remains a separate control; invitation-only registration can coexist with normal non-admin users.
Expand Down
6 changes: 6 additions & 0 deletions docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,9 @@ See [channel guests](channel-guests.md) for the bounded next slice. Channel DO o
### Channel Agent interaction sub-slice

The autonomous UAT goal now proceeds through [channel-scoped Agent credentials and reply](channel-agents.md), after [direct channel guest native verification](channel-guests.md#native-uat-verification--2026-10-18-jst). One initial credential hash per Channel Agent, fixed read/send scopes and a join sequence floor are the implemented narrow model; separate rotating credentials, organization-wide Agents and management roles remain target extensions. This increment does not claim work execution, WebSocket, two-Host completion or T3 closure.

### Unified mobile workspace drawer increment

The shared mobile drawer groups paired computers and cloud workspaces. Its cloud projection combines current membership with authorized channel-guest organization identity, deduplicated per instance/org with membership taking precedence. Guests see the organization identity but only granted channels; selecting their row never joins/selects an organization. See [guest directory contract](channel-guests.md#workspace-directory-projection).

Acceptance: CLI and phone agree on current authorized organization/channel identity; two instances remain separate; pagination handles empty pages; guest selection lists only that organization's granted channels; no membership or sibling-channel access appears; revocation removes the guest-only workspace on refresh; switching back restores the paired Host view. Test loading/error/retry and default/intermediate/maximum text in light/dark. Source tests and the [real UAT CLI projection](evidence/2026-10-18-workspace-directory-uat.json) are verified; native drawer acceptance remains pending. Existing T1 and full collaboration gates stay open.
6 changes: 6 additions & 0 deletions docs/t1-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,9 @@ Acceptance: two ordinary synthetic UAT accounts receive distinct default workspa
The next client tracer carries a recipient-bound invitation through service selection/trust and existing WorkOS login, then explicitly accepts it. `GET /api/{invitations|channel-invitations}/:id` only returns destination identity to the verified recipient and never creates membership. The same origin-bound URL works with CLI preview/accept and the native join screen. A pending URL is local navigation state, not an authorization record. Read the [current contract and acceptance](t1-cli-session.md#recipient-bound-invitation-links-next-tracer-validation-in-progress) for actual UAT evidence and unfinished native/QR gates. The earlier admin-only and no-organization paragraphs describe the historical T1 initialization increment; later collaboration slices have their own recorded authorizations and evidence.

Assigned iOS continuation: [native invitation evidence](https://github.com/BotHarness/DeepSeekBot/blob/8b9c8dba55f13e323274fc728a3116a2df2ad9bb/.github/pr-screenshots/2161-invitation-journey/README.md) verifies pending-target cold restart, exact guest-channel entry without organization membership, one message, revocation and isolated session cleanup. Sender copy/share and new-instance trust/Hosted AuthKit return are still explicit acceptance gates; the synthetic test session does not substitute for those flows.

### Unified mobile workspace drawer increment

The shared mobile drawer groups paired computers and cloud workspaces. Its cloud projection combines current membership with authorized channel-guest organization identity, deduplicated per instance/org with membership taking precedence. Guests see the organization identity but only granted channels; selecting their row never joins/selects an organization. See [guest directory contract](channel-guests.md#workspace-directory-projection).

Acceptance: CLI and phone agree on current authorized organization/channel identity; two instances remain separate; pagination handles empty pages; guest selection lists only that organization's granted channels; no membership or sibling-channel access appears; revocation removes the guest-only workspace on refresh; switching back restores the paired Host view. Test loading/error/retry and default/intermediate/maximum text in light/dark. Source tests and the [real UAT CLI projection](evidence/2026-10-18-workspace-directory-uat.json) are verified; native drawer acceptance remains pending. Existing T1 and full collaboration gates stay open.
3 changes: 3 additions & 0 deletions tests/cli.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ test('channel guests use independent public routes without selecting or joining
await run('channel-invite','revoke','--channel',channel,'--id',invitation);
assert.deepEqual(seen[6],{path:'/api/organizations/org_owner/channels/'+channel+'/guest-invitations',method:'POST',body:{email:'b@example.test'},key:'guest-invite-0001'});
assert.equal(seen[8].path,'/api/organizations/org_owner/channels/'+channel+'/guest-invitations/'+invitation+'/revoke');
await run('guest-channel','list','--org','org_invites','--after',invitation);
assert.equal(seen[9].path,'/api/guest-channels?after='+invitation+'&organizationId=org_invites');
await fails(run('guest-channel','list','--org','invalid'),'INVALID_ORGANIZATION');
await fails(run('channel-invite','accept','--id','invitation_wrong'),'INVALID_CHANNEL_INVITATION');
await fails(run('guest-channel','show','--id','ch_wrong'),'INVALID_CHANNEL');
globalThis.fetch=async(url,init)=>String(url).includes('/api/guest-channels')?Response.json({error:{code:'CHANNEL_ACCESS_DENIED'}},{status:403}):previous(url,init);
Expand Down
6 changes: 5 additions & 1 deletion tests/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,11 @@ it('a channel guest joins without organization membership and can only read/writ
expect(await (await f.guest('/organizations')).json()).toMatchObject({ organizations: [] });
for (const path of ['/organizations/org_invites/access', '/organizations/org_invites', '/organizations/org_invites/channels', '/guest-channels/' + f.sibling.channelId, '/guest-channels/' + f.sibling.channelId + '/messages']) expect((await f.guest(path)).status).toBe(403);
const list = await (await f.guest('/guest-channels')).json();
expect(list).toMatchObject({ channels: [{ channelId: f.channel.channelId, access: 'guest', historyAfter: 1 }], nextCursor: null });
expect(list).toMatchObject({ channels: [{ channelId: f.channel.channelId, organizationName: 'Invitation workspace', access: 'guest', historyAfter: 1 }], nextCursor: null });
expect(await (await f.guest('/guest-channels?organizationId=org_invites')).json()).toMatchObject({ channels: [{ channelId: f.channel.channelId, organizationName: 'Invitation workspace' }] });
expect(await (await f.guest('/guest-channels?organizationId=org_other')).json()).toMatchObject({ channels: [] });
expect(await (await f.guest('/guest-channels?organizationId=org_invites', 'user_c')).json()).toMatchObject({ channels: [] });
expect((await f.guest('/guest-channels?organizationId=invalid')).status).toBe(400);
const path = '/guest-channels/' + f.channel.channelId + '/messages';
expect(await (await f.guest(path)).json()).toMatchObject({ messages: [], nextCursor: 1 });
expect((await f.guest(path, 'user_b', 'POST', { text: 'Guest text', authorId: 'user_a' })).status).toBe(400);
Expand Down
Loading