@volter/supercode-orchestrator 0.5.66 → 0.5.67

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.
@@ -136,6 +136,14 @@ log('info', `${values.agent}: the account Room ${roomId} is carried to its mailb
136
136
  const supercode = process.env.SUPERCODE_BIN || 'supercode';
137
137
  const sc = (args) => JSON.parse(execFileSync(supercode, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }));
138
138
  let boundTo = null;
139
+ /** The agent's own seat takes its session at RH2's own-seat door (PUT …/members/:principalId/session, a Room
140
+ * reader's): the session alone changes, never the seat's roles or who may read and post to it, which stay a
141
+ * members.manage holder's. A refusal throws with its status. */
142
+ async function seatSession(session) {
143
+ const path = `/rooms/${encodeURIComponent(roomId)}/members/${encodeURIComponent(adapter.principalId())}/session`;
144
+ const res = await adapter.fetch(`${adapter.apiUrl()}/api/v3${path}`, { method: 'PUT', headers: adapter.headers(), body: JSON.stringify({ session }) });
145
+ if (!res.ok) throw new Error(`PUT ${path} -> HTTP ${res.status}: ${(await res.text()).slice(0, 200)}`);
146
+ }
139
147
  /** The participant's seat bound to the agent's current main session; a new main session rebinds it. */
140
148
  async function bindDm() {
141
149
  let main;
@@ -145,7 +153,7 @@ async function bindDm() {
145
153
  let bound;
146
154
  try { bound = sc(['sessions', 'bind', session, '--room', roomId, '--agent', adapter.principalId(), '--rh2', adapter.apiUrl(), '--json']).data; }
147
155
  catch (error) { log('debug', `${values.agent}: its DM is not bound yet (${String(error.stderr ?? error.message).trim().split('\n').at(-1)})`); return; }
148
- await post(`/rooms/${encodeURIComponent(roomId)}/members`, { principalId: adapter.principalId(), roleKeys: ['member'], session: { harness: bound.harness, sessionId: bound.sessionId, team: bound.team, teamsUrl: bound.teamsUrl } });
156
+ await seatSession({ harness: bound.harness, sessionId: bound.sessionId, team: bound.team, teamsUrl: bound.teamsUrl });
149
157
  boundTo = session;
150
158
  log('info', `${values.agent}: its DM in the account Room is its main session ${session}`);
151
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.66",
3
+ "version": "0.5.67",
4
4
  "type": "module",
5
5
  "description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
6
6
  "exports": {