@volter/supercode-teams 0.2.40 → 0.2.41

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.
@@ -423,10 +423,13 @@ export class TeamsConnector {
423
423
  const unchanged=previous?.last_rule_revision===ruleRevision&&previous?.backfill_mode===backfillPolicy.mode&&previous?.observed_keys?.length===messages.length&&messages.every((message,index)=>message.native_key===previous.observed_keys[index]&&hash(canonicalJson(message.value))===previous.observed_digests?.[index]);
424
424
  if(unchanged&&!retryNative){this.recordStamp(key,ruleId,ruleRevision,backfillPolicy.mode,stamp);return null;}
425
425
  let effectivePrevious=previous;const clearBaseline=backfillPolicy.mode==='all';
426
- if(!previous&&backfillPolicy.mode==='none'){const toolTail=trailingToolResults(messages);this.state.origins[key]={generation:1,sequence:0,digest:null,baseline:messages.map(x=>x.native_key),baseline_digests:messages.map(x=>hash(canonicalJson(x.value))),...(toolTail?{baseline_tool_tail:toolTail}:{}),observed_keys:messages.map(x=>x.native_key),observed_digests:messages.map(x=>hash(canonicalJson(x.value))),last_rule_revision:ruleRevision,backfill_mode:backfillPolicy.mode};this.recordStamp(key,ruleId,ruleRevision,backfillPolicy.mode,stamp);return null;}
427
- if(!previous&&backfillPolicy.mode==='since'){
428
- if(!Number.isSafeInteger(backfillPolicy.since))throw Object.assign(new Error('since backfill requires an integer timestamp'),{code:'invalid_request'});
429
- const excluded=messages.filter(message=>message.recorded_at==null||message.recorded_at<backfillPolicy.since);
426
+ // A `none` rule keeps back the history recorded before it became active (the server's capture_after), not
427
+ // whatever a session holds when first seen: a session begun after the rule is published from its first message.
428
+ const keptBefore=backfillPolicy.mode==='since'?backfillPolicy.since:backfillPolicy.mode==='none'&&Number.isSafeInteger(rule.capture_after)?rule.capture_after:null;
429
+ if(!previous&&backfillPolicy.mode==='none'&&keptBefore===null){const toolTail=trailingToolResults(messages);this.state.origins[key]={generation:1,sequence:0,digest:null,baseline:messages.map(x=>x.native_key),baseline_digests:messages.map(x=>hash(canonicalJson(x.value))),...(toolTail?{baseline_tool_tail:toolTail}:{}),observed_keys:messages.map(x=>x.native_key),observed_digests:messages.map(x=>hash(canonicalJson(x.value))),last_rule_revision:ruleRevision,backfill_mode:backfillPolicy.mode};this.recordStamp(key,ruleId,ruleRevision,backfillPolicy.mode,stamp);return null;}
430
+ if(!previous&&(backfillPolicy.mode==='since'||backfillPolicy.mode==='none')){
431
+ if(!Number.isSafeInteger(keptBefore))throw Object.assign(new Error('since backfill requires an integer timestamp'),{code:'invalid_request'});
432
+ const excluded=messages.filter(message=>message.recorded_at==null||message.recorded_at<keptBefore);
430
433
  effectivePrevious={generation:1,sequence:0,digest:null,baseline:excluded.map(message=>message.native_key),baseline_digests:excluded.map(message=>hash(canonicalJson(message.value)))};
431
434
  this.state.origins[key]=effectivePrevious;
432
435
  }
@@ -443,8 +446,8 @@ export class TeamsConnector {
443
446
  // A rule that started mid tool call kept back the core's placeholder result; the real result replaces it.
444
447
  const settled=baselineMoved&&backfillPolicy.mode==='none'?settledToolTail(effectivePrevious,messages):null;
445
448
  if(settled){baselineMoved=false;effectivePrevious={...effectivePrevious,baseline_digests:settled};this.state.origins[key]={...this.state.origins[key],baseline_digests:settled};this.save();}
446
- if(baselineMoved&&backfillPolicy.mode==='since'&&Number.isSafeInteger(backfillPolicy.since)){
447
- const excluded=messages.filter(message=>message.recorded_at==null||message.recorded_at<backfillPolicy.since);
449
+ if(baselineMoved&&Number.isSafeInteger(keptBefore)){
450
+ const excluded=messages.filter(message=>message.recorded_at==null||message.recorded_at<keptBefore);
448
451
  effectivePrevious={...effectivePrevious,baseline:excluded.map(message=>message.native_key),baseline_digests:excluded.map(message=>hash(canonicalJson(message.value)))};
449
452
  // A tool tail recorded for the old baseline describes positions that no longer hold; it goes with it.
450
453
  delete effectivePrevious.baseline_tool_tail;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-teams",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
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",