@agent-team-foundation/first-tree-hub 0.12.0 → 0.12.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.
- package/dist/cli/index.mjs +4 -4
- package/dist/{client-BhCtO2df-BGOu-rRN.mjs → client-0RrgrMjR-DPyuu6Ls.mjs} +2 -2
- package/dist/{client-BPUdUaZT-CyCrpCTP.mjs → client-D1TDiik_-gxtXN9bj.mjs} +13 -11
- package/dist/{dist-UOZ6vMUW.mjs → dist-DHHd2dar.mjs} +39 -14
- package/dist/{feishu-C6qlhju2.mjs → feishu-fLnwqCOs.mjs} +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{invitation-C299fxkP-KyCNax4T.mjs → invitation-C299fxkP-B89eqDos.mjs} +1 -1
- package/dist/{saas-connect-Drn9g6cR.mjs → saas-connect-_lNV0Liy.mjs} +627 -109
- package/dist/web/assets/index-B4EaL8S9.css +1 -0
- package/dist/web/assets/index-CJr7zpx-.js +401 -0
- package/dist/web/assets/{index-Bnyz7inW.js → index-DcMORzyx.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-B_Tf2I6v.css +0 -1
- package/dist/web/assets/index-Dy3jIUX5.js +0 -391
package/dist/cli/index.mjs
CHANGED
|
@@ -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-
|
|
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-_lNV0Liy.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-
|
|
8
|
-
import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-
|
|
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-
|
|
11
|
+
import "../client-D1TDiik_-gxtXN9bj.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,7 +1,7 @@
|
|
|
1
1
|
import "./observability-BAScT_5S-BcW9HgkG.mjs";
|
|
2
2
|
import "./logger-core-BTmvdflj-DjW8FM4T.mjs";
|
|
3
|
-
import "./dist-
|
|
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-
|
|
6
|
+
import { q as listMyPinnedAgents } from "./client-D1TDiik_-gxtXN9bj.mjs";
|
|
7
7
|
export { listMyPinnedAgents };
|
|
@@ -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-
|
|
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-
|
|
7
|
+
//#region ../server/dist/client-D1TDiik_.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
|
|
@@ -691,14 +691,6 @@ async function leaveChat(db, chatId, humanAgentId) {
|
|
|
691
691
|
return db.select().from(chatParticipants).where(eq(chatParticipants.chatId, chatId));
|
|
692
692
|
}
|
|
693
693
|
async function findOrCreateDirectChat(db, agentAId, agentBId) {
|
|
694
|
-
const aChats = await db.select({ chatId: chatParticipants.chatId }).from(chatParticipants).where(eq(chatParticipants.agentId, agentAId));
|
|
695
|
-
const bChats = await db.select({ chatId: chatParticipants.chatId }).from(chatParticipants).where(eq(chatParticipants.agentId, agentBId));
|
|
696
|
-
const bChatIds = new Set(bChats.map((r) => r.chatId));
|
|
697
|
-
const commonChatIds = aChats.map((r) => r.chatId).filter((id) => bChatIds.has(id));
|
|
698
|
-
if (commonChatIds.length > 0) {
|
|
699
|
-
const directChats = await db.select().from(chats).where(and(inArray(chats.id, commonChatIds), eq(chats.type, "direct")));
|
|
700
|
-
if (directChats.length > 0 && directChats[0]) return directChats[0];
|
|
701
|
-
}
|
|
702
694
|
const ends = await db.select({
|
|
703
695
|
uuid: agents.uuid,
|
|
704
696
|
organizationId: agents.organizationId,
|
|
@@ -708,12 +700,22 @@ async function findOrCreateDirectChat(db, agentAId, agentBId) {
|
|
|
708
700
|
if (!agentA) throw new NotFoundError(`Agent "${agentAId}" not found`);
|
|
709
701
|
const agentB = ends.find((a) => a.uuid === agentBId);
|
|
710
702
|
if (!agentB) throw new NotFoundError(`Agent "${agentBId}" not found`);
|
|
703
|
+
if (agentA.organizationId !== agentB.organizationId) throw new BadRequestError(`Cannot create direct chat across organizations: agent "${agentAId}" (org "${agentA.organizationId}") vs agent "${agentBId}" (org "${agentB.organizationId}")`);
|
|
704
|
+
const orgId = agentA.organizationId;
|
|
705
|
+
const aChats = await db.select({ chatId: chatParticipants.chatId }).from(chatParticipants).where(eq(chatParticipants.agentId, agentAId));
|
|
706
|
+
const bChats = await db.select({ chatId: chatParticipants.chatId }).from(chatParticipants).where(eq(chatParticipants.agentId, agentBId));
|
|
707
|
+
const bChatIds = new Set(bChats.map((r) => r.chatId));
|
|
708
|
+
const commonChatIds = aChats.map((r) => r.chatId).filter((id) => bChatIds.has(id));
|
|
709
|
+
if (commonChatIds.length > 0) {
|
|
710
|
+
const directChats = await db.select().from(chats).where(and(inArray(chats.id, commonChatIds), eq(chats.type, "direct"), eq(chats.organizationId, orgId))).orderBy(chats.createdAt, chats.id).limit(1);
|
|
711
|
+
if (directChats.length > 0 && directChats[0]) return directChats[0];
|
|
712
|
+
}
|
|
711
713
|
const mode = agentA.type !== "human" && agentB.type !== "human" ? "mention_only" : "full";
|
|
712
714
|
const chatId = randomUUID();
|
|
713
715
|
return db.transaction(async (tx) => {
|
|
714
716
|
const [chat] = await tx.insert(chats).values({
|
|
715
717
|
id: chatId,
|
|
716
|
-
organizationId:
|
|
718
|
+
organizationId: orgId,
|
|
717
719
|
type: "direct"
|
|
718
720
|
}).returning();
|
|
719
721
|
await tx.insert(chatParticipants).values([{
|
|
@@ -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
|
|
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
|
-
|
|
1231
|
+
url = new URL(value);
|
|
1225
1232
|
} catch {
|
|
1226
|
-
|
|
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
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
return
|
|
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
|
-
|
|
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:
|
|
1262
|
+
repo: repoUrlSchema.optional(),
|
|
1238
1263
|
branch: z.string().default("main")
|
|
1239
1264
|
});
|
|
1240
1265
|
const orgContextTreeInputSchema = z.object({
|
|
1241
|
-
repo:
|
|
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:
|
|
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:
|
|
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-
|
|
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-
|
|
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-_lNV0Liy.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-
|
|
7
|
-
import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-
|
|
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-
|
|
10
|
+
import "./client-D1TDiik_-gxtXN9bj.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 };
|