@agent-team-foundation/first-tree-hub 0.14.1 → 0.14.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.
@@ -570,13 +570,6 @@ const serverConfigSchema = defineConfig({
570
570
  refreshTokenExpiry: field(z.string().default("30d"), { env: "FIRST_TREE_HUB_AUTH_REFRESH_TOKEN_EXPIRY" }),
571
571
  connectTokenExpiry: field(z.string().default("10m"), { env: "FIRST_TREE_HUB_AUTH_CONNECT_TOKEN_EXPIRY" })
572
572
  },
573
- contextTreeSync: optional({
574
- githubToken: field(z.string(), {
575
- env: "FIRST_TREE_HUB_CONTEXT_TREE_GITHUB_TOKEN",
576
- secret: true
577
- }),
578
- githubTokenRepos: field(z.string().optional(), { env: "FIRST_TREE_HUB_CONTEXT_TREE_GITHUB_TOKEN_REPOS" })
579
- }),
580
573
  oauth: optional({ githubApp: optional({
581
574
  appId: field(z.string().min(1), { env: "FIRST_TREE_HUB_GITHUB_APP_ID" }),
582
575
  clientId: field(z.string().min(1), { env: "FIRST_TREE_HUB_GITHUB_APP_CLIENT_ID" }),
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import "../observability-BAScT_5S-BcW9HgkG.mjs";
3
- import { $ as formatStaleReason, A as checkDocker, B as isServiceSupported, C as createApiNameResolver, D as checkBackgroundService, E as checkAgentConfigs, F as checkWebSocket, H as restartClientService, I as printResults, J as stopPostgres, L as reconcileAgentConfigs, M as checkServerConfig, N as checkServerHealth, O as checkClientConfig, P as checkServerReachable, Q as findStaleAliases, R as getClientServiceStatus, S as runHomeMigration, T as runMigrations, U as startClientService, W as stopClientService, X as handleClientOrgMismatch, Y as ClientRuntime, _ as formatCheckReport, a as declineUpdate, at as fail, b as onboardCreate, c as detectInstallMode, ct as ClientUserMismatchError, d as startServer, dt as SessionRegistry, et as removeLocalAgent, f as reconcileLocalRuntimeProviders, ft as cleanWorkspaces, g as promptMissingFields, h as promptAddAgent, ht as configureClientLoggerForService, i as createExecuteUpdate, it as resolveSenderName, j as checkNodeVersion, k as checkDatabase, l as fetchLatestVersion, lt as FirstTreeHubSDK, m as isInteractive, mt as applyClientLoggerConfig, o as promptUpdate, ot as success, p as uploadClientCapabilities, pt as probeCapabilities, r as registerSaaSConnectCommand, rt as resolveReplyToFromEnv, s as PACKAGE_NAME, st as ClientOrgMismatchError, tt as createOwner, u as installGlobalLatest, ut as SdkError, v as loadOnboardState, w as migrateLocalAgentDirs, x as saveOnboardState, y as onboardCheck, z as installClientService } from "../saas-connect-BBRxjmBS.mjs";
3
+ import { $ as formatStaleReason, A as checkDocker, B as isServiceSupported, C as createApiNameResolver, D as checkBackgroundService, E as checkAgentConfigs, F as checkWebSocket, H as restartClientService, I as printResults, J as stopPostgres, L as reconcileAgentConfigs, M as checkServerConfig, N as checkServerHealth, O as checkClientConfig, P as checkServerReachable, Q as findStaleAliases, R as getClientServiceStatus, S as runHomeMigration, T as runMigrations, U as startClientService, W as stopClientService, X as handleClientOrgMismatch, Y as ClientRuntime, _ as formatCheckReport, a as declineUpdate, at as fail, b as onboardCreate, c as detectInstallMode, ct as ClientUserMismatchError, d as startServer, dt as SessionRegistry, et as removeLocalAgent, f as reconcileLocalRuntimeProviders, ft as cleanWorkspaces, g as promptMissingFields, h as promptAddAgent, ht as configureClientLoggerForService, i as createExecuteUpdate, it as resolveSenderName, j as checkNodeVersion, k as checkDatabase, l as fetchLatestVersion, lt as FirstTreeHubSDK, m as isInteractive, mt as applyClientLoggerConfig, o as promptUpdate, ot as success, p as uploadClientCapabilities, pt as probeCapabilities, r as registerSaaSConnectCommand, rt as resolveReplyToFromEnv, s as PACKAGE_NAME, st as ClientOrgMismatchError, tt as createOwner, u as installGlobalLatest, ut as SdkError, v as loadOnboardState, w as migrateLocalAgentDirs, x as saveOnboardState, y as onboardCheck, z as installClientService } from "../saas-connect-ChxZv2YQ.mjs";
4
4
  import "../logger-core-BTmvdflj-DjW8FM4T.mjs";
5
- import { C as resetConfigMeta, E as setConfigValue, S as resetConfig, T as serverConfigSchema, _ as getConfigValue, a as ensureFreshAdminToken, c as resolveServerUrl, d as DEFAULT_CONFIG_DIR, f as DEFAULT_DATA_DIR, h as clientConfigSchema, i as ensureFreshAccessToken, l as saveAgentConfig, m as agentConfigSchema, o as loadCredentials, p as DEFAULT_HOME_DIR, v as initConfig, w as resolveConfigReadonly, x as readConfigFile, y as loadAgents } from "../bootstrap-C15ZBOCC.mjs";
5
+ import { C as resetConfigMeta, E as setConfigValue, S as resetConfig, T as serverConfigSchema, _ as getConfigValue, a as ensureFreshAdminToken, c as resolveServerUrl, d as DEFAULT_CONFIG_DIR, f as DEFAULT_DATA_DIR, h as clientConfigSchema, i as ensureFreshAccessToken, l as saveAgentConfig, m as agentConfigSchema, o as loadCredentials, p as DEFAULT_HOME_DIR, v as initConfig, w as resolveConfigReadonly, x as readConfigFile, y as loadAgents } from "../bootstrap-CQQGgIx1.mjs";
6
6
  import { a as print, n as CLI_USER_AGENT, o as setJsonMode, r as COMMAND_VERSION, t as cliFetch } from "../cli-fetch--tiwKm5S.mjs";
7
- import "../dist-1XGLJMOq.mjs";
8
- import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-BGx71p5s.mjs";
9
- import "../errors-LPcARA4K-Dbrptiyz.mjs";
7
+ import "../dist-CwsiHGX7.mjs";
8
+ import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-DHSy6WDD.mjs";
9
+ import "../uuid-DbS_4vFh-iFghv4zA.mjs";
10
10
  import "../src-DNBS5Yjj.mjs";
11
- import "../client-CzXmweS9-DhUiuQvL.mjs";
12
- import "../invitation-DZO4NX3P-BPxTeHf-.mjs";
11
+ import "../client-BSfCc0pJ-BP_1f21y.mjs";
12
+ import "../invitation-D_ENPHyj-5ETiae5r.mjs";
13
13
  import { join } from "node:path";
14
14
  import { existsSync, mkdirSync, readFileSync, readdirSync } from "node:fs";
15
15
  import * as semver from "semver";
@@ -255,11 +255,6 @@ function handleSdkError$1(error) {
255
255
  if (error instanceof TypeError && "cause" in error) fail("CONNECTION_ERROR", `Cannot connect to server: ${error.message}`, 6);
256
256
  fail("UNKNOWN_ERROR", error instanceof Error ? error.message : String(error), 1);
257
257
  }
258
- function parseLimit$1(value, max) {
259
- const limit = Number.parseInt(value, 10);
260
- if (Number.isNaN(limit) || limit < 1 || limit > max) fail("INVALID_LIMIT", `Limit must be between 1 and ${max}.`, 2);
261
- return limit;
262
- }
263
258
  async function resolveAgent$1(serverUrl, adminToken, agentName) {
264
259
  const res = await cliFetch(`${serverUrl}/api/v1/me/managed-agents`, {
265
260
  headers: { Authorization: `Bearer ${adminToken}` },
@@ -693,25 +688,13 @@ function registerAgentCommands(program) {
693
688
  fail("SESSION_CMD_ERROR", error instanceof Error ? error.message : String(error));
694
689
  }
695
690
  });
696
- const debugCmd = agent.command("debug", { hidden: true }).description("Low-level SDK debug commands");
697
- debugCmd.command("register").description("Register this agent and return identity info").option("--agent <name>", "Agent name on the Hub (default: first configured on this client)").action(async (options) => {
691
+ agent.command("debug", { hidden: true }).description("Low-level SDK debug commands").command("register").description("Register this agent and return identity info").option("--agent <name>", "Agent name on the Hub (default: first configured on this client)").action(async (options) => {
698
692
  try {
699
693
  success(await createSdk$1(options.agent).register());
700
694
  } catch (error) {
701
695
  handleSdkError$1(error);
702
696
  }
703
697
  });
704
- debugCmd.command("pull").description("Pull pending messages from inbox").option("-l, --limit <number>", "Maximum entries to return", "10").option("-a, --ack", "Automatically ACK entries after pulling").option("--agent <name>", "Agent name on the Hub (default: first configured on this client)").action(async (options) => {
705
- try {
706
- const sdk = createSdk$1(options.agent);
707
- const limit = parseLimit$1(options.limit, 50);
708
- const result = await sdk.pull(limit);
709
- if (options.ack && result.entries.length > 0) await Promise.all(result.entries.map((entry) => sdk.ack(entry.id)));
710
- success(result);
711
- } catch (error) {
712
- handleSdkError$1(error);
713
- }
714
- });
715
698
  }
716
699
  //#endregion
717
700
  //#region src/commands/chat.ts
@@ -797,7 +780,7 @@ async function resolveAgent(serverUrl, adminToken, agentName) {
797
780
  }
798
781
  function registerChatCommands(program) {
799
782
  const chat = program.command("chat").description("Chats and messaging — list, history, send, open");
800
- chat.command("send <target> [message]").description("Send a message to an agent or chat").option("-f, --format <format>", "Message format (text|markdown|card)", "text").option("--chat", "Treat target as chat ID instead of agent ID").option("-m, --metadata <json>", "JSON metadata to attach").option("--reply-to <messageId>", "Message ID to reply to").option("--reply-to-inbox <inboxId>", "Cross-chat reply target inbox").option("--reply-to-chat <chatId>", "Cross-chat reply target chat").option("--agent <name>", "Agent name on the Hub (default: first configured on this client)").action(async (target, message, options) => {
783
+ chat.command("send <agentName> [message]").description("Send a message to an agent. Defaults to your current chat; use --direct for a side conversation.").option("-f, --format <format>", "Message format (text|markdown|card)", "text").option("--direct", "Open or reuse a direct chat with the recipient (bypass member check). Use only when intentionally starting a side conversation with a non-member.").option("-m, --metadata <json>", "JSON metadata to attach").option("--reply-to <messageId>", "Message ID to reply to").option("--reply-to-inbox <inboxId>", "Cross-chat reply target inbox").option("--reply-to-chat <chatId>", "Cross-chat reply target chat").option("--agent <name>", "Agent name on the Hub (default: first configured on this client)").action(async (agentName, message, options) => {
801
784
  try {
802
785
  const content = message ?? await readStdin();
803
786
  if (!content) fail("NO_MESSAGE", "No message provided. Pass as argument or pipe via stdin.", 2);
@@ -811,21 +794,13 @@ function registerChatCommands(program) {
811
794
  replyToInbox: options.replyToInbox,
812
795
  replyToChat: options.replyToChat
813
796
  });
814
- const sdk = createSdk(options.agent);
815
- if (options.chat) success(await sdk.sendMessage(target, {
816
- format: options.format,
817
- content,
818
- metadata,
819
- inReplyTo: options.replyTo,
820
- replyToInbox,
821
- replyToChat
822
- }));
823
- else success(await sdk.sendToAgent(target, {
797
+ success(await createSdk(options.agent).sendToAgent(agentName, {
824
798
  format: options.format,
825
799
  content,
826
800
  metadata,
827
801
  replyToInbox,
828
- replyToChat
802
+ replyToChat,
803
+ direct: options.direct ?? false
829
804
  }));
830
805
  } catch (error) {
831
806
  handleSdkError(error);
@@ -1495,13 +1470,13 @@ function decodeJwtExpSeconds(token) {
1495
1470
  //#region src/commands/onboard.ts
1496
1471
  async function promptMissing(args) {
1497
1472
  if (!args.server) try {
1498
- const { resolveServerUrl } = await import("../bootstrap-C15ZBOCC.mjs").then((n) => n.r);
1473
+ const { resolveServerUrl } = await import("../bootstrap-CQQGgIx1.mjs").then((n) => n.r);
1499
1474
  resolveServerUrl();
1500
1475
  } catch {
1501
1476
  args.server = await input({ message: "Hub server URL:" });
1502
1477
  saveOnboardState(args);
1503
1478
  }
1504
- const { loadCredentials } = await import("../bootstrap-C15ZBOCC.mjs").then((n) => n.r);
1479
+ const { loadCredentials } = await import("../bootstrap-CQQGgIx1.mjs").then((n) => n.r);
1505
1480
  if (!loadCredentials()) throw new Error("No saved credentials. Run `first-tree-hub connect <token>` before onboarding.");
1506
1481
  if (!args.id) {
1507
1482
  args.id = await input({ message: "Agent ID:" });