@openscout/scout 0.2.19 → 0.2.21

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.
@@ -1748,6 +1748,7 @@ var init_user_project_hints = __esm(() => {
1748
1748
 
1749
1749
  // packages/runtime/src/setup.ts
1750
1750
  import { execFileSync } from "child_process";
1751
+ import { existsSync as existsSync3, readFileSync } from "fs";
1751
1752
  import { access, mkdir as mkdir2, readdir as readdir2, readFile as readFile3, realpath, rm, stat as stat2, writeFile as writeFile2 } from "fs/promises";
1752
1753
  import { homedir as homedir3, hostname, userInfo } from "os";
1753
1754
  import { basename, dirname as dirname3, isAbsolute, join as join4, relative, resolve as resolve2 } from "path";
@@ -1925,7 +1926,25 @@ function normalizeTelegramConversationId(value) {
1925
1926
  return normalized;
1926
1927
  }
1927
1928
  function resolveNodeQualifier() {
1928
- return normalizeAgentSelectorSegment(process.env.OPENSCOUT_NODE_QUALIFIER?.trim() || hostname() || "local") || "local";
1929
+ const fromEnv = process.env.OPENSCOUT_NODE_QUALIFIER?.trim();
1930
+ if (fromEnv) {
1931
+ return normalizeAgentSelectorSegment(fromEnv) || "local";
1932
+ }
1933
+ const alias = readNodeAliasSync();
1934
+ if (alias) {
1935
+ return normalizeAgentSelectorSegment(alias) || "local";
1936
+ }
1937
+ return normalizeAgentSelectorSegment(hostname() || "local") || "local";
1938
+ }
1939
+ function readNodeAliasSync() {
1940
+ try {
1941
+ const settingsPath = resolveOpenScoutSupportPaths().settingsPath;
1942
+ const raw2 = readFileSync(settingsPath, "utf8");
1943
+ const settings = JSON.parse(raw2);
1944
+ return settings.node?.alias?.trim() || null;
1945
+ } catch {
1946
+ return null;
1947
+ }
1929
1948
  }
1930
1949
  function detectGitBranchUncached(projectRoot) {
1931
1950
  try {
@@ -2126,6 +2145,9 @@ function defaultSettings() {
2126
2145
  completedAt: null,
2127
2146
  skippedAt: null
2128
2147
  },
2148
+ node: {
2149
+ alias: ""
2150
+ },
2129
2151
  discovery: {
2130
2152
  contextRoot: null,
2131
2153
  workspaceRoots: [],
@@ -2525,6 +2547,7 @@ async function normalizeSettingsRecord(value, options = {}) {
2525
2547
  const candidate = typeof value === "object" && value ? value : {};
2526
2548
  const profile = typeof candidate.profile === "object" && candidate.profile ? candidate.profile : {};
2527
2549
  const onboarding = typeof candidate.onboarding === "object" && candidate.onboarding ? candidate.onboarding : {};
2550
+ const node = typeof candidate.node === "object" && candidate.node ? candidate.node : {};
2528
2551
  const discovery = typeof candidate.discovery === "object" && candidate.discovery ? candidate.discovery : {};
2529
2552
  const agents = typeof candidate.agents === "object" && candidate.agents ? candidate.agents : {};
2530
2553
  const bridges = typeof candidate.bridges === "object" && candidate.bridges ? candidate.bridges : {};
@@ -2564,6 +2587,9 @@ async function normalizeSettingsRecord(value, options = {}) {
2564
2587
  completedAt: normalizeOptionalTimestamp(onboarding.completedAt),
2565
2588
  skippedAt: normalizeOptionalTimestamp(onboarding.skippedAt)
2566
2589
  },
2590
+ node: {
2591
+ alias: normalizeOptionalString(node.alias)
2592
+ },
2567
2593
  discovery: {
2568
2594
  contextRoot,
2569
2595
  workspaceRoots,
@@ -4114,7 +4140,7 @@ function buildCollaborationContractPrompt(agentId) {
4114
4140
 
4115
4141
  // packages/runtime/src/broker-service.ts
4116
4142
  import { spawnSync } from "child_process";
4117
- import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
4143
+ import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync4, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
4118
4144
  import { homedir as homedir5 } from "os";
4119
4145
  import { basename as basename2, dirname as dirname5, join as join8, resolve as resolve4 } from "path";
4120
4146
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -4135,7 +4161,7 @@ function runtimePackageDir() {
4135
4161
  return resolve4(moduleDir, "..");
4136
4162
  }
4137
4163
  function isInstalledRuntimePackageDir(candidate) {
4138
- return existsSync5(join8(candidate, "package.json")) && existsSync5(join8(candidate, "bin", "openscout-runtime.mjs"));
4164
+ return existsSync6(join8(candidate, "package.json")) && existsSync6(join8(candidate, "bin", "openscout-runtime.mjs"));
4139
4165
  }
4140
4166
  function findGlobalRuntimeDir() {
4141
4167
  const bunCandidate = join8(homedir5(), ".bun", "node_modules", "@openscout", "runtime");
@@ -4153,7 +4179,7 @@ function findWorkspaceRuntimeDir(startDir) {
4153
4179
  let current = resolve4(startDir);
4154
4180
  while (true) {
4155
4181
  const candidate = join8(current, "packages", "runtime");
4156
- if (existsSync5(join8(candidate, "package.json")) && existsSync5(join8(candidate, "src"))) {
4182
+ if (existsSync6(join8(candidate, "package.json")) && existsSync6(join8(candidate, "src"))) {
4157
4183
  return candidate;
4158
4184
  }
4159
4185
  const parent = dirname5(current);
@@ -4167,18 +4193,18 @@ function resolveBunExecutable() {
4167
4193
  if (explicit && explicit.trim().length > 0) {
4168
4194
  return explicit;
4169
4195
  }
4170
- if (basename2(process.execPath).startsWith("bun") && existsSync5(process.execPath)) {
4196
+ if (basename2(process.execPath).startsWith("bun") && existsSync6(process.execPath)) {
4171
4197
  return process.execPath;
4172
4198
  }
4173
4199
  const pathEntries = (process.env.PATH ?? "").split(":").filter(Boolean);
4174
4200
  for (const entry of pathEntries) {
4175
4201
  const candidate = join8(entry, "bun");
4176
- if (existsSync5(candidate)) {
4202
+ if (existsSync6(candidate)) {
4177
4203
  return candidate;
4178
4204
  }
4179
4205
  }
4180
4206
  const homeBun = join8(homedir5(), ".bun", "bin", "bun");
4181
- if (existsSync5(homeBun)) {
4207
+ if (existsSync6(homeBun)) {
4182
4208
  return homeBun;
4183
4209
  }
4184
4210
  return "bun";
@@ -4364,10 +4390,10 @@ function launchctlPath() {
4364
4390
  return "/bin/launchctl";
4365
4391
  }
4366
4392
  function readLogLines(path) {
4367
- if (!existsSync5(path)) {
4393
+ if (!existsSync6(path)) {
4368
4394
  return [];
4369
4395
  }
4370
- return readFileSync3(path, "utf8").split(`
4396
+ return readFileSync4(path, "utf8").split(`
4371
4397
  `).map((line) => line.trim()).filter(Boolean);
4372
4398
  }
4373
4399
  function isPackageScriptBanner(line) {
@@ -4464,7 +4490,7 @@ async function brokerServiceStatus(config = resolveBrokerServiceConfig()) {
4464
4490
  ensureServiceDirectories(config);
4465
4491
  const launchctl = inspectLaunchctl(config);
4466
4492
  const health = await fetchHealthSnapshot(config);
4467
- const installed = existsSync5(config.launchAgentPath);
4493
+ const installed = existsSync6(config.launchAgentPath);
4468
4494
  const lastLogLine = health.reachable ? readLastLogLine([config.stdoutLogPath, config.stderrLogPath]) : readLastLogLine([config.stderrLogPath, config.stdoutLogPath]);
4469
4495
  return {
4470
4496
  label: config.label,
@@ -4526,7 +4552,7 @@ async function restartBrokerService(config = resolveBrokerServiceConfig()) {
4526
4552
  }
4527
4553
  async function uninstallBrokerService(config = resolveBrokerServiceConfig()) {
4528
4554
  await stopBrokerService(config);
4529
- if (existsSync5(config.launchAgentPath)) {
4555
+ if (existsSync6(config.launchAgentPath)) {
4530
4556
  rmSync2(config.launchAgentPath, { force: true });
4531
4557
  }
4532
4558
  return brokerServiceStatus(config);
@@ -4605,7 +4631,7 @@ var init_local_agent_template = __esm(() => {
4605
4631
 
4606
4632
  // packages/runtime/src/local-agents.ts
4607
4633
  import { execFileSync as execFileSync2, execSync } from "child_process";
4608
- import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
4634
+ import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
4609
4635
  import { basename as basename3, dirname as dirname6, join as join9, resolve as resolve5 } from "path";
4610
4636
  import { fileURLToPath as fileURLToPath5 } from "url";
4611
4637
  function resolveRelayHub() {
@@ -4617,10 +4643,10 @@ function resolveProjectsRoot(projectPath) {
4617
4643
  }
4618
4644
  try {
4619
4645
  const supportPaths = resolveOpenScoutSupportPaths();
4620
- if (!existsSync6(supportPaths.settingsPath)) {
4646
+ if (!existsSync7(supportPaths.settingsPath)) {
4621
4647
  return dirname6(projectPath);
4622
4648
  }
4623
- const raw2 = JSON.parse(readFileSync4(supportPaths.settingsPath, "utf8"));
4649
+ const raw2 = JSON.parse(readFileSync5(supportPaths.settingsPath, "utf8"));
4624
4650
  const workspaceRoot = raw2.discovery?.workspaceRoots?.find((entry) => typeof entry === "string" && entry.trim().length > 0);
4625
4651
  return workspaceRoot ? resolve5(workspaceRoot) : dirname6(projectPath);
4626
4652
  } catch {
@@ -4647,7 +4673,7 @@ function resolveScoutSkillPath() {
4647
4673
  join9(process.env.HOME ?? "", ".agents", "skills", "relay-agent-comms", "SKILL.md")
4648
4674
  ];
4649
4675
  for (const path of candidatePaths) {
4650
- if (existsSync6(path)) {
4676
+ if (existsSync7(path)) {
4651
4677
  return path;
4652
4678
  }
4653
4679
  }
@@ -5168,7 +5194,7 @@ var init_local_agents = __esm(async () => {
5168
5194
  });
5169
5195
 
5170
5196
  // apps/desktop/src/server/create-scout-control-plane-server.ts
5171
- import { existsSync as existsSync8 } from "fs";
5197
+ import { existsSync as existsSync9 } from "fs";
5172
5198
  import { dirname as dirname8, resolve as resolve6 } from "path";
5173
5199
  import { fileURLToPath as fileURLToPath6 } from "url";
5174
5200
 
@@ -6716,9 +6742,9 @@ import { spawn } from "child_process";
6716
6742
  import {
6717
6743
  accessSync,
6718
6744
  constants,
6719
- existsSync as existsSync4,
6745
+ existsSync as existsSync5,
6720
6746
  mkdirSync as mkdirSync2,
6721
- readFileSync as readFileSync2,
6747
+ readFileSync as readFileSync3,
6722
6748
  statSync as statSync2,
6723
6749
  unlinkSync,
6724
6750
  writeFileSync as writeFileSync2
@@ -6790,16 +6816,16 @@ function extractPendingApprovalRequests(snapshot) {
6790
6816
  }
6791
6817
 
6792
6818
  // apps/desktop/src/shared/paths.ts
6793
- import { existsSync as existsSync3, readFileSync } from "fs";
6819
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
6794
6820
  import { dirname as dirname4, join as join5, resolve as resolve3 } from "path";
6795
6821
  import { fileURLToPath as fileURLToPath3 } from "url";
6796
6822
  function looksLikeWorkspaceRoot(candidate) {
6797
6823
  const packageJsonPath = join5(candidate, "package.json");
6798
- if (!existsSync3(packageJsonPath)) {
6824
+ if (!existsSync4(packageJsonPath)) {
6799
6825
  return false;
6800
6826
  }
6801
6827
  try {
6802
- const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
6828
+ const parsed = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
6803
6829
  return Array.isArray(parsed.workspaces);
6804
6830
  } catch {
6805
6831
  return false;
@@ -6807,11 +6833,11 @@ function looksLikeWorkspaceRoot(candidate) {
6807
6833
  }
6808
6834
  function looksLikePackagedAppRoot(candidate) {
6809
6835
  const packageJsonPath = join5(candidate, "package.json");
6810
- if (!existsSync3(packageJsonPath)) {
6836
+ if (!existsSync4(packageJsonPath)) {
6811
6837
  return false;
6812
6838
  }
6813
6839
  try {
6814
- const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
6840
+ const parsed = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
6815
6841
  return parsed.name === "@scout/electron-app";
6816
6842
  } catch {
6817
6843
  return false;
@@ -6819,18 +6845,18 @@ function looksLikePackagedAppRoot(candidate) {
6819
6845
  }
6820
6846
  function looksLikeInstalledCliRoot(candidate) {
6821
6847
  const packageJsonPath = join5(candidate, "package.json");
6822
- if (!existsSync3(packageJsonPath)) {
6848
+ if (!existsSync4(packageJsonPath)) {
6823
6849
  return false;
6824
6850
  }
6825
6851
  try {
6826
- const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
6852
+ const parsed = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
6827
6853
  return parsed.name === "@openscout/scout" || parsed.name === "@openscout/cli";
6828
6854
  } catch {
6829
6855
  return false;
6830
6856
  }
6831
6857
  }
6832
6858
  function looksLikeSourceAppRoot(candidate) {
6833
- return existsSync3(join5(candidate, "bin", "scout.ts"));
6859
+ return existsSync4(join5(candidate, "bin", "scout.ts"));
6834
6860
  }
6835
6861
  function findMatchingAncestor(startDirectory, predicate) {
6836
6862
  let current = resolve3(startDirectory);
@@ -7066,11 +7092,11 @@ async function loadScoutPairingPendingApprovals(port) {
7066
7092
  }
7067
7093
  function loadScoutPairingConfig() {
7068
7094
  const { configPath } = resolveScoutPairingPaths();
7069
- if (!existsSync4(configPath)) {
7095
+ if (!existsSync5(configPath)) {
7070
7096
  return {};
7071
7097
  }
7072
7098
  try {
7073
- const payload = JSON.parse(readFileSync2(configPath, "utf8"));
7099
+ const payload = JSON.parse(readFileSync3(configPath, "utf8"));
7074
7100
  return typeof payload === "object" && payload ? payload : {};
7075
7101
  } catch {
7076
7102
  return {};
@@ -7101,11 +7127,11 @@ async function resolveDefaultScoutPairingWorkspaceRoot(currentDirectory) {
7101
7127
  }
7102
7128
  function readScoutPairingRuntimeSnapshot() {
7103
7129
  const { runtimeStatePath } = resolveScoutPairingPaths();
7104
- if (!existsSync4(runtimeStatePath)) {
7130
+ if (!existsSync5(runtimeStatePath)) {
7105
7131
  return null;
7106
7132
  }
7107
7133
  try {
7108
- const parsed = JSON.parse(readFileSync2(runtimeStatePath, "utf8"));
7134
+ const parsed = JSON.parse(readFileSync3(runtimeStatePath, "utf8"));
7109
7135
  return parsed?.version === SCOUT_PAIRING_RUNTIME_VERSION ? parsed : null;
7110
7136
  } catch {
7111
7137
  return null;
@@ -7119,11 +7145,11 @@ function clearScoutPairingRuntimeSnapshot() {
7119
7145
  }
7120
7146
  function readScoutPairingRuntimePid() {
7121
7147
  const { runtimePidPath } = resolveScoutPairingPaths();
7122
- if (!existsSync4(runtimePidPath)) {
7148
+ if (!existsSync5(runtimePidPath)) {
7123
7149
  return null;
7124
7150
  }
7125
7151
  try {
7126
- const raw2 = readFileSync2(runtimePidPath, "utf8").trim();
7152
+ const raw2 = readFileSync3(runtimePidPath, "utf8").trim();
7127
7153
  const pid = Number(raw2);
7128
7154
  return Number.isInteger(pid) && pid > 0 ? pid : null;
7129
7155
  } catch {
@@ -7175,22 +7201,22 @@ function clearStaleScoutPairingRuntimeFiles() {
7175
7201
  clearScoutPairingRuntimeSnapshot();
7176
7202
  }
7177
7203
  function readScoutPairingIdentityFingerprint(identityPath) {
7178
- if (!existsSync4(identityPath)) {
7204
+ if (!existsSync5(identityPath)) {
7179
7205
  return null;
7180
7206
  }
7181
7207
  try {
7182
- const payload = JSON.parse(readFileSync2(identityPath, "utf8"));
7208
+ const payload = JSON.parse(readFileSync3(identityPath, "utf8"));
7183
7209
  return typeof payload.publicKey === "string" && payload.publicKey.length > 0 ? payload.publicKey.slice(0, 16) : null;
7184
7210
  } catch {
7185
7211
  return null;
7186
7212
  }
7187
7213
  }
7188
7214
  function readScoutPairingTrustedPeerCount(trustedPeersPath) {
7189
- if (!existsSync4(trustedPeersPath)) {
7215
+ if (!existsSync5(trustedPeersPath)) {
7190
7216
  return 0;
7191
7217
  }
7192
7218
  try {
7193
- const payload = JSON.parse(readFileSync2(trustedPeersPath, "utf8"));
7219
+ const payload = JSON.parse(readFileSync3(trustedPeersPath, "utf8"));
7194
7220
  return Array.isArray(payload) ? payload.length : 0;
7195
7221
  } catch {
7196
7222
  return 0;
@@ -7212,11 +7238,11 @@ function formatScoutPairingHistoryTimestamp(value) {
7212
7238
  }).format(date);
7213
7239
  }
7214
7240
  function readScoutPairingTrustedPeers(trustedPeersPath) {
7215
- if (!existsSync4(trustedPeersPath)) {
7241
+ if (!existsSync5(trustedPeersPath)) {
7216
7242
  return [];
7217
7243
  }
7218
7244
  try {
7219
- const payload = JSON.parse(readFileSync2(trustedPeersPath, "utf8"));
7245
+ const payload = JSON.parse(readFileSync3(trustedPeersPath, "utf8"));
7220
7246
  if (!Array.isArray(payload)) {
7221
7247
  return [];
7222
7248
  }
@@ -7240,7 +7266,7 @@ function readScoutPairingTrustedPeers(trustedPeersPath) {
7240
7266
  }
7241
7267
  }
7242
7268
  function readScoutPairingLogTail(logPath) {
7243
- if (!existsSync4(logPath)) {
7269
+ if (!existsSync5(logPath)) {
7244
7270
  return {
7245
7271
  body: "",
7246
7272
  updatedAtLabel: null,
@@ -7248,7 +7274,7 @@ function readScoutPairingLogTail(logPath) {
7248
7274
  truncated: false
7249
7275
  };
7250
7276
  }
7251
- const body = readFileSync2(logPath, "utf8");
7277
+ const body = readFileSync3(logPath, "utf8");
7252
7278
  const lines = body.split(/\r?\n/g);
7253
7279
  const visibleLines = lines.slice(-SCOUT_PAIRING_LOG_TAIL_LINE_LIMIT);
7254
7280
  const stats = statSync2(logPath);
@@ -7319,7 +7345,7 @@ function resolveScoutPairingRuntimeScriptPath() {
7319
7345
  join6(appRoot, "..", "..", "packages", "electron-app", "dist", "electron", SCOUT_PAIRING_RUNTIME_SCRIPT.replace(/\.ts$/, ".js"))
7320
7346
  ];
7321
7347
  for (const candidate of candidates) {
7322
- if (existsSync4(candidate)) {
7348
+ if (existsSync5(candidate)) {
7323
7349
  return candidate;
7324
7350
  }
7325
7351
  }
@@ -8032,7 +8058,7 @@ function createScoutVoiceState(input = {}) {
8032
8058
  // apps/desktop/src/app/desktop/shell-probes.ts
8033
8059
  init_setup();
8034
8060
  init_support_paths();
8035
- import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
8061
+ import { existsSync as existsSync8, readFileSync as readFileSync6 } from "fs";
8036
8062
  import path2 from "path";
8037
8063
 
8038
8064
  // apps/desktop/src/app/desktop/shell-utils.ts
@@ -8117,7 +8143,7 @@ var PROJECT_GIT_ACTIVITY_CACHE_TTL_MS = 60000;
8117
8143
  var projectGitActivityCache = new Map;
8118
8144
  function readHelperStatus() {
8119
8145
  const statusPath = resolveOpenScoutSupportPaths().desktopStatusPath;
8120
- if (!existsSync7(statusPath)) {
8146
+ if (!existsSync8(statusPath)) {
8121
8147
  return {
8122
8148
  running: false,
8123
8149
  detail: null,
@@ -8125,7 +8151,7 @@ function readHelperStatus() {
8125
8151
  };
8126
8152
  }
8127
8153
  try {
8128
- const raw2 = JSON.parse(readFileSync5(statusPath, "utf8"));
8154
+ const raw2 = JSON.parse(readFileSync6(statusPath, "utf8"));
8129
8155
  return {
8130
8156
  running: raw2.state === "running",
8131
8157
  detail: typeof raw2.detail === "string" ? raw2.detail : null,
@@ -8163,7 +8189,7 @@ function readTmuxSessionOutput() {
8163
8189
  }
8164
8190
  function readDesktopSettingsRecord() {
8165
8191
  try {
8166
- return JSON.parse(readFileSync5(resolveOpenScoutSupportPaths().settingsPath, "utf8"));
8192
+ return JSON.parse(readFileSync6(resolveOpenScoutSupportPaths().settingsPath, "utf8"));
8167
8193
  } catch {
8168
8194
  return {};
8169
8195
  }
@@ -10507,7 +10533,7 @@ function resolveStaticRoot(staticRoot) {
10507
10533
  return configured;
10508
10534
  }
10509
10535
  const bundled = resolveBundledControlPlaneStaticClientRoot(import.meta.url);
10510
- if (existsSync8(resolve6(bundled, "index.html"))) {
10536
+ if (existsSync9(resolve6(bundled, "index.html"))) {
10511
10537
  return bundled;
10512
10538
  }
10513
10539
  return defaultMonorepoControlPlaneStaticClientRoot(import.meta.url);