@agent-team-foundation/first-tree-hub 0.3.0 → 0.3.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.
@@ -0,0 +1,51 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
2
+ //#region src/core/feishu.ts
3
+ var feishu_exports = /* @__PURE__ */ __exportAll({
4
+ bindFeishuBot: () => bindFeishuBot,
5
+ bindFeishuUser: () => bindFeishuUser
6
+ });
7
+ /**
8
+ * Feishu-related core operations: bind-bot, bind-user.
9
+ */
10
+ /**
11
+ * Self-service bind a Feishu bot (agent binds its own bot).
12
+ */
13
+ async function bindFeishuBot(serverUrl, agentToken, appId, appSecret) {
14
+ const res = await fetch(`${serverUrl}/api/v1/agent/me/feishu-bot`, {
15
+ method: "PUT",
16
+ headers: {
17
+ Authorization: `Bearer ${agentToken}`,
18
+ "Content-Type": "application/json"
19
+ },
20
+ body: JSON.stringify({
21
+ appId,
22
+ appSecret
23
+ })
24
+ });
25
+ if (!res.ok) {
26
+ const body = await res.json().catch(() => ({}));
27
+ throw new Error(body.error ?? `Bind Feishu bot failed: HTTP ${res.status}`);
28
+ }
29
+ }
30
+ /**
31
+ * Delegate bind a Feishu user (assistant binds owner's Feishu user ID).
32
+ */
33
+ async function bindFeishuUser(serverUrl, agentToken, humanAgentId, feishuUserId, displayName) {
34
+ const res = await fetch(`${serverUrl}/api/v1/agent/delegated/${encodeURIComponent(humanAgentId)}/feishu-user`, {
35
+ method: "POST",
36
+ headers: {
37
+ Authorization: `Bearer ${agentToken}`,
38
+ "Content-Type": "application/json"
39
+ },
40
+ body: JSON.stringify({
41
+ feishuUserId,
42
+ displayName
43
+ })
44
+ });
45
+ if (!res.ok) {
46
+ const body = await res.json().catch(() => ({}));
47
+ throw new Error(body.error ?? `Bind Feishu user failed: HTTP ${res.status}`);
48
+ }
49
+ }
50
+ //#endregion
51
+ export { bindFeishuUser as n, feishu_exports as r, bindFeishuBot as t };
package/dist/index.mjs CHANGED
@@ -1,2 +1,4 @@
1
- import { C as stopPostgres, F as createAdminUser, I as hasAdminUser, O as FirstTreeHubSDK, S as isDockerAvailable, _ as checkWebSocket, a as runMigrations, b as status, c as checkClientConfig, d as checkDocker, f as checkGitHubToken, g as checkServerReachable, h as checkServerHealth, i as promptMissingFields, k as SdkError, l as checkContextTreeRepo, m as checkServerConfig, n as isInteractive, o as checkAgentConfigs, p as checkNodeVersion, r as promptAddAgent, s as checkAgentTokens, t as startServer, u as checkDatabase, v as printResults, w as ClientRuntime, x as ensurePostgres, y as blank } from "./core-uG-Hkr9K.mjs";
2
- export { ClientRuntime, FirstTreeHubSDK, SdkError, blank, checkAgentConfigs, checkAgentTokens, checkClientConfig, checkContextTreeRepo, checkDatabase, checkDocker, checkGitHubToken, checkNodeVersion, checkServerConfig, checkServerHealth, checkServerReachable, checkWebSocket, createAdminUser, ensurePostgres, hasAdminUser, isDockerAvailable, isInteractive, printResults, promptAddAgent, promptMissingFields, runMigrations, startServer, status, stopPostgres };
1
+ import { a as getGitHubUsername, i as getGitHubToken, o as resolveAgentToken, r as checkBootstrapStatus, s as resolveServerUrl, t as bootstrapToken } from "./bootstrap-B9JsJR3Z.mjs";
2
+ import { A as ClientRuntime, C as checkWebSocket, D as ensurePostgres, E as status, F as SdkError, H as hasAdminUser, O as isDockerAvailable, P as FirstTreeHubSDK, S as checkServerReachable, T as blank, V as createAdminUser, _ as checkDocker, a as formatCheckReport, b as checkServerConfig, c as onboardContinue, d as runMigrations, f as checkAgentConfigs, g as checkDatabase, h as checkContextTreeRepo, i as promptMissingFields, k as stopPostgres, l as onboardCreate, m as checkClientConfig, n as isInteractive, p as checkAgentTokens, r as promptAddAgent, s as onboardCheck, t as startServer, v as checkGitHubToken, w as printResults, x as checkServerHealth, y as checkNodeVersion } from "./core-D-c9r7D6.mjs";
3
+ import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-Y4m2zFc3.mjs";
4
+ export { ClientRuntime, FirstTreeHubSDK, SdkError, bindFeishuBot, bindFeishuUser, blank, bootstrapToken, checkAgentConfigs, checkAgentTokens, checkBootstrapStatus, checkClientConfig, checkContextTreeRepo, checkDatabase, checkDocker, checkGitHubToken, checkNodeVersion, checkServerConfig, checkServerHealth, checkServerReachable, checkWebSocket, createAdminUser, ensurePostgres, formatCheckReport, getGitHubToken, getGitHubUsername, hasAdminUser, isDockerAvailable, isInteractive, onboardCheck, onboardContinue, onboardCreate, printResults, promptAddAgent, promptMissingFields, resolveAgentToken, resolveServerUrl, runMigrations, startServer, status, stopPostgres };
@@ -0,0 +1,14 @@
1
+ import "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __exportAll = (all, no_symbols) => {
5
+ let target = {};
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return target;
12
+ };
13
+ //#endregion
14
+ export { __exportAll as t };