@volter/supercode-teams 0.2.125 → 0.2.127

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
@@ -132,3 +132,11 @@ enrollments).
132
132
 
133
133
  `limits.json` is read when the daemon starts: `maxAttachmentsPerPrincipal` (16),
134
134
  `protocolFloor` (2), `logRotateBytes` (16 MiB), `logKeep` (8).
135
+
136
+ ### RH2 agent DMs
137
+
138
+ Share a session as its RH2 agent with `supercode teams sessions bind REF --room ROOM --agent PRINCIPAL --rh2 ORIGIN`.
139
+ Only the session custodian can grant this binding. The returned `session` can be passed to RH2’s room-member door;
140
+ no session-backed channel is created. The agent DM uses the exact resource `${ROOM}:dm:${PRINCIPAL}`.
141
+ `unbind` accepts the same flags. `--conversation` remains available for existing grants; it is mutually exclusive
142
+ with `--agent`. Opening a DM reads the existing session; sending a turn is a separate action.
package/bin/workspace.mjs CHANGED
@@ -307,11 +307,11 @@ async function sessionsCommand(sub, command) {
307
307
  // A session view (RH2 ADR 0008): its owner lets a workplace Room's Conversation read this session with the tokens that
308
308
  // workplace signs. `bind` records it and prints what the workplace's own bind door takes; `unbind` removes it.
309
309
  if (sub === 'bind' || sub === 'unbind') {
310
- only(flags, ['json', 'help', 'context', 'room', 'conversation', 'rh2']); requireArgs(rest, 1, 1, `sessions ${sub} REF --room ROOM --conversation CONVERSATION --rh2 ORIGIN`);
311
- if (!flags.room || !flags.conversation || !flags.rh2) usage(`sessions ${sub} needs --room, --conversation and --rh2 (the workplace's origin)`);
312
- const body = { issuer: new URL(String(flags.rh2)).origin, room: String(flags.room), conversation: String(flags.conversation) };
310
+ only(flags, ['json', 'help', 'context', 'room', 'agent', 'conversation', 'rh2']); requireArgs(rest, 1, 1, `sessions ${sub} REF --room ROOM --agent PRINCIPAL --rh2 ORIGIN`);
311
+ if (!flags.room || (!flags.agent && !flags.conversation) || (flags.agent && flags.conversation) || !flags.rh2) usage(`sessions ${sub} needs --room, --agent (or a legacy --conversation), and --rh2 (the workplace's origin)`);
312
+ const body = { issuer: new URL(String(flags.rh2)).origin, room: String(flags.room), conversation: flags.agent ? `${flags.room}:dm:${flags.agent}` : String(flags.conversation) };
313
313
  const bound = await command.client.request(sub === 'bind' ? 'POST' : 'DELETE', `${session.path}/view-bindings`, { body });
314
- return output({ version: 1, context: scope(context), data: { teamsUrl: new URL(context.origin).origin, team: context.team_id, sessionId: bound.data.session_id, harness: bound.data.harness, principalId: context.principal_id, bindings: bound.data.bindings } });
314
+ return output({ version: 1, context: scope(context), data: { teamsUrl: new URL(context.origin).origin, team: context.team_id, sessionId: bound.data.session_id, harness: bound.data.harness, principalId: context.principal_id, ...(flags.agent ? { agentPrincipalId: String(flags.agent), session: { agentPrincipalId: String(flags.agent), teamsUrl: new URL(context.origin).origin, team: context.team_id, sessionId: bound.data.session_id, harness: bound.data.harness } } : {}), bindings: bound.data.bindings } });
315
315
  }
316
316
  if (sub === 'rename') { only(flags, ['json', 'help', 'context']); requireArgs(rest, 2, 2, 'sessions rename REF TITLE'); const descriptor = await session.descriptor(); return output(await command.client.request('PATCH', session.path, { body: { title: rest[1] }, ifMatch: descriptor.data.revision })); }
317
317
  if (sub === 'delete') { only(flags, ['json', 'help', 'context']); requireArgs(rest, 1, 1, 'sessions delete REF'); const descriptor = await session.descriptor(); await command.client.request('DELETE', session.path, { ifMatch: descriptor.data.revision }); return output({ version: 1, context: scope(context), data: null }); }
package/machine.mjs CHANGED
@@ -534,11 +534,16 @@ export class TeamsMachine extends MachineCore {
534
534
  // Who typed it is noted before it is typed: a capture can read the session's new line before the door confirms
535
535
  // it (a loaded machine confirmed a frozen-then-resumed line after the line was captured, and it went up unnamed).
536
536
  // A refusal withdraws the note; an unconfirmed turn keeps it, as the line may well be in the session.
537
- const note = { harness, session, text: request.text, at: Date.now(), source: { via: 'room', from: { principalId: principal ?? null, name: entry.name ?? null } } };
537
+ // Room context comes only from the server-authenticated claim. JSON quotes names as data,
538
+ // so a display name cannot introduce another header or masquerade as an instruction.
539
+ const text = entry.roomContext
540
+ ? `[Room ${JSON.stringify(entry.roomContext.name)} (${JSON.stringify(entry.roomContext.id)}); sender ${JSON.stringify(entry.name ?? entry.roomContext.sender)} (${JSON.stringify(entry.roomContext.sender)})]\n${request.text}`
541
+ : request.text;
542
+ const note = { harness, session, text, at: Date.now(), source: { via: 'room', from: { principalId: principal ?? null, name: entry.name ?? null } } };
538
543
  try { this.onTurn?.(note); } catch { /* naming is best-effort; the turn goes either way */ }
539
544
  this.#serveRequest('harness.v1.sessions.message', {
540
545
  locator: { harness, session_id: session, storage: { kind: 'file', path: '' } },
541
- text: request.text,
546
+ text,
542
547
  from_name: entry.name ?? principal ?? 'a Room member',
543
548
  as_user: true,
544
549
  }, TURN_CONFIRM_MS).then((result) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-teams",
3
- "version": "0.2.125",
3
+ "version": "0.2.127",
4
4
  "type": "module",
5
5
  "description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
6
6
  "license": "MIT",