@agent-team-foundation/first-tree-hub 0.12.0 → 0.12.2

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,14 +1,14 @@
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 success, b as onboardCreate, c as detectInstallMode, ct as FirstTreeHubSDK, d as startServer, dt as cleanWorkspaces, et as removeLocalAgent, f as reconcileLocalRuntimeProviders, ft as probeCapabilities, g as promptMissingFields, h as promptAddAgent, i as createExecuteUpdate, it as fail, j as checkNodeVersion, k as checkDatabase, l as fetchLatestVersion, lt as SdkError, m as isInteractive, mt as configureClientLoggerForService, o as promptUpdate, ot as ClientOrgMismatchError, p as uploadClientCapabilities, pt as applyClientLoggerConfig, r as registerSaaSConnectCommand, rt as resolveReplyToFromEnv, s as PACKAGE_NAME, st as ClientUserMismatchError, tt as createOwner, u as installGlobalLatest, ut as SessionRegistry, v as loadOnboardState, w as migrateLocalAgentDirs, x as saveOnboardState, y as onboardCheck, z as installClientService } from "../saas-connect-Drn9g6cR.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 success, b as onboardCreate, c as detectInstallMode, ct as FirstTreeHubSDK, d as startServer, dt as cleanWorkspaces, et as removeLocalAgent, f as reconcileLocalRuntimeProviders, ft as probeCapabilities, g as promptMissingFields, h as promptAddAgent, i as createExecuteUpdate, it as fail, j as checkNodeVersion, k as checkDatabase, l as fetchLatestVersion, lt as SdkError, m as isInteractive, mt as configureClientLoggerForService, o as promptUpdate, ot as ClientOrgMismatchError, p as uploadClientCapabilities, pt as applyClientLoggerConfig, r as registerSaaSConnectCommand, rt as resolveReplyToFromEnv, s as PACKAGE_NAME, st as ClientUserMismatchError, tt as createOwner, u as installGlobalLatest, ut as SessionRegistry, v as loadOnboardState, w as migrateLocalAgentDirs, x as saveOnboardState, y as onboardCheck, z as installClientService } from "../saas-connect-_2M4kfPR.mjs";
4
4
  import "../logger-core-BTmvdflj-DjW8FM4T.mjs";
5
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, u as saveCredentials, v as initConfig, w as resolveConfigReadonly, x as readConfigFile, y as loadAgents } from "../bootstrap-C_K2CKXC.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-UOZ6vMUW.mjs";
8
- import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-C6qlhju2.mjs";
7
+ import "../dist-DHHd2dar.mjs";
8
+ import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-fLnwqCOs.mjs";
9
9
  import "../errors-CF5evtJt-B0NTIVPt.mjs";
10
10
  import "../src-DNBS5Yjj.mjs";
11
- import "../client-BPUdUaZT-CyCrpCTP.mjs";
11
+ import "../client-DHCSQ8kg-DjlSmE9q.mjs";
12
12
  import "../invitation-Bg0TRiyx-BsZH4GCS.mjs";
13
13
  import { join } from "node:path";
14
14
  import { existsSync, mkdirSync, readFileSync, readdirSync } from "node:fs";
@@ -1,10 +1,10 @@
1
1
  import { O as withSpan, f as messageAttrs, s as createLogger } from "./observability-BAScT_5S-BcW9HgkG.mjs";
2
- import { a as AGENT_STATUSES, at as questionAnswerMessageContentSchema, dt as scanMentionTokens, ot as questionMessageContentSchema, s as AGENT_VISIBILITY, w as clientCapabilitiesSchema, z as extractMentions } from "./dist-UOZ6vMUW.mjs";
2
+ import { a as AGENT_STATUSES, at as questionAnswerMessageContentSchema, dt as scanMentionTokens, ot as questionMessageContentSchema, s as AGENT_VISIBILITY, w as clientCapabilitiesSchema, z as extractMentions } from "./dist-DHHd2dar.mjs";
3
3
  import { a as ConflictError, i as ClientUserMismatchError, l as organizations, n as BadRequestError, o as ForbiddenError, s as NotFoundError, u as users } from "./errors-CF5evtJt-B0NTIVPt.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { and, desc, eq, inArray, isNotNull, lt, ne, or, sql } from "drizzle-orm";
6
6
  import { bigserial, boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, unique } from "drizzle-orm/pg-core";
