@agentproto/driver-agent-cli 2.6.4 → 2.7.1

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.
@@ -504,6 +504,7 @@ function createAcpProtocolArm(options) {
504
504
  let client = null;
505
505
  let session = null;
506
506
  const pendingByTurn = /* @__PURE__ */ new Map();
507
+ const earlyDisconnectListeners = [];
507
508
  return {
508
509
  get sessionId() {
509
510
  return session?.sessionId;
@@ -520,6 +521,13 @@ function createAcpProtocolArm(options) {
520
521
  get currentModeId() {
521
522
  return session?.currentModeId;
522
523
  },
524
+ isConnected() {
525
+ return client?.isConnected() ?? true;
526
+ },
527
+ onDisconnect(listener) {
528
+ if (client) client.onDisconnect(listener);
529
+ else earlyDisconnectListeners.push(listener);
530
+ },
523
531
  async connect(opts) {
524
532
  const permissionHandler = options.onPermissionRequest ?? defaultPermissionHandlerForMode(options.requestedMode);
525
533
  client = await createAcpClient({
@@ -546,6 +554,9 @@ function createAcpProtocolArm(options) {
546
554
  requestPermission: async (params) => permissionHandler(params)
547
555
  }
548
556
  });
557
+ for (const listener of earlyDisconnectListeners.splice(0)) {
558
+ client.onDisconnect(listener);
559
+ }
549
560
  if (opts.resumeSessionId) {
550
561
  session = await client.loadSession({
551
562
  sessionId: opts.resumeSessionId,
@@ -2257,6 +2268,12 @@ cwd '${cwd}' does not exist \u2014 Node reports a missing working directory with
2257
2268
  return {
2258
2269
  sessionId,
2259
2270
  pid: child?.pid,
2271
+ // Transport liveness, delegated to the arm (see the fields' docs on
2272
+ // AgentCliRuntimeSession). An arm that models no long-lived
2273
+ // connection reports nothing, which reads as "connected" — there is
2274
+ // no stream for it to have lost, and nothing to subscribe to.
2275
+ isConnected: () => arm.isConnected?.() ?? true,
2276
+ ...arm.onDisconnect ? { onDisconnect: (listener) => arm.onDisconnect(listener) } : {},
2260
2277
  // Live model/mode/effort switches + the capability read-surface,
2261
2278
  // all pure arm delegation — shared with every host that builds
2262
2279
  // its own session over another transport. See session-controls.ts.
@@ -2381,5 +2398,5 @@ function derivedModelRefusalError(definition, requested, reason) {
2381
2398
  }
2382
2399
 
2383
2400
  export { LEGACY_GATEWAY_MODE_IDS, LEGACY_POSTURE_MODE_IDS, RuntimeConfigError, agentCliFrontmatterSchema, agentCliSupportsHostContextIsolation, applyModelCommand, autoAllowPermissionHandler, composeSpawn, createAcpProtocolArm, createAgentCliRuntime, createArmSessionControls, createJcodeMapperState, createMastraMapperState, createPrintSession, createProprietaryProtocolArm, defineAgentCli, hostContextExcludes, inferLegacyModeKind, isLegacyExtractedModeId, isModelSwitchAcknowledgement, mapJcodeEvent, mapMastraEvent, parseModelSwitchCommand, planModePermissionHandler, promptTurn, resolveContinuationStrategy, runtimeConfigSchema, toFileBasedMcpServers };
2384
- //# sourceMappingURL=chunk-D4NQQ2C7.mjs.map
2385
- //# sourceMappingURL=chunk-D4NQQ2C7.mjs.map
2401
+ //# sourceMappingURL=chunk-Y3FGLQ4R.mjs.map
2402
+ //# sourceMappingURL=chunk-Y3FGLQ4R.mjs.map