@agentconnect/host 0.2.1 → 0.2.3

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.
package/dist/host.d.ts CHANGED
@@ -19,6 +19,7 @@ export interface HostOptions {
19
19
  hostId?: string;
20
20
  hostName?: string;
21
21
  hostVersion?: string;
22
+ logSpawn?: boolean;
22
23
  log?: HostLogger;
23
24
  }
24
25
  export interface DevHostOptions extends HostOptions {
package/dist/host.js CHANGED
@@ -6,7 +6,7 @@ import { promises as fsp } from 'fs';
6
6
  import net from 'net';
7
7
  import path from 'path';
8
8
  import { listModels, listRecentModels, providers, resolveProviderForModel } from './providers/index.js';
9
- import { debugLog } from './providers/utils.js';
9
+ import { debugLog, setSpawnLogging } from './providers/utils.js';
10
10
  import { createObservedTracker } from './observed.js';
11
11
  function send(socket, payload) {
12
12
  socket.send(JSON.stringify(payload));
@@ -68,6 +68,7 @@ function createHostRuntime(options) {
68
68
  const hostId = options.hostId || (mode === 'dev' ? 'agentconnect-dev' : 'agentconnect-host');
69
69
  const hostName = options.hostName || (mode === 'dev' ? 'AgentConnect Dev Host' : 'AgentConnect Host');
70
70
  const hostVersion = options.hostVersion || '0.1.0';
71
+ setSpawnLogging(Boolean(options.logSpawn));
71
72
  function resolveAppPathInternal(input) {
72
73
  if (!input)
73
74
  return basePath;
@@ -3,7 +3,7 @@ import { access, mkdir, readFile, rm, writeFile } from 'fs/promises';
3
3
  import https from 'https';
4
4
  import os from 'os';
5
5
  import path from 'path';
6
- import { buildInstallCommand, buildInstallCommandAuto, buildLoginCommand, buildStatusCommand, checkCommandVersion, commandExists, createLineParser, debugLog, resolveWindowsCommand, resolveCommandPath, resolveCommandRealPath, runCommand, } from './utils.js';
6
+ import { buildInstallCommand, buildInstallCommandAuto, buildLoginCommand, buildStatusCommand, checkCommandVersion, commandExists, createLineParser, debugLog, logProviderSpawn, resolveWindowsCommand, resolveCommandPath, resolveCommandRealPath, runCommand, } from './utils.js';
7
7
  const CLAUDE_PACKAGE = '@anthropic-ai/claude-code';
8
8
  const INSTALL_UNIX = 'curl -fsSL https://claude.ai/install.sh | bash';
9
9
  const INSTALL_WINDOWS_PS = 'irm https://claude.ai/install.ps1 | iex';
@@ -977,6 +977,13 @@ export function runClaudePrompt({ prompt, resumeSessionId, model, cwd, providerD
977
977
  if (resumeSessionId)
978
978
  args.push('--resume', resumeSessionId);
979
979
  args.push(prompt);
980
+ logProviderSpawn({
981
+ provider: 'claude',
982
+ command,
983
+ args,
984
+ cwd: cwd || process.cwd(),
985
+ resumeSessionId,
986
+ });
980
987
  const child = spawn(command, args, {
981
988
  cwd,
982
989
  env: { ...process.env },
@@ -3,7 +3,7 @@ import { readFile } from 'fs/promises';
3
3
  import https from 'https';
4
4
  import os from 'os';
5
5
  import path from 'path';
6
- import { buildInstallCommandAuto, buildLoginCommand, buildStatusCommand, checkCommandVersion, commandExists, createLineParser, debugLog, resolveWindowsCommand, resolveCommandPath, resolveCommandRealPath, runCommand, } from './utils.js';
6
+ import { buildInstallCommandAuto, buildLoginCommand, buildStatusCommand, checkCommandVersion, commandExists, createLineParser, debugLog, logProviderSpawn, resolveWindowsCommand, resolveCommandPath, resolveCommandRealPath, runCommand, } from './utils.js';
7
7
  const CODEX_PACKAGE = '@openai/codex';
8
8
  const DEFAULT_LOGIN = 'codex login';
9
9
  const DEFAULT_STATUS = 'codex login status';
@@ -227,7 +227,7 @@ async function hasCodexAuth() {
227
227
  return false;
228
228
  }
229
229
  function buildCodexExecArgs(options) {
230
- const { prompt, cdTarget, resumeSessionId, model, reasoningEffort, mode } = options;
230
+ const { prompt, cdTarget, resumeSessionId, model, reasoningEffort, providerDetailLevel, mode } = options;
231
231
  const args = ['exec', '--skip-git-repo-check'];
232
232
  if (mode === 'legacy') {
233
233
  args.push('--json', '-C', cdTarget);
@@ -236,6 +236,27 @@ function buildCodexExecArgs(options) {
236
236
  args.push('--experimental-json', '--cd', cdTarget);
237
237
  }
238
238
  args.push('--yolo');
239
+ const summarySetting = process.env.AGENTCONNECT_CODEX_REASONING_SUMMARY;
240
+ const summary = summarySetting && summarySetting.trim()
241
+ ? summarySetting.trim()
242
+ : 'detailed';
243
+ const summaryDisabled = ['0', 'false', 'off', 'none'].includes(summary.toLowerCase());
244
+ if (!summaryDisabled) {
245
+ args.push('--config', `model_reasoning_summary=${summary}`);
246
+ const supportsSetting = process.env.AGENTCONNECT_CODEX_SUPPORTS_REASONING_SUMMARIES;
247
+ const supportsValue = supportsSetting && supportsSetting.trim() ? supportsSetting.trim() : 'true';
248
+ args.push('--config', `model_supports_reasoning_summaries=${supportsValue}`);
249
+ }
250
+ const verbositySetting = process.env.AGENTCONNECT_CODEX_MODEL_VERBOSITY;
251
+ if (verbositySetting && verbositySetting.trim()) {
252
+ args.push('--config', `model_verbosity=${verbositySetting.trim()}`);
253
+ }
254
+ const rawSetting = process.env.AGENTCONNECT_CODEX_SHOW_RAW_REASONING;
255
+ const rawEnabled = providerDetailLevel === 'raw' ||
256
+ (rawSetting ? ['1', 'true', 'yes', 'on'].includes(rawSetting.trim().toLowerCase()) : false);
257
+ if (rawEnabled) {
258
+ args.push('--config', 'show_raw_agent_reasoning=true');
259
+ }
239
260
  if (model) {
240
261
  args.push('--model', String(model));
241
262
  }
@@ -637,8 +658,16 @@ export function runCodexPrompt({ prompt, resumeSessionId, model, reasoningEffort
637
658
  resumeSessionId,
638
659
  model,
639
660
  reasoningEffort,
661
+ providerDetailLevel,
640
662
  mode,
641
663
  });
664
+ logProviderSpawn({
665
+ provider: 'codex',
666
+ command,
667
+ args,
668
+ cwd: runDir,
669
+ resumeSessionId,
670
+ });
642
671
  const argsPreview = [...args];
643
672
  if (argsPreview.length > 0) {
644
673
  argsPreview[argsPreview.length - 1] = '[prompt]';
@@ -646,7 +675,25 @@ export function runCodexPrompt({ prompt, resumeSessionId, model, reasoningEffort
646
675
  debugLog('Codex', 'spawn', { command, args: argsPreview, cwd: runDir, mode });
647
676
  const child = spawn(command, args, {
648
677
  cwd: runDir,
649
- env: { ...process.env },
678
+ env: (() => {
679
+ const env = { ...process.env };
680
+ if (!env.RUST_LOG) {
681
+ const override = process.env.AGENTCONNECT_CODEX_RUST_LOG;
682
+ if (override && override.trim()) {
683
+ env.RUST_LOG = override.trim();
684
+ }
685
+ else {
686
+ const debugFlag = process.env.AGENTCONNECT_CODEX_DEBUG_LOGS;
687
+ const enabled = debugFlag
688
+ ? ['1', 'true', 'yes', 'on'].includes(debugFlag.trim().toLowerCase())
689
+ : false;
690
+ if (enabled) {
691
+ env.RUST_LOG = 'codex_exec=debug,codex_core=debug';
692
+ }
693
+ }
694
+ }
695
+ return env;
696
+ })(),
650
697
  stdio: ['ignore', 'pipe', 'pipe'],
651
698
  });
652
699
  if (signal) {
@@ -1,6 +1,6 @@
1
1
  import { spawn } from 'child_process';
2
2
  import path from 'path';
3
- import { buildInstallCommand, buildLoginCommand, buildStatusCommand, checkCommandVersion, commandExists, createLineParser, debugLog, resolveWindowsCommand, resolveCommandPath, resolveCommandRealPath, runCommand, } from './utils.js';
3
+ import { buildInstallCommand, buildLoginCommand, buildStatusCommand, checkCommandVersion, commandExists, createLineParser, debugLog, logProviderSpawn, resolveWindowsCommand, resolveCommandPath, resolveCommandRealPath, runCommand, } from './utils.js';
4
4
  const INSTALL_UNIX = 'curl https://cursor.com/install -fsS | bash';
5
5
  const DEFAULT_LOGIN = 'cursor-agent login';
6
6
  const DEFAULT_STATUS = 'cursor-agent status';
@@ -631,6 +631,13 @@ export function runCursorPrompt({ prompt, resumeSessionId, model, repoRoot, cwd,
631
631
  args.push('--endpoint', endpoint);
632
632
  }
633
633
  args.push(prompt);
634
+ logProviderSpawn({
635
+ provider: 'cursor',
636
+ command,
637
+ args,
638
+ cwd: runDir,
639
+ resumeSessionId,
640
+ });
634
641
  const argsPreview = [...args];
635
642
  if (argsPreview.length > 0) {
636
643
  argsPreview[argsPreview.length - 1] = '[prompt]';
@@ -1,3 +1,4 @@
1
+ import { logProviderSpawn } from './utils.js';
1
2
  function getLocalBaseUrl() {
2
3
  const base = process.env.AGENTCONNECT_LOCAL_BASE_URL || 'http://localhost:11434/v1';
3
4
  return base.replace(/\/+$/, '');
@@ -83,6 +84,12 @@ export async function runLocalPrompt({ prompt, model, onEvent, }) {
83
84
  onEvent({ type: 'error', message: 'Local provider model is not configured.' });
84
85
  return { sessionId: null };
85
86
  }
87
+ logProviderSpawn({
88
+ provider: 'local',
89
+ command: 'local',
90
+ args: ['--base-url', base, '--model', resolvedModel, prompt],
91
+ cwd: process.cwd(),
92
+ });
86
93
  const payload = {
87
94
  model: resolvedModel,
88
95
  messages: [{ role: 'user', content: prompt }],
@@ -1,5 +1,14 @@
1
1
  import { type SpawnOptions } from 'child_process';
2
2
  import type { CommandResult } from '../types.js';
3
+ export declare function setSpawnLogging(enabled: boolean): void;
4
+ export declare function logProviderSpawn(options: {
5
+ provider: string;
6
+ command: string;
7
+ args: string[];
8
+ cwd?: string;
9
+ resumeSessionId?: string | null;
10
+ redactIndex?: number;
11
+ }): void;
3
12
  export declare function debugLog(scope: string, message: string, details?: Record<string, unknown>): void;
4
13
  export interface SplitCommandResult {
5
14
  command: string;
@@ -3,6 +3,35 @@ import { existsSync, realpathSync } from 'fs';
3
3
  import os from 'os';
4
4
  import path from 'path';
5
5
  const DEBUG_ENABLED = Boolean(process.env.AGENTCONNECT_DEBUG?.trim());
6
+ let SPAWN_LOG_ENABLED = false;
7
+ export function setSpawnLogging(enabled) {
8
+ SPAWN_LOG_ENABLED = enabled;
9
+ }
10
+ export function logProviderSpawn(options) {
11
+ if (!SPAWN_LOG_ENABLED)
12
+ return;
13
+ const redacted = [...options.args];
14
+ const idx = typeof options.redactIndex === 'number' ? options.redactIndex : redacted.length - 1;
15
+ if (idx >= 0 && idx < redacted.length) {
16
+ redacted[idx] = '[prompt]';
17
+ }
18
+ const cwd = options.cwd || process.cwd();
19
+ const formatted = formatShellCommand(options.command, redacted);
20
+ const fullCommand = cwd
21
+ ? `${formatShellCommand('cd', [cwd])} && ${formatted}`
22
+ : formatted;
23
+ console.log(`AgentConnect: ${fullCommand}`);
24
+ }
25
+ function formatShellCommand(command, args) {
26
+ return [command, ...args].map(formatShellArg).join(' ');
27
+ }
28
+ function formatShellArg(value) {
29
+ if (!value)
30
+ return "''";
31
+ if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value))
32
+ return value;
33
+ return `'${value.replace(/'/g, `'\\''`)}'`;
34
+ }
6
35
  export function debugLog(scope, message, details) {
7
36
  if (!DEBUG_ENABLED)
8
37
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentconnect/host",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/rayzhudev/agent-connect",