@agent-team-foundation/first-tree-hub 0.9.10 → 0.9.11

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.
@@ -1,5 +1,5 @@
1
1
  import { d as __exportAll } from "./esm-CYu4tXXn.mjs";
2
- import { c as logFormatSchema, l as logLevelSchema } from "./logger-core-BTmvdflj-DhdipBkV.mjs";
2
+ import { o as logFormatSchema, s as logLevelSchema } from "./logger-core-BTmvdflj-DjW8FM4T.mjs";
3
3
  import { z } from "zod";
4
4
  import { dirname, join } from "node:path";
5
5
  import { homedir } from "node:os";
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import "../observability-DV_fQKqV-CuLWzBxQ.mjs";
3
- import { $ as configureClientLoggerForService, A as checkServerHealth, B as createOwner, C as runMigrations, D as checkDocker, E as checkDatabase, G as setJsonMode, H as resolveReplyToFromEnv, I as stopPostgres, J as FirstTreeHubSDK, L as ClientRuntime, M as checkWebSocket, N as printResults, O as checkNodeVersion, Q as applyClientLoggerConfig, R as handleClientOrgMismatch, S as uninstallClientService, T as checkClientConfig, W as print, X as SessionRegistry, Y as SdkError, Z as cleanWorkspaces, _ as runHomeMigration, a as showServiceLogs, b as isServiceSupported, c as COMMAND_VERSION, d as promptMissingFields, f as formatCheckReport, g as saveOnboardState, h as onboardCreate, i as parseDuration, j as checkServerReachable, k as checkServerConfig, l as isInteractive, m as onboardCheck, n as declineUpdate, o as validateLevel, p as loadOnboardState, q as ClientOrgMismatchError, r as promptUpdate, s as startServer, t as createExecuteUpdate, u as promptAddAgent, v as getClientServiceStatus, w as checkAgentConfigs, y as installClientService } from "../core-BWaSYpXv.mjs";
4
- import "../logger-core-BTmvdflj-DhdipBkV.mjs";
5
- import { C as serverConfigSchema, _ as loadAgents, b as resetConfig, c as saveCredentials, d as DEFAULT_HOME_DIR, f as agentConfigSchema, g as initConfig, h as getConfigValue, i as loadCredentials, l as DEFAULT_CONFIG_DIR, n as ensureFreshAccessToken, o as resolveServerUrl, p as clientConfigSchema, r as ensureFreshAdminToken, s as saveAgentConfig, u as DEFAULT_DATA_DIR, w as setConfigValue, x as resetConfigMeta, y as readConfigFile } from "../bootstrap-hh_PkTu6.mjs";
6
- import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-BJaN64iR.mjs";
2
+ import "../observability-DV_fQKqV-oxfXX6Z2.mjs";
3
+ import { B as resolveReplyToFromEnv, C as checkServerHealth, D as getClientServiceStatus, E as printResults, F as ClientRuntime, G as ClientOrgMismatchError, H as print, I as handleClientOrgMismatch, J as SessionRegistry, K as FirstTreeHubSDK, O as installClientService, P as stopPostgres, R as createOwner, S as checkServerConfig, T as checkWebSocket, U as setJsonMode, X as applyClientLoggerConfig, Y as cleanWorkspaces, Z as configureClientLoggerForService, _ as checkBackgroundService, a as COMMAND_VERSION, b as checkDocker, c as promptMissingFields, d as onboardCheck, f as onboardCreate, g as checkAgentConfigs, h as runMigrations, i as startServer, k as isServiceSupported, l as formatCheckReport, m as runHomeMigration, n as declineUpdate, o as isInteractive, p as saveOnboardState, q as SdkError, r as promptUpdate, s as promptAddAgent, t as createExecuteUpdate, u as loadOnboardState, v as checkClientConfig, w as checkServerReachable, x as checkNodeVersion, y as checkDatabase } from "../core-CuSIXoof.mjs";
4
+ import "../logger-core-BTmvdflj-DjW8FM4T.mjs";
5
+ import { C as serverConfigSchema, _ as loadAgents, b as resetConfig, c as saveCredentials, d as DEFAULT_HOME_DIR, f as agentConfigSchema, g as initConfig, h as getConfigValue, i as loadCredentials, l as DEFAULT_CONFIG_DIR, n as ensureFreshAccessToken, o as resolveServerUrl, p as clientConfigSchema, r as ensureFreshAdminToken, s as saveAgentConfig, u as DEFAULT_DATA_DIR, w as setConfigValue, x as resetConfigMeta, y as readConfigFile } from "../bootstrap-CtVqQA8a.mjs";
6
+ import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-B2sjp6Z6.mjs";
7
7
  import { join } from "node:path";
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from "node:fs";
9
9
  import { Command } from "commander";
@@ -1031,7 +1031,8 @@ function registerClientCommands(program) {
1031
1031
  checkClientConfig(),
1032
1032
  await checkServerReachable(),
1033
1033
  checkAgentConfigs(),
1034
- await checkWebSocket()
1034
+ await checkWebSocket(),
1035
+ checkBackgroundService()
1035
1036
  ]);
