@caupulican/pi-adaptative 0.80.65 → 0.80.66

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.
@@ -31,6 +31,7 @@ import { createCoreDiagnosticsToolDefinitions } from "./extensions/builtin.js";
31
31
  import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
32
32
  import { disposeExtensionEventSubscriptions } from "./extensions/loader.js";
33
33
  import { emitSessionShutdownEvent } from "./extensions/runner.js";
34
+ import { GatewayRegistry } from "./gateways/channel-provider.js";
34
35
  import { decideDemand, ReflectionEngine, } from "./learning/reflection-engine.js";
35
36
  import { EffectivenessTracker } from "./memory/effectiveness-tracker.js";
36
37
  import { MemoryManager } from "./memory/memory-manager.js";
@@ -123,6 +124,8 @@ export class AgentSession {
123
124
  _memoryManager = new MemoryManager();
124
125
  /** R4: tracks whether injected recall is actually used, to adapt the recall gate. */
125
126
  _effectivenessTracker = new EffectivenessTracker();
127
+ /** R8: registry for deployment-supplied gateway channels + schedulers (lifecycle driven by the host runner). */
128
+ _gatewayRegistry = new GatewayRegistry();
126
129
  _isChildSession;
127
130
  /** Memory providers registered by extensions via pi.registerMemoryProvider, applied on (re)init. */
128
131
  _pendingMemoryProviders = [];
@@ -659,6 +662,8 @@ export class AgentSession {
659
662
  this.abortBranchSummary();
660
663
  this.abortBash();
661
664
  this.agent.abort();
665
+ // R8: stop any deployment-registered gateway channels / schedulers.
666
+ void this._gatewayRegistry.stop().catch(() => { });
662
667
  }
663
668
  catch {
664
669
  // Dispose must succeed even if an abort hook throws.
@@ -2301,6 +2306,18 @@ export class AgentSession {
2301
2306
  this._pendingMemoryProviders.push(provider);
2302
2307
  }
2303
2308
  }
2309
+ /** R8: the gateway/scheduler registry. A deployment runner registers providers and drives start/stop. */
2310
+ get gateways() {
2311
+ return this._gatewayRegistry;
2312
+ }
2313
+ /** R8: register a deployment-supplied transport channel (gateway). */
2314
+ registerChannelProvider(provider) {
2315
+ this._gatewayRegistry.registerChannel(provider);
2316
+ }
2317
+ /** R8: register a deployment-supplied job scheduler (cron). */
2318
+ registerJobScheduler(provider) {
2319
+ this._gatewayRegistry.registerScheduler(provider);
2320
+ }
2304
2321
  _refreshToolRegistry(options) {
2305
2322
  const previousRegistryNames = new Set(this._toolRegistry.keys());
2306
2323
  const previousActiveToolNames = this.getActiveToolNames();