@agent-team-foundation/first-tree-hub 0.14.9-alpha.294.1 → 0.14.9-alpha.295.1

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
  #!/usr/bin/env node
2
- import { $ as cleanWorkspaces, A as printResults, B as ClientRuntime, C as migrateLocalAgentDirs, D as checkNodeVersion, E as checkClientConfig, G as removeLocalAgent, I as restartClientService, J as ClientOrgMismatchError, K as fail, L as startClientService, M as getClientServiceStatus, N as installClientService, O as checkServerReachable, P as isServiceSupported, Q as SessionRegistry, R as stopClientService, S as createApiNameResolver, T as checkBackgroundService, U as findStaleAliases, V as handleClientOrgMismatch, W as formatStaleReason, X as FirstTreeHubSDK, Y as ClientUserMismatchError, Z as SdkError, _ as loadOnboardState, a as declineUpdate, b as saveOnboardState, c as detectInstallMode, d as reconcileLocalRuntimeProviders, et as probeCapabilities, f as uploadClientCapabilities, g as formatCheckReport, h as promptMissingFields, i as createExecuteUpdate, j as reconcileAgentConfigs, k as checkWebSocket, l as fetchLatestVersion, m as promptAddAgent, nt as configureClientLoggerForService, o as promptUpdate, p as isInteractive, q as success, r as registerSaaSConnectCommand, s as PACKAGE_NAME, tt as applyClientLoggerConfig, u as installGlobalLatest, v as onboardCheck, w as checkAgentConfigs, x as runHomeMigration, y as onboardCreate } from "../saas-connect-DzbieDfo.mjs";
2
+ import { $ as cleanWorkspaces, A as printResults, B as ClientRuntime, C as migrateLocalAgentDirs, D as checkNodeVersion, E as checkClientConfig, G as removeLocalAgent, I as restartClientService, J as ClientOrgMismatchError, K as fail, L as startClientService, M as getClientServiceStatus, N as installClientService, O as checkServerReachable, P as isServiceSupported, Q as SessionRegistry, R as stopClientService, S as createApiNameResolver, T as checkBackgroundService, U as findStaleAliases, V as handleClientOrgMismatch, W as formatStaleReason, X as FirstTreeHubSDK, Y as ClientUserMismatchError, Z as SdkError, _ as loadOnboardState, a as declineUpdate, b as saveOnboardState, c as detectInstallMode, d as reconcileLocalRuntimeProviders, et as probeCapabilities, f as uploadClientCapabilities, g as formatCheckReport, h as promptMissingFields, i as createExecuteUpdate, j as reconcileAgentConfigs, k as checkWebSocket, l as fetchLatestVersion, m as promptAddAgent, nt as configureClientLoggerForService, o as promptUpdate, p as isInteractive, q as success, r as registerSaaSConnectCommand, s as PACKAGE_NAME, tt as applyClientLoggerConfig, u as installGlobalLatest, v as onboardCheck, w as checkAgentConfigs, x as runHomeMigration, y as onboardCreate } from "../saas-connect-BmeP5HSY.mjs";
3
3
  import { C as resolveConfigReadonly, S as resetConfigMeta, _ as initConfig, a as loadCredentials, b as readConfigFile, c as saveAgentConfig, d as DEFAULT_DATA_DIR, f as DEFAULT_HOME_DIR, g as getConfigValue, i as ensureFreshAdminToken, m as clientConfigSchema, p as agentConfigSchema, r as ensureFreshAccessToken, s as resolveServerUrl, u as DEFAULT_CONFIG_DIR, v as loadAgents, w as setConfigValue, x as resetConfig } from "../bootstrap-D6RsdtJg.mjs";
4
4
  import { a as print, n as CLI_USER_AGENT, o as setJsonMode, r as COMMAND_VERSION, t as cliFetch } from "../cli-fetch-BGVItZxo.mjs";
5
5
  import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-CwD_5b9W.mjs";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as printResults, B as ClientRuntime, D as checkNodeVersion, E as checkClientConfig, F as resolveCliInvocation, H as rotateClientIdWithBackup, I as restartClientService, L as startClientService, M as getClientServiceStatus, N as installClientService, O as checkServerReachable, P as isServiceSupported, R as stopClientService, V as handleClientOrgMismatch, X as FirstTreeHubSDK, Z as SdkError, g as formatCheckReport, h as promptMissingFields, k as checkWebSocket, m as promptAddAgent, n as deriveHubUrlFromToken, p as isInteractive, t as HubUrlDerivationError, v as onboardCheck, w as checkAgentConfigs, x as runHomeMigration, y as onboardCreate, z as uninstallClientService } from "./saas-connect-DzbieDfo.mjs";