1036
1037
  });
1037
1038
  client.command("stop").description("Stop the client (sends SIGTERM to running process)").action(() => {
@@ -1056,62 +1057,6 @@ function registerClientCommands(program) {
1056
1057
  print.line(" No agents directory found.\n");
1057
1058
  }
1058
1059
  });
1059
- const service = client.command("service").description("Install/uninstall the background service that keeps this computer online");
1060
- service.command("install").description("Install as a background service — auto-starts on login/boot").action(() => {
1061
- if (!isServiceSupported()) {
1062
- print.line(` Background service is not supported on ${process.platform}.\n Run \`first-tree-hub client start\` manually to keep the computer online.
1063
- `);
1064
- process.exit(1);
1065
- }
1066
- try {
1067
- const info = installClientService();
1068
- print.line(`\n \u2713 Installed as a background service (${info.platform}).\n`);
1069
- print.line(` Unit: ${info.unitPath}\n`);
1070
- print.line(` Logs: ${info.logDir}\n`);
1071
- if (info.state === "active") print.line(` State: running${info.detail ? ` (${info.detail})` : ""}\n`);
1072
- else print.line(` State: ${info.state}${info.detail ? ` (${info.detail})` : ""}\n`);
1073
- print.line("\n You can close this terminal — the computer stays online.\n");
1074
- } catch (error) {
1075
- fail("SERVICE_INSTALL_ERROR", error instanceof Error ? error.message : String(error));
1076
- }
1077
- });
1078
- service.command("status").description("Show background service state").action(() => {
1079
- const info = getClientServiceStatus();
1080
- if (info.platform === "unsupported") {
1081
- print.line(` Not supported on ${process.platform}.\n`);
1082
- return;
1083
- }
1084
- print.line(`\n ${info.platform}: ${info.label}\n`);
1085
- print.line(` Unit: ${info.unitPath}\n`);
1086
- print.line(` Logs: ${info.logDir}\n`);
1087
- print.line(` State: ${info.state}${info.detail ? ` (${info.detail})` : ""}\n\n`);
1088
- });
1089
- service.command("uninstall").description("Stop and remove the background service").action(() => {
1090
- if (!isServiceSupported()) {
1091
- print.line(` Not supported on ${process.platform}.\n`);
1092
- return;
1093
- }
1094
- try {
1095
- const info = uninstallClientService();
1096
- print.line(`\n \u2713 Uninstalled background service (${info.platform}).\n\n`);
1097
- } catch (error) {
1098
- fail("SERVICE_UNINSTALL_ERROR", error instanceof Error ? error.message : String(error));
1099
- }
1100
- });
1101
- service.command("logs").description("Read background-service logs (pretty by default)").option("-f, --tail", "follow new lines as they arrive (Ctrl+C to stop)", false).option("--since <duration>", "only show records newer than duration (e.g. 10s, 5m, 2h, 1d)").option("--level <level>", "minimum level (trace|debug|info|warn|error|fatal)").option("--json", "emit raw NDJSON lines instead of pretty formatting", false).action(async (options) => {
1102
- try {
1103
- const level = validateLevel(options.level);
1104
- const sinceMs = options.since ? parseDuration(options.since) : void 0;
1105
- await showServiceLogs({
1106
- tail: options.tail === true,
1107
- level,
1108
- sinceMs,
1109
- json: options.json === true
1110
- });
1111
- } catch (error) {
1112
- fail("SERVICE_LOGS_ERROR", error instanceof Error ? error.message : String(error));
1113
- }
1114
- });
1115
1060
  client.command("hub-list").description("List clients on the Hub server").option("--server <url>", "Hub server URL").action(async (options) => {
1116
1061
  try {
1117
1062
  const serverUrl = resolveServerUrl(options.server);
@@ -1262,13 +1207,13 @@ function isSecretField(schema, dotPath) {
1262
1207
  //#region src/commands/onboard.ts
1263
1208
  async function promptMissing(args) {
1264
1209
  if (!args.server) try {
1265
- const { resolveServerUrl } = await import("../bootstrap-hh_PkTu6.mjs").then((n) => n.t);
1210
+ const { resolveServerUrl } = await import("../bootstrap-CtVqQA8a.mjs").then((n) => n.t);
1266
1211
  resolveServerUrl();
1267
1212
  } catch {
1268
1213
  args.server = await input({ message: "Hub server URL:" });
1269
1214
  saveOnboardState(args);
1270
1215
  }
1271
- const { loadCredentials } = await import("../bootstrap-hh_PkTu6.mjs").then((n) => n.t);
1216
+ const { loadCredentials } = await import("../bootstrap-CtVqQA8a.mjs").then((n) => n.t);
1272
1217
  if (!loadCredentials()) throw new Error("No saved credentials. Run `first-tree-hub client connect <server-url>` before onboarding.");
1273
1218
  if (!args.id) {
1274
1219
  args.id = await input({ message: "Agent ID:" });