@volter/supercode-orchestrator 0.5.179 → 0.5.180

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.
@@ -142,7 +142,9 @@ log('info', `${values.agent}: the account Room ${roomId} is carried to its mailb
142
142
 
143
143
  const supercode = process.env.SUPERCODE_BIN || 'supercode';
144
144
  const sc = (args) => JSON.parse(execFileSync(supercode, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }));
145
- let boundTo = null;
145
+ let boundTo = null, failedAs = null;
146
+ const lastLine = (error) => String(error.stderr || error.message).trim().split('\n').at(-1);
147
+ const warnOnce = (as, line) => { if (failedAs !== as) { failedAs = as; log('warn', line); } };
146
148
  /** The agent's own seat takes its session at RH2's own-seat door (PUT …/members/:principalId/session, a Room
147
149
  * reader's): the session alone changes, never the seat's roles or who may read and post to it, which stay a
148
150
  * members.manage holder's. A refusal throws with its status. */
@@ -151,15 +153,21 @@ async function seatSession(session) {
151
153
  const res = await adapter.fetch(`${adapter.apiUrl()}/api/v3${path}`, { method: 'PUT', headers: adapter.headers(), body: JSON.stringify({ session }) });
152
154
  if (!res.ok) throw new Error(`PUT ${path} -> HTTP ${res.status}: ${(await res.text()).slice(0, 200)}`);
153
155
  }
154
- /** The participant's seat bound to the agent's current main session; a new main session rebinds it. */
156
+ /** The participant's seat bound to the agent's current main session; a new main session rebinds it. The agent's record
157
+ * is read again on every tick, so a re-declared main is bound at the next one. A bind that fails is said once per main
158
+ * and reason (a main that is not in the team's catalog, or one no session ever ran as), never only at debug level,
159
+ * which this process does not print. */
155
160
  async function bindDm() {
156
161
  let main;
157
- try { main = [sc(['agent', 'show', values.agent, '--json'])].flat().find((a) => a.name === values.agent)?.main_session; } catch { return; }
162
+ try { main = [sc(['agent', 'show', values.agent, '--json'])].flat().find((a) => a.name === values.agent)?.main_session; }
163
+ catch (error) { warnOnce(`agent show: ${lastLine(error)}`, `${values.agent}: its agent record was not read (${lastLine(error)}); its DM stays bound to ${boundTo ?? 'nothing'}`); return; }
158
164
  const session = typeof main === 'string' ? main.split(':').pop() : null;
159
- if (!session || session === boundTo) return;
165
+ if (!session) { warnOnce('no main', `${values.agent}: its agent record names no main session; its DM stays bound to ${boundTo ?? 'nothing'}`); return; }
166
+ if (session === boundTo) return;
160
167
  let bound;
161
168
  try { bound = sc(['sessions', 'bind', session, '--room', roomId, '--agent', adapter.principalId(), '--rh2', adapter.apiUrl(), '--json']).data; }
162
- catch (error) { log('debug', `${values.agent}: its DM is not bound yet (${String(error.stderr ?? error.message).trim().split('\n').at(-1)})`); return; }
169
+ catch (error) { warnOnce(`${session}: ${lastLine(error)}`, `${values.agent}: its DM is not bound to its main session ${main} (exit ${error.status ?? '?'}: ${lastLine(error)}); retried every 15 s with the record read again`); return; }
170
+ failedAs = null;
163
171
  await seatSession({ harness: bound.harness, sessionId: bound.sessionId, team: bound.team, teamsUrl: bound.teamsUrl });
164
172
  boundTo = session;
165
173
  log('info', `${values.agent}: its DM in the account Room is its main session ${session}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.179",
3
+ "version": "0.5.180",
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": {