@volter/supercode-teams 0.2.83 → 0.2.84

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.
@@ -262,7 +262,7 @@ export class TeamsConnector {
262
262
  // syncing. An error of the connection itself (the outbox, authentication, the server, a stop) still ends
263
263
  // the pass. The session keeps its native binding either way, so it can still be attached to.
264
264
  let captured = true;
265
- if (this.sessionChanged(options)) try { await this.capture(options); } catch (error) {
265
+ if (this.sessionChanged(options) && !this.predatesWindow(options)) try { await this.capture(options); } catch (error) {
266
266
  if (connectionError(error) || this.abort.signal.aborted) throw error;
267
267
  captured = false; this.noteSessionProblem(options, error);
268
268
  process.stderr.write(`supercode teams: ${harness} session ${nativeSessionId} not synced: ${error.message}\n`);
@@ -278,6 +278,17 @@ export class TeamsConnector {
278
278
  this.pruneNativeCache(discovered);
279
279
  this.rotateFollowers(followCandidates);
280
280
  }
281
+ // A session never published under a rule that keeps back history recorded before a time (a `since` window, or a
282
+ // `none` rule's capture_after), whose native file was last written before that time, holds only history the rule
283
+ // keeps back: loading it (a 228 MB transcript is gigabytes in the harness process and here) would publish nothing.
284
+ predatesWindow({locator,configuration,ruleId,ruleRevision,harness,nativeSessionId}){
285
+ if(this.state.origins[`${harness}:${nativeSessionId}`])return false;
286
+ const rule=configuration?.rules?.find(item=>item.id===ruleId&&item.revision===ruleRevision&&item.state==='active');if(!rule)return false;
287
+ const backfill=typeof rule.backfill==='string'?{mode:rule.backfill}:rule.backfill??{mode:'all'};
288
+ const keptBefore=backfill.mode==='since'?backfill.since:backfill.mode==='none'?rule.capture_after:null;
289
+ if(!Number.isSafeInteger(keptBefore)||locator?.storage?.kind!=='file')return false;
290
+ try{return statSync(realpathSync(locator.storage.path)).mtimeMs<keptBefore;}catch{return false;}
291
+ }
281
292
  // When a session was last active: its descriptor's updated_at_ms, else its native file's modification time.
282
293
  sessionActivity({locator,descriptor}){
283
294
  let activity=Number.isSafeInteger(descriptor?.updated_at_ms)?descriptor.updated_at_ms:null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-teams",
3
- "version": "0.2.83",
3
+ "version": "0.2.84",
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",