7
- //#region ../server/dist/client-BPUdUaZT.mjs
7
+ //#region ../server/dist/client-DHCSQ8kg.mjs
8
8
  /**
9
9
  * Client connections. A client is a single SDK process (AgentRuntime) that may
10
10
  * host multiple agents. From the unified-user-token milestone on, a client is
@@ -696,7 +696,7 @@ async function findOrCreateDirectChat(db, agentAId, agentBId) {
696
696
  const bChatIds = new Set(bChats.map((r) => r.chatId));
697
697
  const commonChatIds = aChats.map((r) => r.chatId).filter((id) => bChatIds.has(id));
698
698
  if (commonChatIds.length > 0) {
699
- const directChats = await db.select().from(chats).where(and(inArray(chats.id, commonChatIds), eq(chats.type, "direct")));
699
+ const directChats = await db.select().from(chats).where(and(inArray(chats.id, commonChatIds), eq(chats.type, "direct"))).orderBy(chats.createdAt, chats.id).limit(1);
700
700
  if (directChats.length > 0 && directChats[0]) return directChats[0];
701
701
  }
702
702
  const ends = await db.select({
@@ -1,7 +1,7 @@
1
1
  import "./observability-BAScT_5S-BcW9HgkG.mjs";
2
2
  import "./logger-core-BTmvdflj-DjW8FM4T.mjs";
3
- import "./dist-UOZ6vMUW.mjs";
3
+ import "./dist-DHHd2dar.mjs";
4
4
  import "./errors-CF5evtJt-B0NTIVPt.mjs";
5
5
  import "./src-DNBS5Yjj.mjs";
6
- import { q as listMyPinnedAgents } from "./client-BPUdUaZT-CyCrpCTP.mjs";
6
+ import { q as listMyPinnedAgents } from "./client-DHCSQ8kg-DjlSmE9q.mjs";
7
7
  export { listMyPinnedAgents };
@@ -1219,26 +1219,51 @@ const githubDevCallbackQuerySchema = z.object({
1219
1219
  * 2. Add a key to `ORG_SETTINGS_NAMESPACES`.
1220
1220
  * 3. Done. No DB migration, no new API route.
1221
1221
  */
