@agent-team-foundation/first-tree-hub 0.14.5 → 0.14.6-alpha.268.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.
- package/dist/bootstrap-BmeaRhRp.mjs +3 -0
- package/dist/{bootstrap-CQQGgIx1.mjs → bootstrap-CmkHQsnS.mjs} +24 -16
- package/dist/cli/index.mjs +6 -94
- package/dist/{dist-CrdnqZjv.mjs → feishu-Drq9t1yd.mjs} +214 -397
- package/dist/feishu-jfGY0OT8.mjs +3 -0
- package/dist/index.mjs +5 -12
- package/dist/saas-connect-CeVf4pJD.mjs +13786 -0
- package/package.json +4 -12
- package/dist/chunk-BSw8zbkd.mjs +0 -37
- package/dist/client-BPRIfrOT-CoV_2o7e.mjs +0 -4230
- package/dist/client-CEdYVnoj-BGiGcJbH.mjs +0 -7
- package/dist/dist-LgF7LHpE.mjs +0 -430
- package/dist/drizzle/0000_shocking_darkhawk.sql +0 -92
- package/dist/drizzle/0001_v2_schema_updates.sql +0 -26
- package/dist/drizzle/0002_adapter_tables.sql +0 -64
- package/dist/drizzle/0003_feishu_adapter.sql +0 -21
- package/dist/drizzle/0004_adapter_refactor.sql +0 -13
- package/dist/drizzle/0005_delegate_mention.sql +0 -1
- package/dist/drizzle/0006_agent_tree_path.sql +0 -1
- package/dist/drizzle/0007_decouple_context_tree.sql +0 -2
- package/dist/drizzle/0008_uuid_identity.sql +0 -12
- package/dist/drizzle/0009_agent_runtime_m1.sql +0 -31
- package/dist/drizzle/0010_cloud_multi_tenancy.sql +0 -34
- package/dist/drizzle/0011_org_uuid_pk.sql +0 -22
- package/dist/drizzle/0012_session_level_state.sql +0 -19
- package/dist/drizzle/0013_hub_tasks.sql +0 -38
- package/dist/drizzle/0014_drop_task_fks.sql +0 -9
- package/dist/drizzle/0015_member_system.sql +0 -34
- package/dist/drizzle/0016_strange_havok.sql +0 -25
- package/dist/drizzle/0017_session_outputs_unique.sql +0 -1
- package/dist/drizzle/0018_agent_visibility.sql +0 -13
- package/dist/drizzle/0019_agent_configs.sql +0 -30
- package/dist/drizzle/0020_unified_user_token.sql +0 -154
- package/dist/drizzle/0021_drop_agents_profile.sql +0 -10
- package/dist/drizzle/0022_session_events.sql +0 -32
- package/dist/drizzle/0023_clients_org_scoping.sql +0 -40
- package/dist/drizzle/0024_display_name_not_null.sql +0 -31
- package/dist/drizzle/0025_inbox_silent_entries.sql +0 -53
- package/dist/drizzle/0026_saas_onboarding.sql +0 -153
- package/dist/drizzle/0027_runtime_provider.sql +0 -10
- package/dist/drizzle/0028_auth_identity_user_github_unique.sql +0 -12
- package/dist/drizzle/0029_direct_agent_only_mention_only.sql +0 -28
- package/dist/drizzle/0030_chat_first_workspace.sql +0 -129
- package/dist/drizzle/0031_drop_system_configs.sql +0 -11
- package/dist/drizzle/0032_organization_settings.sql +0 -36
- package/dist/drizzle/0033_onboarding_dismissed_at.sql +0 -13
- package/dist/drizzle/0034_pending_questions.sql +0 -34
- package/dist/drizzle/0035_drop_hub_tasks.sql +0 -7
- package/dist/drizzle/0036_github_entity_chat_mappings.sql +0 -47
- package/dist/drizzle/0037_github_app_installations.sql +0 -52
- package/dist/drizzle/0038_chat_membership_user_state.sql +0 -223
- package/dist/drizzle/0039_drop_chat_participants_subscriptions.sql +0 -26
- package/dist/drizzle/0040_chat_user_state_engagement.sql +0 -24
- package/dist/drizzle/0041_notifications_dedup_key.sql +0 -29
- package/dist/drizzle/0042_notifications_drop_legacy_types.sql +0 -36
- package/dist/drizzle/0043_onboarding_completed_at.sql +0 -32
- package/dist/drizzle/0044_agent_avatar_color.sql +0 -11
- package/dist/drizzle/0045_agent_avatar_image.sql +0 -17
- package/dist/drizzle/meta/0000_snapshot.json +0 -687
- package/dist/drizzle/meta/0001_snapshot.json +0 -687
- package/dist/drizzle/meta/0012_snapshot.json +0 -1451
- package/dist/drizzle/meta/0013_snapshot.json +0 -1771
- package/dist/drizzle/meta/0014_snapshot.json +0 -1717
- package/dist/drizzle/meta/0016_snapshot.json +0 -1917
- package/dist/drizzle/meta/0018_snapshot.json +0 -1938
- package/dist/drizzle/meta/_journal.json +0 -328
- package/dist/esm-iadMkGbV.mjs +0 -1516
- package/dist/execAsync-DUfRkc4a.mjs +0 -10
- package/dist/execAsync-YbEZSOYd.mjs +0 -10
- package/dist/feishu-DNoBroKK.mjs +0 -53
- package/dist/from-DQ7eNRwu.mjs +0 -3840
- package/dist/getMachineId-bsd-BmasEOJr.mjs +0 -27
- package/dist/getMachineId-bsd-Dh3h0DDE.mjs +0 -27
- package/dist/getMachineId-darwin-CuhM3hfZ.mjs +0 -24
- package/dist/getMachineId-darwin-D9wR0SLj.mjs +0 -24
- package/dist/getMachineId-linux-CYfb0oxZ.mjs +0 -20
- package/dist/getMachineId-linux-D8ZaSjAC.mjs +0 -20
- package/dist/getMachineId-unsupported-Cu3iisaD.mjs +0 -15
- package/dist/getMachineId-unsupported-DZqI4ZT5.mjs +0 -15
- package/dist/getMachineId-win-8ZJbtrdf.mjs +0 -26
- package/dist/getMachineId-win-DT-hqwVp.mjs +0 -26
- package/dist/invitation-C9m2gQx4-C_4f5VTs.mjs +0 -4
- package/dist/invitation-D_ENPHyj-5ETiae5r.mjs +0 -167
- package/dist/logger-core-BTmvdflj-DjW8FM4T.mjs +0 -146
- package/dist/multipart-parser-QRu3OKK4.mjs +0 -294
- package/dist/observability-BAScT_5S-BcW9HgkG.mjs +0 -96129
- package/dist/observability-eLA9iNK_.mjs +0 -5
- package/dist/saas-connect-CYp9TOB5.mjs +0 -21918
- package/dist/src-DFlbpJfU.mjs +0 -1176
- package/dist/src-DNBS5Yjj.mjs +0 -735
- package/dist/uuid-DbS_4vFh-iFghv4zA.mjs +0 -129
- package/dist/web/assets/index-9wK0udbH.js +0 -416
- package/dist/web/assets/index-C7x7O7dG.js +0 -11
- package/dist/web/assets/index-DE7Q3QWE.css +0 -1
- package/dist/web/favicon.svg +0 -9
- package/dist/web/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/web/fonts/inter-latin.woff2 +0 -0
- package/dist/web/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/dist/web/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/dist/web/index.html +0 -39
- /package/dist/{cli-fetch--tiwKm5S.mjs → cli-fetch-BGVItZxo.mjs} +0 -0
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as logFormatSchema, s as logLevelSchema } from "./logger-core-BTmvdflj-DjW8FM4T.mjs";
|
|
3
|
-
import { t as cliFetch } from "./cli-fetch--tiwKm5S.mjs";
|
|
1
|
+
import { t as cliFetch } from "./cli-fetch-BGVItZxo.mjs";
|
|
4
2
|
import { z } from "zod";
|
|
5
3
|
import { dirname, join } from "node:path";
|
|
4
|
+
import "node:stream";
|
|
6
5
|
import { homedir } from "node:os";
|
|
7
6
|
import { chmodSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
8
7
|
import { randomBytes } from "node:crypto";
|
|
9
8
|
import { parse, stringify } from "yaml";
|
|
9
|
+
//#region ../shared/dist/logger-core-BTmvdflj.mjs
|
|
10
|
+
/**
|
|
11
|
+
* Logger core — format / level primitives shared between server and client.
|
|
12
|
+
*
|
|
13
|
+
* This module intentionally has no dependency on `pino` so it can live in
|
|
14
|
+
* `@agent-team-foundation/first-tree-hub-shared`. Consumers construct their
|
|
15
|
+
* own pino instance and pass the output stream built here.
|
|
16
|
+
*/
|
|
17
|
+
const LOG_LEVELS = [
|
|
18
|
+
"trace",
|
|
19
|
+
"debug",
|
|
20
|
+
"info",
|
|
21
|
+
"warn",
|
|
22
|
+
"error",
|
|
23
|
+
"fatal"
|
|
24
|
+
];
|
|
25
|
+
const LOG_FORMATS = ["pretty", "json"];
|
|
26
|
+
const logLevelSchema = z.enum(LOG_LEVELS);
|
|
27
|
+
const logFormatSchema = z.enum(LOG_FORMATS);
|
|
28
|
+
//#endregion
|
|
10
29
|
//#region ../shared/dist/config/index.mjs
|
|
11
30
|
/** Declare a config field with a Zod schema and optional metadata. */
|
|
12
31
|
function field(schema, options) {
|
|
@@ -528,7 +547,7 @@ function migrateLegacyHome(opts) {
|
|
|
528
547
|
};
|
|
529
548
|
}
|
|
530
549
|
}
|
|
531
|
-
|
|
550
|
+
defineConfig({
|
|
532
551
|
database: {
|
|
533
552
|
url: field(z.string(), {
|
|
534
553
|
env: "FIRST_TREE_HUB_DATABASE_URL",
|
|
@@ -655,17 +674,6 @@ const serverConfigSchema = defineConfig({
|
|
|
655
674
|
});
|
|
656
675
|
//#endregion
|
|
657
676
|
//#region src/core/bootstrap.ts
|
|
658
|
-
var bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
659
|
-
AuthRefreshFailedError: () => AuthRefreshFailedError,
|
|
660
|
-
AuthRefreshRateLimitedError: () => AuthRefreshRateLimitedError,
|
|
661
|
-
ensureFreshAccessToken: () => ensureFreshAccessToken,
|
|
662
|
-
ensureFreshAdminToken: () => ensureFreshAdminToken,
|
|
663
|
-
loadCredentials: () => loadCredentials,
|
|
664
|
-
resolveAccessToken: () => resolveAccessToken,
|
|
665
|
-
resolveServerUrl: () => resolveServerUrl,
|
|
666
|
-
saveAgentConfig: () => saveAgentConfig,
|
|
667
|
-
saveCredentials: () => saveCredentials
|
|
668
|
-
});
|
|
669
677
|
const CREDENTIALS_PATH = join(DEFAULT_CONFIG_DIR, "credentials.json");
|
|
670
678
|
/**
|
|
671
679
|
* Resolve Hub server URL from flag, env, or config.
|
|
@@ -871,4 +879,4 @@ function saveAgentConfig(agentName, agentId, runtime) {
|
|
|
871
879
|
return agentDir;
|
|
872
880
|
}
|
|
873
881
|
//#endregion
|
|
874
|
-
export {
|
|
882
|
+
export { resolveConfigReadonly as C, resetConfigMeta as S, initConfig as _, loadCredentials as a, readConfigFile as b, saveAgentConfig as c, DEFAULT_DATA_DIR as d, DEFAULT_HOME_DIR as f, getConfigValue as g, collectMissingPrompts as h, ensureFreshAdminToken as i, saveCredentials as l, clientConfigSchema as m, AuthRefreshRateLimitedError as n, resolveAccessToken as o, agentConfigSchema as p, ensureFreshAccessToken as r, resolveServerUrl as s, AuthRefreshFailedError as t, DEFAULT_CONFIG_DIR as u, loadAgents as v, setConfigValue as w, resetConfig as x, migrateLegacyHome as y };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "../
|
|
3
|
-
import {
|
|
4
|
-
import "../
|
|
5
|
-
import {
|
|
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-CrdnqZjv.mjs";
|
|
8
|
-
import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-DNoBroKK.mjs";
|
|
9
|
-
import "../uuid-DbS_4vFh-iFghv4zA.mjs";
|
|
10
|
-
import "../src-DNBS5Yjj.mjs";
|
|
11
|
-
import "../client-BPRIfrOT-CoV_2o7e.mjs";
|
|
12
|
-
import "../invitation-D_ENPHyj-5ETiae5r.mjs";
|
|
2
|
+
import { $ as SdkError, A as printResults, B as ClientRuntime, C as migrateLocalAgentDirs, D as checkNodeVersion, E as checkClientConfig, G as removeLocalAgent, I as restartClientService, J as fail, K as resolveReplyToFromEnv, L as startClientService, M as getClientServiceStatus, N as installClientService, O as checkServerReachable, P as isServiceSupported, Q as FirstTreeHubSDK, R as stopClientService, S as createApiNameResolver, T as checkBackgroundService, U as findStaleAliases, V as handleClientOrgMismatch, W as formatStaleReason, X as ClientOrgMismatchError, Y as success, Z as ClientUserMismatchError, _ as loadOnboardState, a as declineUpdate, b as saveOnboardState, c as detectInstallMode, d as reconcileLocalRuntimeProviders, et as SessionRegistry, f as uploadClientCapabilities, g as formatCheckReport, h as promptMissingFields, i as createExecuteUpdate, it as configureClientLoggerForService, j as reconcileAgentConfigs, k as checkWebSocket, l as fetchLatestVersion, m as promptAddAgent, nt as probeCapabilities, o as promptUpdate, p as isInteractive, q as resolveSenderName, r as registerSaaSConnectCommand, rt as applyClientLoggerConfig, s as PACKAGE_NAME, tt as cleanWorkspaces, u as installGlobalLatest, v as onboardCheck, w as checkAgentConfigs, x as runHomeMigration, y as onboardCreate } from "../saas-connect-CeVf4pJD.mjs";
|
|
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-CmkHQsnS.mjs";
|
|
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
|
+
import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-Drq9t1yd.mjs";
|
|
13
6
|
import { join } from "node:path";
|
|
14
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync } from "node:fs";
|
|
15
8
|
import * as semver from "semver";
|
|
@@ -1470,13 +1463,13 @@ function decodeJwtExpSeconds(token) {
|
|
|
1470
1463
|
//#region src/commands/onboard.ts
|
|
1471
1464
|
async function promptMissing(args) {
|
|
1472
1465
|
if (!args.server) try {
|
|
1473
|
-
const { resolveServerUrl } = await import("../bootstrap-
|
|
1466
|
+
const { resolveServerUrl } = await import("../bootstrap-BmeaRhRp.mjs");
|
|
1474
1467
|
resolveServerUrl();
|
|
1475
1468
|
} catch {
|
|
1476
1469
|
args.server = await input({ message: "Hub server URL:" });
|
|
1477
1470
|
saveOnboardState(args);
|
|
1478
1471
|
}
|
|
1479
|
-
const { loadCredentials } = await import("../bootstrap-
|
|
1472
|
+
const { loadCredentials } = await import("../bootstrap-BmeaRhRp.mjs");
|
|
1480
1473
|
if (!loadCredentials()) throw new Error("No saved credentials. Run `first-tree-hub connect <token>` before onboarding.");
|
|
1481
1474
|
if (!args.id) {
|
|
1482
1475
|
args.id = await input({ message: "Agent ID:" });
|
|
@@ -1659,86 +1652,6 @@ async function resolveDefaultOrgId(serverUrl, accessToken) {
|
|
|
1659
1652
|
fail("AMBIGUOUS_ORG", "Multiple organizations — pass --org <orgId> explicitly or set a default in the web UI first", 1);
|
|
1660
1653
|
}
|
|
1661
1654
|
//#endregion
|
|
1662
|
-
//#region src/commands/server.ts
|
|
1663
|
-
function registerServerCommands(program) {
|
|
1664
|
-
const server = program.command("server").description("Manage First Tree Hub server");
|
|
1665
|
-
server.command("start").description("Start the server (auto-provisions PostgreSQL if needed)").option("--port <number>", "Server port (default: 8000)", Number.parseInt).option("--host <address>", "Bind address (default: 127.0.0.1)").option("--database-url <url>", "Use an existing PostgreSQL (skip Docker)").option("--no-interactive", "Skip interactive prompts (for Docker/CI)").action(async (options) => {
|
|
1666
|
-
try {
|
|
1667
|
-
await startServer({
|
|
1668
|
-
...options,
|
|
1669
|
-
noInteractive: options.interactive === false
|
|
1670
|
-
});
|
|
1671
|
-
} catch (error) {
|
|
1672
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1673
|
-
print.line(`\n Error: ${msg}\n\n`);
|
|
1674
|
-
process.exit(1);
|
|
1675
|
-
}
|
|
1676
|
-
});
|
|
1677
|
-
server.command("stop").description("Stop the managed PostgreSQL container").action(() => {
|
|
1678
|
-
try {
|
|
1679
|
-
if (stopPostgres()) print.line(" PostgreSQL container stopped.\n");
|
|
1680
|
-
else print.line(" No managed PostgreSQL container found.\n");
|
|
1681
|
-
} catch (error) {
|
|
1682
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1683
|
-
print.line(` Error stopping PostgreSQL: ${msg}\n`);
|
|
1684
|
-
process.exit(1);
|
|
1685
|
-
}
|
|
1686
|
-
});
|
|
1687
|
-
server.command("doctor").description("Check server environment readiness").action(async () => {
|
|
1688
|
-
print.line("\n First Tree Hub Server Doctor\n\n");
|
|
1689
|
-
printResults([
|
|
1690
|
-
checkNodeVersion(),
|
|
1691
|
-
checkDocker(),
|
|
1692
|
-
checkServerConfig(),
|
|
1693
|
-
await checkDatabase(),
|
|
1694
|
-
await checkServerHealth()
|
|
1695
|
-
]);
|
|
1696
|
-
});
|
|
1697
|
-
server.command("status").description("Show server health and status").action(async () => {
|
|
1698
|
-
const url = process.env.FIRST_TREE_HUB_SERVER_URL ?? "http://localhost:8000";
|
|
1699
|
-
try {
|
|
1700
|
-
const res = await cliFetch(`${url}/api/v1/health`);
|
|
1701
|
-
if (res.ok) {
|
|
1702
|
-
const data = await res.json();
|
|
1703
|
-
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
1704
|
-
} else {
|
|
1705
|
-
print.line(` Server returned ${res.status}\n`);
|
|
1706
|
-
process.exit(1);
|
|
1707
|
-
}
|
|
1708
|
-
} catch {
|
|
1709
|
-
print.line(` Cannot connect to ${url}\n`);
|
|
1710
|
-
process.exit(1);
|
|
1711
|
-
}
|
|
1712
|
-
});
|
|
1713
|
-
server.command("migrate").description("Run database migrations").action(async () => {
|
|
1714
|
-
try {
|
|
1715
|
-
const tableCount = await runMigrations((await initConfig({
|
|
1716
|
-
schema: serverConfigSchema,
|
|
1717
|
-
role: "server"
|
|
1718
|
-
})).database.url);
|
|
1719
|
-
print.line(` Migrations complete (${tableCount} tables)\n`);
|
|
1720
|
-
} catch (error) {
|
|
1721
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1722
|
-
print.line(` Error: ${msg}\n`);
|
|
1723
|
-
process.exit(1);
|
|
1724
|
-
}
|
|
1725
|
-
});
|
|
1726
|
-
server.command("admin").description("Admin user management").command("create").description("Create an admin user with organization").option("-u, --username <name>", "Admin username", "admin").option("-n, --name <name>", "Display name", "Admin").option("-o, --org <org>", "Organization slug", "default").option("-p, --password <pass>", "Password (auto-generated if omitted)").action(async (options) => {
|
|
1727
|
-
try {
|
|
1728
|
-
const result = await createOwner((await initConfig({
|
|
1729
|
-
schema: serverConfigSchema,
|
|
1730
|
-
role: "server"
|
|
1731
|
-
})).database.url, options.username, options.org, options.name, options.password);
|
|
1732
|
-
print.line(` Admin user "${result.username}" created.\n`);
|
|
1733
|
-
if (!options.password) print.line(` Password: ${result.password} (save this — shown only once)\n`);
|
|
1734
|
-
} catch (error) {
|
|
1735
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
1736
|
-
print.line(` Error: ${msg}\n`);
|
|
1737
|
-
process.exit(1);
|
|
1738
|
-
}
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
//#endregion
|
|
1742
1655
|
//#region src/commands/update.ts
|
|
1743
1656
|
/**
|
|
1744
1657
|
* `first-tree-hub update` — user-driven CLI upgrade.
|
|
@@ -1845,7 +1758,6 @@ program.name("first-tree-hub").description("First Tree Hub — centralized colla
|
|
|
1845
1758
|
else applyClientLoggerConfig({ level: "warn" });
|
|
1846
1759
|
});
|
|
1847
1760
|
registerSaaSConnectCommand(program);
|
|
1848
|
-
registerServerCommands(program);
|
|
1849
1761
|
registerClientCommands(program);
|
|
1850
1762
|
registerAgentCommands(program);
|
|
1851
1763
|
registerChatCommands(program);
|