@agent-team-foundation/first-tree-hub 0.9.7 → 0.9.9

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.
@@ -590,6 +590,22 @@ const serverConfigSchema = defineConfig({
590
590
  }),
591
591
  hubPublicUrl: field(z.string(), { env: "FIRST_TREE_HUB_PUBLIC_URL" })
592
592
  }),
593
+ feedback: optional({
594
+ repo: field(z.string(), { env: "HEARBACK_FEEDBACK_REPO" }),
595
+ githubToken: field(z.string(), {
596
+ env: "HEARBACK_GITHUB_TOKEN",
597
+ secret: true
598
+ }),
599
+ llm: optional({
600
+ apiKey: field(z.string(), {
601
+ env: "LLM_API_KEY",
602
+ secret: true
603
+ }),
604
+ baseUrl: field(z.string().optional(), { env: "LLM_BASE_URL" }),
605
+ model: field(z.string().optional(), { env: "LLM_MODEL" })
606
+ }),
607
+ trustProxyHeaders: field(z.boolean().default(false), { env: "HEARBACK_TRUST_PROXY_HEADERS" })
608
+ }),
593
609
  observability: {
594
610
  logging: {
595
611
  level: field(logLevelSchema.default("info"), { env: "FIRST_TREE_HUB_LOG_LEVEL" }),
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import "../observability-DV_fQKqV-CuLWzBxQ.mjs";
3
- import { A as checkServerHealth, C as runMigrations, D as checkDocker, E as checkDatabase, G as SdkError, H as setJsonMode, I as stopPostgres, J as applyClientLoggerConfig, K as SessionRegistry, L as ClientRuntime, M as checkWebSocket, N as printResults, O as checkNodeVersion, R as createOwner, S as uninstallClientService, T as checkClientConfig, V as print, W as FirstTreeHubSDK, Y as configureClientLoggerForService, _ 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 cleanWorkspaces, r as promptUpdate, s as startServer, t as createExecuteUpdate, u as promptAddAgent, v as getClientServiceStatus, w as checkAgentConfigs, y as installClientService } from "../core-USyOOh7y.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-B2YUTpgg.mjs";
4
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-DWifXj9b.mjs";
6
- import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-GlaczcVf.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-B1Kiq7S6.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";
@@ -351,7 +351,7 @@ function registerAgentCommands(program) {
351
351
  print.line(" No agents configured.\n");
352
352
  return;
353
353
  }
354
- for (const [name, config] of agents) print.line(` ${name.padEnd(20)} runtime: ${config.runtime.padEnd(14)} agentId: ${config.agentId}\n`);
354
+ for (const [name, config] of agents) print.line(` ${name.padEnd(20)} runtime: ${config.runtime.padEnd(14)} uuid: ${config.agentId}\n`);
355
355
  } catch {
356
356
  print.line(" No agents configured.\n");
357
357
  }
@@ -499,21 +499,25 @@ function registerAgentCommands(program) {
499
499
  } catch {
500
500
  fail("INVALID_METADATA", "Metadata must be valid JSON.", 2);
501
501
  }
502
+ const { replyToInbox, replyToChat } = resolveReplyToFromEnv(process.env, {
503
+ replyToInbox: options.replyToInbox,
504
+ replyToChat: options.replyToChat
505
+ });
502
506
  const sdk = createSdk(options.agent);
503
507
  if (options.chat) success(await sdk.sendMessage(target, {
504
508
  format: options.format,
505
509
  content,
506
510
  metadata,
507
511
  inReplyTo: options.replyTo,
508
- replyToInbox: options.replyToInbox,
509
- replyToChat: options.replyToChat
512
+ replyToInbox,
513
+ replyToChat
510
514
  }));
511
515
  else success(await sdk.sendToAgent(target, {
512
516
  format: options.format,
513
517
  content,
514
518
  metadata,
515
- replyToInbox: options.replyToInbox,
516
- replyToChat: options.replyToChat
519
+ replyToInbox,
520
+ replyToChat
517
521
  }));
518
522
  } catch (error) {
519
523
  handleSdkError(error);
@@ -947,6 +951,11 @@ function registerConnectCommand(parent) {
947
951
  print.line("\n Cancelled.\n");
948
952
  return;
949
953
  }
954
+ if (error instanceof ClientOrgMismatchError) await handleClientOrgMismatch(error, {
955
+ managed: false,
956
+ configDir: DEFAULT_CONFIG_DIR,
957
+ rerunCommand: `first-tree-hub client connect ${serverUrl}${options.token ? " --token <token>" : ""}${options.service === false ? " --no-service" : ""}`
958
+ });
950
959
  const msg = error instanceof Error ? error.message : String(error);
951
960
  print.line(` Error: ${msg}\n`);
952
961
  process.exit(1);
@@ -1002,6 +1011,11 @@ function registerClientCommands(program) {
1002
1011
  process.on("SIGTERM", () => void shutdown());
1003
1012
  await new Promise(() => {});
1004
1013
  } catch (error) {
1014
+ if (error instanceof ClientOrgMismatchError) await handleClientOrgMismatch(error, {
1015
+ managed: options.interactive === false,
1016
+ configDir: DEFAULT_CONFIG_DIR,
1017
+ rerunCommand: "first-tree-hub client start"
1018
+ });
1005
1019
  const msg = error instanceof Error ? error.message : String(error);
1006
1020
  print.line(` Error: ${msg}\n`);
1007
1021
  process.exit(1);
@@ -1248,13 +1262,13 @@ function isSecretField(schema, dotPath) {
1248
1262
  //#region src/commands/onboard.ts
1249
1263
  async function promptMissing(args) {
1250
1264
  if (!args.server) try {
1251
- const { resolveServerUrl } = await import("../bootstrap-DWifXj9b.mjs").then((n) => n.t);
1265
+ const { resolveServerUrl } = await import("../bootstrap-hh_PkTu6.mjs").then((n) => n.t);
1252
1266
  resolveServerUrl();
1253
1267
  } catch {
1254
1268
  args.server = await input({ message: "Hub server URL:" });
1255
1269
  saveOnboardState(args);
1256
1270
  }
1257
- const { loadCredentials } = await import("../bootstrap-DWifXj9b.mjs").then((n) => n.t);
1271
+ const { loadCredentials } = await import("../bootstrap-hh_PkTu6.mjs").then((n) => n.t);
1258
1272
  if (!loadCredentials()) throw new Error("No saved credentials. Run `first-tree-hub client connect <server-url>` before onboarding.");
1259
1273
  if (!args.id) {
1260
1274
  args.id = await input({ message: "Agent ID:" });