1
+ import { A as printResults, B as ClientRuntime, D as checkNodeVersion, E as checkClientConfig, F as resolveCliInvocation, H as rotateClientIdWithBackup, I as restartClientService, L as startClientService, M as getClientServiceStatus, N as installClientService, O as checkServerReachable, P as isServiceSupported, R as stopClientService, V as handleClientOrgMismatch, X as FirstTreeHubSDK, Z as SdkError, g as formatCheckReport, h as promptMissingFields, k as checkWebSocket, m as promptAddAgent, n as deriveHubUrlFromToken, p as isInteractive, t as HubUrlDerivationError, v as onboardCheck, w as checkAgentConfigs, x as runHomeMigration, y as onboardCreate, z as uninstallClientService } from "./saas-connect-BmeP5HSY.mjs";
2
2
  import { i as ensureFreshAdminToken, n as AuthRefreshRateLimitedError, o as resolveAccessToken, r as ensureFreshAccessToken, s as resolveServerUrl, t as AuthRefreshFailedError } from "./bootstrap-D6RsdtJg.mjs";
3
3
  import { i as blank, s as status } from "./cli-fetch-BGVItZxo.mjs";
4
4
  import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-CwD_5b9W.mjs";
@@ -10398,12 +10398,32 @@ var SessionRegistry = class {
10398
10398
  }
10399
10399
  }
10400
10400
  };
10401
- function documentBasePathFromRuntimeConfig(payload) {
10402
- if (payload.gitRepos.length !== 1) return null;
10403
- const repo = payload.gitRepos[0];
10404
- if (!repo) return null;
10405
- const localPath = repoLocalPath(repo).trim();
10406
- return localPath.length > 0 ? localPath : null;
10401
+ /**
10402
+ * Resolve the base path the runtime reads markdown doc snapshots against.
10403
+ *
10404
+ * NEVER returns null — every chat has a workspace, and the snapshot scanner
10405
+ * existence-checks each candidate inside the returned root, so a bare mention
10406
+ * that doesn't physically exist simply stays plain text rather than
10407
+ * mis-resolving. Previously this returned null for zero/multi-repo
10408
+ * workspaces, which left those messages with no `documentContext` at all, so
10409
+ * a doc the agent wrote in the workspace could never be previewed.
10410
+ *
10411
+ * Resolution:
10412
+ * - exactly one repo → that repo's worktree, the unambiguous markdown-link
10413
+ * root. The worktree is materialised at `<perChatRoot>/<localPath>`, so the
10414
+ * base MUST be that ABSOLUTE path. Returning a bare relative `localPath`
10415
+ * (the old behaviour) made the runtime resolve it against its own
10416
+ * `process.cwd()` — the launch dir, not the per-chat workspace — so it
10417
+ * silently failed to find any doc and cloud preview was dead.
10418
+ * - zero or multiple repos → the per-chat workspace root.
10419
+ */
10420
+ function documentBasePathFromRuntimeConfig(payload, perChatRoot) {
10421
+ if (payload.gitRepos.length === 1) {
10422
+ const repo = payload.gitRepos[0];
10423
+ const localPath = repo ? repoLocalPath(repo).trim() : "";
10424
+ if (localPath.length > 0) return join(perChatRoot, localPath);
10425
+ }
10426
+ return perChatRoot;
10407
10427
  }
10408
10428
  function repoLocalPath(repo) {
10409
10429
  return repo.localPath ?? deriveRepoLocalPath(repo.url);
@@ -10886,7 +10906,7 @@ var SessionManager = class {
10886
10906
  this.currentTrigger.delete(chatId);
10887
10907
  },
10888
10908
  log,
10889
- getDocumentBasePath: () => this.resolveDocumentBasePath(log)
10909
+ getDocumentBasePath: () => this.resolveDocumentBasePath(log, chatId)
10890
10910
  });
10891
10911
  const envCtx = {
10892
10912
  sdk: this.config.sdk,
@@ -10914,14 +10934,15 @@ var SessionManager = class {
10914
10934
  resolveSenderLabel: async (senderId) => resolveSenderLabel(senderId, await participants.get())
10915
10935
  };
10916
10936
  }
10917
- async resolveDocumentBasePath(log) {
10918
- if (!this.config.agentConfigCache) return null;
10937
+ async resolveDocumentBasePath(log, chatId) {
10938
+ const perChatRoot = join(this.config.handlerConfig.workspaceRoot, chatId);
10939
+ if (!this.config.agentConfigCache) return perChatRoot;
10919
10940
  try {
10920
10941
  const { payload } = await this.config.agentConfigCache.refreshIfNewer(this.config.agentIdentity.agentId, 0);
10921
- return documentBasePathFromRuntimeConfig(payload);
10942
+ return documentBasePathFromRuntimeConfig(payload, perChatRoot);
10922
10943
  } catch (err) {
10923
- log(`document preview base path unavailable: ${err instanceof Error ? err.message : String(err)}`);
10924
- return null;
10944
+ log(`document preview base path: config unavailable, using workspace root: ${err instanceof Error ? err.message : String(err)}`);
10945
+ return perChatRoot;
10925
10946
  }
10926
10947
  }
10927
10948
  /** Update per-session runtime state and recompute aggregate. Only active sessions may update. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-team-foundation/first-tree-hub",
3
- "version": "0.14.9-alpha.294.1",
3
+ "version": "0.14.9-alpha.295.1",
4
4
  "type": "module",
5
5
  "description": "First Tree Hub — unified CLI for client and agent management",
6
6
  "exports": {