@borgee/agents-host 0.2.56 → 0.2.62

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.
@@ -6,7 +6,7 @@ import { dirname, isAbsolute, join, resolve } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { AgentsHostSupervisor } from './agents-host-supervisor.js';
8
8
  import { DEFAULT_PROJECTION_STRATEGY, normalizeProjectionStrategy, } from './projection-strategy-values.js';
9
- import { resolveChannelWorkspaceDirectory, resolveChannelWorkspaceRootDirectory, resolveManagedWorkspaceCollectionRoot, resolveTaskWorkspaceDirectory, } from './context/injection.js';
9
+ import { resolveChannelWorkspaceDirectory, resolveChannelWorkspaceRootDirectory, resolveManagedWorkspaceCollectionRoot, resolveTaskThreadScratchWorkspaceDirectory, } from './context/injection.js';
10
10
  import { CLAUDE_PROVIDER_V2_COMPATIBILITY_GATE, COMPATIBILITY_GATES_ENV, createManagedRuntimeSettingsFingerprint, INTERNAL_CLAUDE_PROMPT_STRATEGY_ENV, INTERNAL_DISABLED_COMPATIBILITY_GATES_ENV, INTERNAL_POLICY_MODE_ENV, INTERNAL_PROVIDER_IMPLEMENTATIONS_ENV, MANAGED_RUNTIME_CONVERGENCE_COMPATIBILITY_GATE, MANAGED_RUNTIME_SETTINGS_SCHEMA_VERSION, resolveDisabledDefaultCompatibilityGates, resolveManagedRuntimeSettingsSnapshot, serializeManagedRuntimeSettingsSnapshot, normalizeInternalProviderImplementationOverrides, } from './compatibility-gates.js';
11
11
  import { DEFAULT_PROVIDER_COMMAND_CONFIG, hasLegacyClaudeOneShotArgs, loadConfigFromEnv, } from './config.js';
12
12
  import { loadLocalConfigGenerateSpec, materializeLocalConfig, parseGenerateConfigSpec, resolveLocalConfigLayout, } from './local-config.js';
@@ -355,6 +355,7 @@ export function buildManagedLocalAgentConfig(options) {
355
355
  copilotArgs: [...config.copilotArgs],
356
356
  copilotSessionTtlMinutes: config.copilotSessionTtlMinutes,
357
357
  providerIdleShutdownMinutes: config.providerIdleShutdownMinutes,
358
+ allowCrossAgentIndependentWorkspaceHandoff: config.allowCrossAgentIndependentWorkspaceHandoff,
358
359
  },
359
360
  };
360
361
  }
@@ -401,6 +402,9 @@ function mergeManagedLocalAgentConfig(hostDefaults, existingAgent, generatedAgen
401
402
  providerIdleShutdownMinutes: hasOverride('PROVIDER_IDLE_SHUTDOWN_MINUTES')
402
403
  ? generatedAgent.providerIdleShutdownMinutes
403
404
  : existingAgent.providerIdleShutdownMinutes,
405
+ allowCrossAgentIndependentWorkspaceHandoff: hasOverride('ALLOW_CROSS_AGENT_INDEPENDENT_WORKSPACE_HANDOFF')
406
+ ? generatedAgent.allowCrossAgentIndependentWorkspaceHandoff
407
+ : existingAgent.allowCrossAgentIndependentWorkspaceHandoff,
404
408
  };
405
409
  }
