@agent-team-foundation/first-tree-hub 0.4.0 → 0.5.0
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-uyPaaI05.mjs → bootstrap-BU_7B03u.mjs} +6 -6
- package/dist/cli/index.mjs +8 -8
- package/dist/{core-CMeOAZmx.mjs → core-jjk1xFW_.mjs} +228 -200
- package/dist/drizzle/0008_uuid_identity.sql +12 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/index.mjs +2 -2
- package/dist/web/assets/index-LFh6j4ki.js +280 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-C4J9gHaF.js +0 -280
|
@@ -532,7 +532,7 @@ function resolveServerUrl(flagValue) {
|
|
|
532
532
|
/**
|
|
533
533
|
* Bootstrap a token for an agent using GitHub identity.
|
|
534
534
|
*/
|
|
535
|
-
async function bootstrapToken(serverUrl,
|
|
535
|
+
async function bootstrapToken(serverUrl, agentName, options = {}) {
|
|
536
536
|
const githubToken = getGitHubToken();
|
|
537
537
|
const body = { name: "bootstrap" };
|
|
538
538
|
if (options.type) body.type = options.type;
|
|
@@ -540,7 +540,7 @@ async function bootstrapToken(serverUrl, agentId, options = {}) {
|
|
|
540
540
|
if (options.delegateMention) body.delegateMention = options.delegateMention;
|
|
541
541
|
if (options.profile) body.profile = options.profile;
|
|
542
542
|
if (options.metadata) body.metadata = options.metadata;
|
|
543
|
-
const res = await fetch(`${serverUrl}/api/v1/bootstrap/${encodeURIComponent(
|
|
543
|
+
const res = await fetch(`${serverUrl}/api/v1/bootstrap/${encodeURIComponent(agentName)}/token`, {
|
|
544
544
|
method: "POST",
|
|
545
545
|
headers: {
|
|
546
546
|
"X-GitHub-Token": githubToken,
|
|
@@ -550,11 +550,11 @@ async function bootstrapToken(serverUrl, agentId, options = {}) {
|
|
|
550
550
|
});
|
|
551
551
|
if (!res.ok) {
|
|
552
552
|
const msg = (await res.json().catch(() => ({}))).error ?? `HTTP ${res.status}`;
|
|
553
|
-
throw new Error(`Bootstrap failed for "${
|
|
553
|
+
throw new Error(`Bootstrap failed for "${agentName}": ${msg}`);
|
|
554
554
|
}
|
|
555
555
|
const data = await res.json();
|
|
556
556
|
if (options.saveTo === "agent" || !options.saveTo) {
|
|
557
|
-
const configDir = join(DEFAULT_CONFIG_DIR, "agents",
|
|
557
|
+
const configDir = join(DEFAULT_CONFIG_DIR, "agents", agentName);
|
|
558
558
|
const configPath = `${configDir}/agent.yaml`;
|
|
559
559
|
mkdirSync(configDir, {
|
|
560
560
|
recursive: true,
|
|
@@ -580,9 +580,9 @@ function resolveAgentToken() {
|
|
|
580
580
|
/**
|
|
581
581
|
* Check if an agent exists and is synced.
|
|
582
582
|
*/
|
|
583
|
-
async function checkBootstrapStatus(serverUrl,
|
|
583
|
+
async function checkBootstrapStatus(serverUrl, agentName) {
|
|
584
584
|
const githubToken = getGitHubToken();
|
|
585
|
-
const res = await fetch(`${serverUrl}/api/v1/bootstrap/${encodeURIComponent(
|
|
585
|
+
const res = await fetch(`${serverUrl}/api/v1/bootstrap/${encodeURIComponent(agentName)}/status`, { headers: { "X-GitHub-Token": githubToken } });
|
|
586
586
|
if (!res.ok) {
|
|
587
587
|
const body = await res.json().catch(() => ({}));
|
|
588
588
|
throw new Error(body.error ?? `HTTP ${res.status}`);
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as createAdminUser, C as printResults, F as cleanWorkspaces, M as FirstTreeHubSDK, N as SdkError, O as stopPostgres, P as SessionRegistry, S as checkWebSocket, _ as checkGitHubToken, a as formatCheckReport, b as checkServerHealth, c as onboardCreate, d as checkAgentConfigs, f as checkAgentTokens, g as checkDocker, h as checkDatabase, i as promptMissingFields, k as ClientRuntime, l as saveOnboardState, m as checkContextTreeRepo, n as isInteractive, o as loadOnboardState, p as checkClientConfig, r as promptAddAgent, s as onboardCheck, t as startServer, u as runMigrations, v as checkNodeVersion, x as checkServerReachable, y as checkServerConfig } from "../core-
|
|
3
|
-
import { S as setConfigValue, _ as readConfigFile, c as DEFAULT_CONFIG_DIR, d as agentConfigSchema, f as clientConfigSchema, g as loadAgents, h as initConfig, l as DEFAULT_DATA_DIR, m as getConfigValue, o as resolveAgentToken, s as resolveServerUrl, t as bootstrapToken, u as DEFAULT_HOME_DIR, v as resetConfig, x as serverConfigSchema, y as resetConfigMeta } from "../bootstrap-
|
|
2
|
+
import { A as createAdminUser, C as printResults, F as cleanWorkspaces, M as FirstTreeHubSDK, N as SdkError, O as stopPostgres, P as SessionRegistry, S as checkWebSocket, _ as checkGitHubToken, a as formatCheckReport, b as checkServerHealth, c as onboardCreate, d as checkAgentConfigs, f as checkAgentTokens, g as checkDocker, h as checkDatabase, i as promptMissingFields, k as ClientRuntime, l as saveOnboardState, m as checkContextTreeRepo, n as isInteractive, o as loadOnboardState, p as checkClientConfig, r as promptAddAgent, s as onboardCheck, t as startServer, u as runMigrations, v as checkNodeVersion, x as checkServerReachable, y as checkServerConfig } from "../core-jjk1xFW_.mjs";
|
|
3
|
+
import { S as setConfigValue, _ as readConfigFile, c as DEFAULT_CONFIG_DIR, d as agentConfigSchema, f as clientConfigSchema, g as loadAgents, h as initConfig, l as DEFAULT_DATA_DIR, m as getConfigValue, o as resolveAgentToken, s as resolveServerUrl, t as bootstrapToken, u as DEFAULT_HOME_DIR, v as resetConfig, x as serverConfigSchema, y as resetConfigMeta } from "../bootstrap-BU_7B03u.mjs";
|
|
4
4
|
import { n as bindFeishuUser, t as bindFeishuBot } from "../feishu-Y4m2zFc3.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { Command } from "commander";
|
|
@@ -165,10 +165,10 @@ function registerAgentCommands(program) {
|
|
|
165
165
|
}
|
|
166
166
|
process.stderr.write(` ${totalRemoved} workspace(s) cleaned.\n`);
|
|
167
167
|
});
|
|
168
|
-
agent.command("token").description("Agent token management").command("bootstrap <
|
|
168
|
+
agent.command("token").description("Agent token management").command("bootstrap <agentName>").description("Bootstrap a token using GitHub identity (requires gh CLI)").option("--save-to <target>", "Save token to: \"agent\" (default) or a file path", "agent").option("--server <url>", "Hub server URL").action(async (agentName, options) => {
|
|
169
169
|
try {
|
|
170
|
-
const result = await bootstrapToken(resolveServerUrl(options.server),
|
|
171
|
-
if (options.saveTo === "agent") process.stderr.write(`Token saved to ${DEFAULT_HOME_DIR}/config/agents/${
|
|
170
|
+
const result = await bootstrapToken(resolveServerUrl(options.server), agentName, { saveTo: options.saveTo });
|
|
171
|
+
if (options.saveTo === "agent") process.stderr.write(`Token saved to ${DEFAULT_HOME_DIR}/config/agents/${agentName}/agent.yaml\n`);
|
|
172
172
|
else process.stderr.write(`Token saved to ${options.saveTo}\n`);
|
|
173
173
|
success({
|
|
174
174
|
agentId: result.agentId,
|
|
@@ -456,13 +456,13 @@ function isSecretField(schema, dotPath) {
|
|
|
456
456
|
//#region src/commands/onboard.ts
|
|
457
457
|
async function promptMissing(args) {
|
|
458
458
|
if (!args.server) try {
|
|
459
|
-
const { resolveServerUrl } = await import("../bootstrap-
|
|
459
|
+
const { resolveServerUrl } = await import("../bootstrap-BU_7B03u.mjs").then((n) => n.n);
|
|
460
460
|
resolveServerUrl();
|
|
461
461
|
} catch {
|
|
462
462
|
args.server = await input({ message: "Hub server URL:" });
|
|
463
463
|
saveOnboardState(args);
|
|
464
464
|
}
|
|
465
|
-
const { resolveServerUrl } = await import("../bootstrap-
|
|
465
|
+
const { resolveServerUrl } = await import("../bootstrap-BU_7B03u.mjs").then((n) => n.n);
|
|
466
466
|
const serverUrl = resolveServerUrl(args.server).replace(/\/+$/, "");
|
|
467
467
|
try {
|
|
468
468
|
const res = await fetch(`${serverUrl}/api/v1/bootstrap/config`);
|
|
@@ -474,7 +474,7 @@ async function promptMissing(args) {
|
|
|
474
474
|
}
|
|
475
475
|
let ghUsername = null;
|
|
476
476
|
try {
|
|
477
|
-
const { getGitHubUsername } = await import("../bootstrap-
|
|
477
|
+
const { getGitHubUsername } = await import("../bootstrap-BU_7B03u.mjs").then((n) => n.n);
|
|
478
478
|
ghUsername = getGitHubUsername();
|
|
479
479
|
} catch {}
|
|
480
480
|
if (!args.id) {
|