@agent-team-foundation/first-tree-hub 0.2.0 → 0.3.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/cli/index.mjs +30 -3
- package/dist/{core-CD3xEbyB.mjs → core-uG-Hkr9K.mjs} +1092 -443
- package/dist/drizzle/0006_agent_tree_path.sql +1 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/index.mjs +1 -1
- package/dist/web/assets/{index-CHZINY3I.js → index-B8NgnD3u.js} +46 -41
- package/dist/web/assets/index-BURu6jt9.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-Drt799Rs.css +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as SessionRegistry, B as clientConfigSchema, C as stopPostgres, D as DEFAULT_WORKSPACE_TTL_MS, E as AgentSlot, F as createAdminUser, G as resetConfig, H as initConfig, J as setConfigValue, K as resetConfigMeta, L as DEFAULT_CONFIG_DIR, M as getHandlerFactory, N as loadRuntimeConfig, O as FirstTreeHubSDK, P as registerBuiltinHandlers, R as DEFAULT_DATA_DIR, T as AgentRuntime, U as loadAgents, V as getConfigValue, W as readConfigFile, _ as checkWebSocket, a as runMigrations, c as checkClientConfig, d as checkDocker, f as checkGitHubToken, g as checkServerReachable, h as checkServerHealth, i as promptMissingFields, j as cleanWorkspaces, k as SdkError, l as checkContextTreeRepo, m as checkServerConfig, o as checkAgentConfigs, p as checkNodeVersion, q as serverConfigSchema, r as promptAddAgent, s as checkAgentTokens, t as startServer, u as checkDatabase, v as printResults, w as ClientRuntime, z as agentConfigSchema } from "../core-uG-Hkr9K.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
import { existsSync, mkdirSync, rmSync } from "node:fs";
|
|
5
|
+
import { existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
//#region src/commands/admin.ts
|
|
8
8
|
function registerAdminCommands(program) {
|
|
@@ -237,7 +237,7 @@ function registerClientCommands(program) {
|
|
|
237
237
|
process.exit(1);
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
|
-
client.command("remove <name>").description("Remove an agent instance").action((name) => {
|
|
240
|
+
client.command("remove <name>").description("Remove an agent instance and its runtime data").action((name) => {
|
|
241
241
|
const agentDir = join(DEFAULT_CONFIG_DIR, "agents", name);
|
|
242
242
|
if (!existsSync(agentDir)) {
|
|
243
243
|
process.stderr.write(` Agent "${name}" not found.\n`);
|
|
@@ -247,6 +247,11 @@ function registerClientCommands(program) {
|
|
|
247
247
|
recursive: true,
|
|
248
248
|
force: true
|
|
249
249
|
});
|
|
250
|
+
rmSync(join(DEFAULT_DATA_DIR, "workspaces", name), {
|
|
251
|
+
recursive: true,
|
|
252
|
+
force: true
|
|
253
|
+
});
|
|
254
|
+
rmSync(join(DEFAULT_DATA_DIR, "sessions", `${name}.json`), { force: true });
|
|
250
255
|
process.stderr.write(` Agent "${name}" removed.\n`);
|
|
251
256
|
});
|
|
252
257
|
client.command("list").description("List configured agents").action(() => {
|
|
@@ -268,6 +273,28 @@ function registerClientCommands(program) {
|
|
|
268
273
|
process.stderr.write(" No agents configured.\n");
|
|
269
274
|
}
|
|
270
275
|
});
|
|
276
|
+
client.command("workspace").description("Manage agent workspaces").command("clean [agent-name]").description("Remove stale workspace directories (older than TTL with no active session)").option("--ttl <days>", "TTL in days", String(DEFAULT_WORKSPACE_TTL_MS / (1440 * 60 * 1e3))).action((agentName, options) => {
|
|
277
|
+
const defaultDays = DEFAULT_WORKSPACE_TTL_MS / (1440 * 60 * 1e3);
|
|
278
|
+
const ttlMs = Number.parseInt(options?.ttl ?? String(defaultDays), 10) * 24 * 60 * 60 * 1e3;
|
|
279
|
+
const workspacesDir = join(DEFAULT_DATA_DIR, "workspaces");
|
|
280
|
+
if (!existsSync(workspacesDir)) {
|
|
281
|
+
process.stderr.write(" No workspaces found.\n");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const agentNames = agentName ? [agentName] : readdirSync(workspacesDir);
|
|
285
|
+
let totalRemoved = 0;
|
|
286
|
+
for (const name of agentNames) {
|
|
287
|
+
const agentWorkspaceRoot = join(workspacesDir, name);
|
|
288
|
+
if (!existsSync(agentWorkspaceRoot)) continue;
|
|
289
|
+
const persisted = new SessionRegistry(join(DEFAULT_DATA_DIR, "sessions", `${name}.json`)).load();
|
|
290
|
+
const activeChatIds = /* @__PURE__ */ new Set();
|
|
291
|
+
for (const [chatId, data] of persisted) if (data.status !== "evicted") activeChatIds.add(chatId);
|
|
292
|
+
const removed = cleanWorkspaces(agentWorkspaceRoot, activeChatIds, ttlMs);
|
|
293
|
+
totalRemoved += removed.length;
|
|
294
|
+
for (const chatId of removed) process.stderr.write(` Removed: ${name}/${chatId}\n`);
|
|
295
|
+
}
|
|
296
|
+
process.stderr.write(` ${totalRemoved} workspace(s) cleaned.\n`);
|
|
297
|
+
});
|
|
271
298
|
}
|
|
272
299
|
//#endregion
|
|
273
300
|
//#region src/commands/config.ts
|