406
410
  function collectExplicitManagedAgentEnvOverrides(processEnv, optionEnv) {
@@ -416,6 +420,7 @@ function collectExplicitManagedAgentEnvOverrides(processEnv, optionEnv) {
416
420
  'COPILOT_ARGS',
417
421
  'COPILOT_SESSION_TTL_MINUTES',
418
422
  'PROVIDER_IDLE_SHUTDOWN_MINUTES',
423
+ 'ALLOW_CROSS_AGENT_INDEPENDENT_WORKSPACE_HANDOFF',
419
424
  ]) {
420
425
  if (processEnv[key] !== undefined) {
421
426
  explicitOverrides[key] = processEnv[key];
@@ -892,7 +897,9 @@ async function discoverManagedWorkspaceRootsForPurge(rootPath, processEnv) {
892
897
  continue;
893
898
  }
894
899
  const resolvedWorkspace = parsed.resolvedWorkspace;
895
- if ((resolvedWorkspace.authority !== 'channel' && resolvedWorkspace.authority !== 'task')
900
+ if ((resolvedWorkspace.authority !== 'channel'
901
+ && resolvedWorkspace.authority !== 'task-thread-scratch'
902
+ && resolvedWorkspace.authority !== 'task-execution-target')
896
903
  || typeof resolvedWorkspace.rootPath !== 'string'
897
904
  || !isAbsolute(resolvedWorkspace.rootPath)) {
898
905
  continue;
@@ -910,20 +917,18 @@ async function discoverManagedWorkspaceRootsForPurge(rootPath, processEnv) {
910
917
  workspaceRoots.add(trustedChannelWorkspaceRoot);
911
918
  break;
912
919
  }
913
- const expectedWorkspacePath = resolvedWorkspace.authority === 'task'
914
- ? typeof resolvedWorkspace.taskId === 'string' && resolvedWorkspace.taskId.length > 0
915
- ? resolveTaskWorkspaceDirectory(workspaceCollectionRoot, parsed.channelId, resolvedWorkspace.taskId)
916
- : null
917
- : null;
918
- if (!expectedWorkspacePath) {
919
- continue;
920
+ if (resolvedWorkspace.authority === 'task-thread-scratch') {
921
+ const expectedWorkspacePath = resolveTaskThreadScratchWorkspaceDirectory(workspaceCollectionRoot, parsed.channelId);
922
+ if (resolvedWorkspace.rootPath !== expectedWorkspacePath) {
923
+ continue;
924
+ }
925
+ workspaceRoots.add(resolveChannelWorkspaceRootDirectory(workspaceCollectionRoot, parsed.channelId));
926
+ break;
920
927
  }
921
- if (resolvedWorkspace.rootPath !== expectedWorkspacePath) {
928
+ if (resolvedWorkspace.authority !== 'task-execution-target') {
922
929
  continue;
923
930
  }
924
- workspaceRoots.add(dirname(expectedWorkspacePath));
925
- workspaceRoots.add(resolveChannelWorkspaceRootDirectory(workspaceCollectionRoot, parsed.channelId));
926
- break;
931
+ continue;
927
932
  }
928
933
  }
929
934
  }
@@ -3754,9 +3754,6 @@ var CONFIG_ACK_REASONS = /* @__PURE__ */ new Set([
3754
3754
  "unknown"
3755
3755
  ]);
3756
3756
  var WS_CLOSE_AUTH_FAILED = 4004;
3757
- var RESUME_REPLAY_MODE = "latest_n";
3758
- var RESUME_SINCE_CURSOR = 0;
3759
- var RESUME_LATEST_N = 200;
3760
3757
  var RESULT_STATUS_OK = "ok";
3761
3758
  var STOP_TURN_ACTION = "stop_turn";
3762
3759
  var STOP_TURN_CHANNEL_ID_INVALID = "stop_turn_channel_id_invalid";
@@ -3999,7 +3996,6 @@ var BppTransport = class {
3999
3996
  throw new BorgeeError("authenticated agent identity could not be resolved", "bpp.identity_unresolved");
4000
3997
  this.agentId = resolved;
4001
3998
  }
4002
- this.sendResumeRequest(ws);
4003
3999
  this.startHeartbeat();
4004
4000
  this.goOnline(ws);
4005
4001
  resolve();
@@ -4009,18 +4005,6 @@ var BppTransport = class {
4009
4005
  this.failTerminal(failure, ws);
4010
4006
  }
4011
4007
  }
4012
- // The resume is written for one reader: a server that still holds durable
4013
- // frames behind a pre-ack barrier releases it when this frame arrives. Its
4014
- // answer is not read, so the request asks for nothing.
4015
- sendResumeRequest(ws) {
4016
- const frame = {
4017
- type: "session.resume",
4018
- replay_mode: RESUME_REPLAY_MODE,
4019
- since_cursor: RESUME_SINCE_CURSOR,
4020
- latest_n: RESUME_LATEST_N
4021
- };
4022
- this.sendTo(ws, frame);
4023
- }
4024
4008
  scheduleReconnect() {
4025
4009
  if (this.closed || this.terminal || !this.autoReconnect)
4026
4010
  return;
@@ -4086,7 +4070,6 @@ var BppTransport = class {
4086
4070
  case "agent_config_update":
4087
4071
  this.handleConfigUpdate(env, source);
4088
4072
  break;
4089
- case "session.resume_ack":
4090
4073
  case "pong":
4091
4074
  case "ping":
4092
4075
  case "agent_toggle":