1222
- const httpsRepoUrlSchema = z.string().url().refine((value) => {
1222
+ const SCP_LIKE_SSH_RE = /^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;
1223
+ function isScpLikeSshUrl(value) {
1224
+ if (value.includes("://")) return false;
1225
+ return SCP_LIKE_SSH_RE.test(value);
1226
+ }
1227
+ const repoUrlSchema = z.string().min(1).superRefine((value, ctx) => {
1228
+ if (isScpLikeSshUrl(value)) return;
1229
+ let url;
1223
1230
  try {
1224
- return new URL(value).protocol === "https:";
1231
+ url = new URL(value);
1225
1232
  } catch {
1226
- return false;
1233
+ ctx.addIssue({
1234
+ code: z.ZodIssueCode.custom,
1235
+ message: "Repo URL must be HTTPS, SSH (ssh://...), or scp-like (git@host:path)."
1236
+ });
1237
+ return;
1227
1238
  }
1228
- }, { message: "Repo URL must use HTTPS." }).refine((value) => {
1229
- try {
1230
- const url = new URL(value);
1231
- return url.username.length === 0 && url.password.length === 0;
1232
- } catch {
1233
- return false;
1239
+ if (url.protocol !== "https:" && url.protocol !== "ssh:") {
1240
+ ctx.addIssue({
1241
+ code: z.ZodIssueCode.custom,
1242
+ message: "Repo URL must use HTTPS or SSH."
1243
+ });
1244
+ return;
1234
1245
  }
1235
- }, { message: "Repo URL must not include credentials." });
1246
+ if (url.password.length > 0) {
1247
+ ctx.addIssue({
1248
+ code: z.ZodIssueCode.custom,
1249
+ message: "Repo URL must not include credentials."
1250
+ });
1251
+ return;
1252
+ }
1253
+ if (url.protocol === "https:" && url.username.length > 0) {
1254
+ ctx.addIssue({
1255
+ code: z.ZodIssueCode.custom,
1256
+ message: "Repo URL must not include credentials."
1257
+ });
1258
+ return;
1259
+ }
1260
+ });
1236
1261
  const orgContextTreeStorageSchema = z.object({
1237
- repo: httpsRepoUrlSchema.optional(),
1262
+ repo: repoUrlSchema.optional(),
1238
1263
  branch: z.string().default("main")
1239
1264
  });
1240
1265
  const orgContextTreeInputSchema = z.object({
1241
- repo: httpsRepoUrlSchema.nullish(),
1266
+ repo: repoUrlSchema.nullish(),
1242
1267
  branch: z.string().min(1).nullish()
1243
1268
  });
1244
1269
  const orgContextTreeOutputSchema = z.object({
@@ -1252,11 +1277,11 @@ const orgGithubIntegrationOutputSchema = z.object({
1252
1277
  webhookUrl: z.string()
1253
1278
  });
1254
1279
  const orgSourceReposStorageSchema = z.object({ repos: z.array(z.object({
1255
- url: httpsRepoUrlSchema,
1280
+ url: repoUrlSchema,
1256
1281
  defaultBranch: z.string().optional()
1257
1282
  })).default([]) });
1258
1283
  const orgSourceReposInputSchema = z.object({ repos: z.array(z.object({
1259
- url: httpsRepoUrlSchema,
1284
+ url: repoUrlSchema,
1260
1285
  defaultBranch: z.string().min(1).optional()
1261
1286
  })).optional() });
1262
1287
  const orgSourceReposOutputSchema = z.object({ repos: z.array(z.object({
@@ -1,6 +1,6 @@
1
1
  import { r as __exportAll } from "./chunk-BSw8zbkd.mjs";
2
2
  import { t as cliFetch } from "./cli-fetch--tiwKm5S.mjs";
3
- import { r as AGENT_SELECTOR_HEADER } from "./dist-UOZ6vMUW.mjs";
3
+ import { r as AGENT_SELECTOR_HEADER } from "./dist-DHHd2dar.mjs";
4
4
  //#region src/core/feishu.ts
5
5
  var feishu_exports = /* @__PURE__ */ __exportAll({
6
6
  bindFeishuBot: () => bindFeishuBot,
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import "./observability-BAScT_5S-BcW9HgkG.mjs";
2
- import { A as checkDocker, B as isServiceSupported, E as checkAgentConfigs, F as checkWebSocket, G as uninstallClientService, H as restartClientService, I as printResults, J as stopPostgres, K as ensurePostgres, M as checkServerConfig, N as checkServerHealth, O as checkClientConfig, P as checkServerReachable, R as getClientServiceStatus, S as runHomeMigration, T as runMigrations, U as startClientService, V as resolveCliInvocation, W as stopClientService, X as handleClientOrgMismatch, Y as ClientRuntime, Z as rotateClientIdWithBackup, _ as formatCheckReport, b as onboardCreate, ct as FirstTreeHubSDK, d as startServer, g as promptMissingFields, h as promptAddAgent, j as checkNodeVersion, k as checkDatabase, lt as SdkError, m as isInteractive, n as deriveHubUrlFromToken, nt as hasUser, q as isDockerAvailable, t as HubUrlDerivationError, tt as createOwner, y as onboardCheck, z as installClientService } from "./saas-connect-Drn9g6cR.mjs";
2
+ import { A as checkDocker, B as isServiceSupported, E as checkAgentConfigs, F as checkWebSocket, G as uninstallClientService, H as restartClientService, I as printResults, J as stopPostgres, K as ensurePostgres, M as checkServerConfig, N as checkServerHealth, O as checkClientConfig, P as checkServerReachable, R as getClientServiceStatus, S as runHomeMigration, T as runMigrations, U as startClientService, V as resolveCliInvocation, W as stopClientService, X as handleClientOrgMismatch, Y as ClientRuntime, Z as rotateClientIdWithBackup, _ as formatCheckReport, b as onboardCreate, ct as FirstTreeHubSDK, d as startServer, g as promptMissingFields, h as promptAddAgent, j as checkNodeVersion, k as checkDatabase, lt as SdkError, m as isInteractive, n as deriveHubUrlFromToken, nt as hasUser, q as isDockerAvailable, t as HubUrlDerivationError, tt as createOwner, y as onboardCheck, z as installClientService } from "./saas-connect-_2M4kfPR.mjs";
3
3
  import "./logger-core-BTmvdflj-DjW8FM4T.mjs";
4
4
  import { a as ensureFreshAdminToken, c as resolveServerUrl, i as ensureFreshAccessToken, n as AuthRefreshRateLimitedError, s as resolveAccessToken, t as AuthRefreshFailedError } from "./bootstrap-C_K2CKXC.mjs";
5
5
  import { i as blank, s as status } from "./cli-fetch--tiwKm5S.mjs";
6
- import "./dist-UOZ6vMUW.mjs";
7
- import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-C6qlhju2.mjs";
6
+ import "./dist-DHHd2dar.mjs";
7
+ import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-fLnwqCOs.mjs";
8
8
  import "./errors-CF5evtJt-B0NTIVPt.mjs";
9
9
  import "./src-DNBS5Yjj.mjs";
10
- import "./client-BPUdUaZT-CyCrpCTP.mjs";
10
+ import "./client-DHCSQ8kg-DjlSmE9q.mjs";
11
11
  import "./invitation-Bg0TRiyx-BsZH4GCS.mjs";
12
12
  export { AuthRefreshFailedError, AuthRefreshRateLimitedError, ClientRuntime, FirstTreeHubSDK, HubUrlDerivationError, SdkError, bindFeishuBot, bindFeishuUser, blank, checkAgentConfigs, checkClientConfig, checkDatabase, checkDocker, checkNodeVersion, checkServerConfig, checkServerHealth, checkServerReachable, checkWebSocket, createOwner, deriveHubUrlFromToken, ensureFreshAccessToken, ensureFreshAdminToken, ensurePostgres, formatCheckReport, getClientServiceStatus, handleClientOrgMismatch, hasUser, installClientService, isDockerAvailable, isInteractive, isServiceSupported, onboardCheck, onboardCreate, printResults, promptAddAgent, promptMissingFields, resolveAccessToken, resolveCliInvocation, resolveServerUrl, restartClientService, rotateClientIdWithBackup, runHomeMigration, runMigrations, startClientService, startServer, status, stopClientService, stopPostgres, uninstallClientService };
@@ -1,4 +1,4 @@
1
- import "./dist-UOZ6vMUW.mjs";
1
+ import "./dist-DHHd2dar.mjs";
2
2
  import "./errors-CF5evtJt-B0NTIVPt.mjs";
3
3
  import { s as previewInvitation } from "./invitation-Bg0TRiyx-BsZH4GCS.mjs";
4
4
  export { previewInvitation };