@agent-team-foundation/first-tree-hub 0.14.1 → 0.14.2

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.
@@ -728,13 +728,17 @@ const createChatSchema = z.object({
728
728
  participantIds: z.array(z.string()).min(1),
729
729
  metadata: optionalChatMetadataSchema.optional()
730
730
  });
731
- const chatParticipantSchema = z.object({
731
+ /**
732
+ * Participant row with the agent's public-ish metadata resolved — used by the
733
+ * client runtime for `@<name>` mention extraction against the authoritative
734
+ * participant set (see proposals/hub-agent-messaging-reply-and-mentions §4).
735
+ */
736
+ const chatParticipantDetailSchema = z.object({
732
737
  agentId: z.string(),
733
738
  role: z.string(),
734
739
  mode: z.string(),
735
740
  joinedAt: z.string()
736
- });
737
- chatParticipantSchema.extend({
741
+ }).extend({
738
742
  name: z.string().nullable(),
739
743
  displayName: z.string(),
740
744
  type: z.string()
@@ -749,7 +753,7 @@ z.object({
749
753
  createdAt: z.string(),
750
754
  updatedAt: z.string()
751
755
  }).extend({
752
- participants: z.array(chatParticipantSchema),
756
+ participants: z.array(chatParticipantDetailSchema),
753
757
  title: z.string(),
754
758
  firstMessagePreview: z.string().nullable(),
755
759
  engagementStatus: chatEngagementStatusSchema
@@ -1062,6 +1066,23 @@ const messageFormatSchema = z.enum([
1062
1066
  "question",
1063
1067
  "question_answer"
1064
1068
  ]);
1069
+ /**
1070
+ * Optional intent tag set by the client when posting through
1071
+ * `POST /agent/chats/:id/messages`. Tells the server *why* this write is
1072
+ * happening so it can pick the right enforcement profile.
1073
+ *
1074
+ * - `"agent-final-text"`: handler-initiated forward of an agent's final
1075
+ * reply text (today: `runtime/result-sink.ts`) OR an `AskUserQuestion`
1076
+ * payload posted via the canUseTool bridge. Both should land in chat
1077
+ * history so human observers in the web UI can see what the agent is
1078
+ * doing, but neither should wake other agents and neither should be
1079
+ * subject to the group-chat `@mention required` guard — they are not
1080
+ * a user-typed group broadcast. v1 §四 改造 4 (b) bypass channel.
1081
+ *
1082
+ * Default-`undefined` means a regular agent-initiated send (CLI `chat send`,
1083
+ * adapter, etc.) and goes through the normal enforcement profile.
1084
+ */
1085
+ const messagePurposeSchema = z.enum(["agent-final-text"]);
1065
1086
  const sendMessageSchema = z.object({
1066
1087
  format: messageFormatSchema.default("text"),
1067
1088
  content: z.unknown(),
@@ -1069,7 +1090,8 @@ const sendMessageSchema = z.object({
1069
1090
  inReplyTo: z.string().optional(),
1070
1091
  replyToInbox: z.string().optional(),
1071
1092
  replyToChat: z.string().optional(),
1072
- source: messageSourceSchema.optional()
1093
+ source: messageSourceSchema.optional(),
1094
+ purpose: messagePurposeSchema.optional()
1073
1095
  });
1074
1096
  const sendToAgentSchema = z.object({
1075
1097
  format: messageFormatSchema.default("text"),
@@ -1077,7 +1099,8 @@ const sendToAgentSchema = z.object({
1077
1099
  metadata: z.record(z.string(), z.unknown()).optional(),
1078
1100
  replyToInbox: z.string().optional(),
1079
1101
  replyToChat: z.string().optional(),
1080
- source: messageSourceSchema.optional()
1102
+ source: messageSourceSchema.optional(),
1103
+ direct: z.boolean().optional()
1081
1104
  });
1082
1105
  const messageSchema = z.object({
1083
1106
  id: z.string(),
@@ -1297,6 +1320,10 @@ z.object({
1297
1320
  lastReadAt: z.string(),
1298
1321
  unreadMentionCount: z.number().int()
1299
1322
  });
1323
+ z.object({
1324
+ chatId: z.string(),
1325
+ unreadMentionCount: z.number().int()
1326
+ });
1300
1327
  z.object({
1301
1328
  chatId: z.string(),
1302
1329
  membershipKind: meChatMembershipKindSchema.nullable()
@@ -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-1XGLJMOq.mjs";
3
+ import { r as AGENT_SELECTOR_HEADER } from "./dist-DmYxT5Kb.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, d as startServer, g as promptMissingFields, h as promptAddAgent, j as checkNodeVersion, k as checkDatabase, lt as FirstTreeHubSDK, m as isInteractive, n as deriveHubUrlFromToken, nt as hasUser, q as isDockerAvailable, t as HubUrlDerivationError, tt as createOwner, ut as SdkError, y as onboardCheck, z as installClientService } from "./saas-connect-BBRxjmBS.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, d as startServer, g as promptMissingFields, h as promptAddAgent, j as checkNodeVersion, k as checkDatabase, lt as FirstTreeHubSDK, m as isInteractive, n as deriveHubUrlFromToken, nt as hasUser, q as isDockerAvailable, t as HubUrlDerivationError, tt as createOwner, ut as SdkError, y as onboardCheck, z as installClientService } from "./saas-connect-DgCSZ8Yk.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-C15ZBOCC.mjs";
5
5
  import { i as blank, s as status } from "./cli-fetch--tiwKm5S.mjs";
6
- import "./dist-1XGLJMOq.mjs";
7
- import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-BGx71p5s.mjs";
8
- import "./errors-LPcARA4K-Dbrptiyz.mjs";
6
+ import "./dist-DmYxT5Kb.mjs";
7
+ import { n as bindFeishuUser, t as bindFeishuBot } from "./feishu-CCWd-JE4.mjs";
8
+ import "./uuid-DbS_4vFh-iFghv4zA.mjs";
9
9
  import "./src-DNBS5Yjj.mjs";
10
- import "./client-CzXmweS9-DhUiuQvL.mjs";
11
- import "./invitation-DZO4NX3P-BPxTeHf-.mjs";
10
+ import "./client-CZ_VnbEc-CBF46cJd.mjs";
11
+ import "./invitation-D_ENPHyj-5ETiae5r.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 };
@@ -0,0 +1,4 @@
1
+ import "./dist-DmYxT5Kb.mjs";
2
+ import "./uuid-DbS_4vFh-iFghv4zA.mjs";
3
+ import { s as previewInvitation } from "./invitation-D_ENPHyj-5ETiae5r.mjs";
4
+ export { previewInvitation };
@@ -1,28 +1,8 @@
1
- import { l as organizations, s as NotFoundError, u as users } from "./errors-LPcARA4K-Dbrptiyz.mjs";
1
+ import { c as NotFoundError, d as users, f as uuidv7, u as organizations } from "./uuid-DbS_4vFh-iFghv4zA.mjs";
2
2
  import { randomBytes } from "node:crypto";
3
3
  import { and, desc, eq, gt, isNull, or } from "drizzle-orm";
4
4
  import { index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
5
- //#region ../server/dist/invitation-DZO4NX3P.mjs
6
- /** Generate a UUID v7 (time-ordered). No external dependency. */
7
- function uuidv7() {
8
- const now = BigInt(Date.now());
9
- const bytes = new Uint8Array(16);
10
- bytes[0] = Number(now >> 40n & 255n);
11
- bytes[1] = Number(now >> 32n & 255n);
12
- bytes[2] = Number(now >> 24n & 255n);
13
- bytes[3] = Number(now >> 16n & 255n);
14
- bytes[4] = Number(now >> 8n & 255n);
15
- bytes[5] = Number(now & 255n);
16
- const rand = randomBytes(10);
17
- for (let i = 0; i < 10; i++) {
18
- const b = rand[i];
19
- if (b !== void 0) bytes[6 + i] = b;
20
- }
21
- bytes[6] = (bytes[6] ?? 0) & 15 | 112;
22
- bytes[8] = (bytes[8] ?? 0) & 63 | 128;
23
- const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
24
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
25
- }
5
+ //#region ../server/dist/invitation-D_ENPHyj.mjs
26
6
  /**
27
7
  * Org-level invitation links. v1 enforces "one active link per org" via a
28
8
  * partial UNIQUE index added in the SQL migration (Drizzle's TS DSL does not
@@ -184,4 +164,4 @@ function buildInviteUrl(publicUrl, token) {
184
164
  return `${publicUrl.replace(/\/+$/, "")}/invite/${token}`;
185
165
  }
186
166
  //#endregion
187
- export { invitationRedemptions as a, recordRedemption as c, getActiveInvitation as i, rotateInvitation as l, ensureActiveInvitation as n, invitations as o, findActiveByToken as r, previewInvitation as s, buildInviteUrl as t, uuidv7 as u };
167
+ export { invitationRedemptions as a, recordRedemption as c, getActiveInvitation as i, rotateInvitation as l, ensureActiveInvitation as n, invitations as o, findActiveByToken as r, previewInvitation as s, buildInviteUrl as t };