@volter/supercode-teams 0.2.161 → 0.2.162
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.162",
|
|
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",
|
|
@@ -203,7 +203,10 @@ const ACTIVITY_FRESH_MS=60000;
|
|
|
203
203
|
/** The connector's latest fresh native turn report; stale or unrecognized reports remain unknown. */
|
|
204
204
|
async function activityOf(api,teamId,sessionId){
|
|
205
205
|
const row=await api.store.one('SELECT a.turn,a.since,a.observed_at FROM session_activity a JOIN origins o ON o.team_id=a.team_id AND o.source_id=a.source_id AND o.harness=a.harness AND o.native_id=a.native_id WHERE a.team_id=? AND o.deleted_at IS NULL AND o.session_id IN (SELECT id FROM sessions WHERE team_id=? AND (id=? OR canonical_id=?)) ORDER BY a.observed_at DESC LIMIT 1',[teamId,teamId,sessionId,sessionId]);
|
|
206
|
-
|
|
206
|
+
// Unknown is a fresh server determination too: give it an ordering time so
|
|
207
|
+
// an older known report cannot restore Working while the source is stale.
|
|
208
|
+
const now=api.clock.nowMs();
|
|
209
|
+
return row&&['working','idle','needs_input'].includes(row.turn)&&now-row.observed_at<ACTIVITY_FRESH_MS?{state:row.turn,since:row.since??row.observed_at,observedAt:row.observed_at}:{state:'unknown',observedAt:now};
|
|
207
210
|
}
|
|
208
211
|
async function sessionDescriptor(api,res,auth,id,requestId){
|
|
209
212
|
const row=await api.store.authorizedSession({teamId:auth.team_id,principalId:auth.principal_id,credentialId:auth.credential_id,ref:id,now:api.clock.nowMs(),bound:auth.bound});
|