@agent-team-foundation/first-tree-hub 0.10.15 → 0.11.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.
Files changed (44) hide show
  1. package/dist/{bootstrap-DUeYbwm-.mjs → bootstrap-TJRy0B9m.mjs} +10 -2
  2. package/dist/chunk-BSw8zbkd.mjs +37 -0
  3. package/dist/cli/index.mjs +94 -35
  4. package/dist/client-BCaK653p-CZjDNcdM.mjs +516 -0
  5. package/dist/client-m1OM4Iag-HKWgB3Yk.mjs +4 -0
  6. package/dist/dist-BLY7Bu-l.mjs +430 -0
  7. package/dist/{dist-D6AOiyNg.mjs → dist-BkvrONSQ.mjs} +67 -23
  8. package/dist/drizzle/0030_chat_first_workspace.sql +129 -0
  9. package/dist/drizzle/0031_drop_system_configs.sql +11 -0
  10. package/dist/drizzle/meta/_journal.json +14 -0
  11. package/dist/errors-BmyRwN0Y-CIZZ_sDc.mjs +92 -0
  12. package/dist/{esm-CYu4tXXn.mjs → esm-iadMkGbV.mjs} +2 -37
  13. package/dist/execAsync-CCyouKZM.mjs +10 -0
  14. package/dist/{execAsync-XMc-nFn-.mjs → execAsync-pImxPKN5.mjs} +1 -1
  15. package/dist/{feishu-DQ1l18Ah.mjs → feishu-AEMHwT6L.mjs} +2 -2
  16. package/dist/from-CaD373S1.mjs +3840 -0
  17. package/dist/{getMachineId-bsd-D0w3uAZa.mjs → getMachineId-bsd-DR4-Dysy.mjs} +3 -2
  18. package/dist/getMachineId-bsd-DjLgZlll.mjs +27 -0
  19. package/dist/getMachineId-darwin-B6WCAhc4.mjs +24 -0
  20. package/dist/{getMachineId-darwin-DOoYFb2_.mjs → getMachineId-darwin-CaD2juTg.mjs} +3 -2
  21. package/dist/getMachineId-linux-BeWHG1gK.mjs +20 -0
  22. package/dist/{getMachineId-linux-MlY63Zsw.mjs → getMachineId-linux-Dk3gWdQK.mjs} +2 -1
  23. package/dist/getMachineId-unsupported-BMJQItvF.mjs +15 -0
  24. package/dist/{getMachineId-unsupported-BS652RIy.mjs → getMachineId-unsupported-Bgz_Je1J.mjs} +2 -1
  25. package/dist/getMachineId-win-CdgcrzCW.mjs +26 -0
  26. package/dist/{getMachineId-win-B6hY8edq.mjs → getMachineId-win-vJ6VfDRI.mjs} +3 -2
  27. package/dist/index.mjs +9 -6
  28. package/dist/invitation-DWlyNb8x-DZTW9I26.mjs +4 -0
  29. package/dist/{invitation-B1pjAyOz-BaCA9PII.mjs → invitation-Dnn5gGGX-Ce7zbZpn.mjs} +4 -90
  30. package/dist/multipart-parser-BIksYTkk.mjs +294 -0
  31. package/dist/observability-C3nY6Jcz-Dpsi3eFk.mjs +96006 -0
  32. package/dist/observability-Co8OO0og.mjs +5 -0
  33. package/dist/{saas-connect-CebXWFF-.mjs → saas-connect-Bd0g0v_b.mjs} +6543 -6043
  34. package/dist/src-DNBS5Yjj.mjs +735 -0
  35. package/dist/src-uVZSbShB.mjs +1176 -0
  36. package/dist/web/assets/{index-CKoTjI0J.css → index-7RvlJjJ9.css} +1 -1
  37. package/dist/web/assets/{index-BQda2sqe.js → index-Dbwa40_B.js} +1 -1
  38. package/dist/web/assets/index-cpdSFHAJ.js +383 -0
  39. package/dist/web/index.html +2 -2
  40. package/package.json +1 -1
  41. package/dist/invitation-CBnQyB7o-Bulf3Sl7.mjs +0 -3
  42. package/dist/observability-C08jUFsJ.mjs +0 -4
  43. package/dist/observability-DPyf745N-BSc8QNcR.mjs +0 -33897
  44. package/dist/web/assets/index-C7yW7sWI.js +0 -388
@@ -0,0 +1,430 @@
1
+ import { i as __require, t as __commonJSMin } from "./chunk-BSw8zbkd.mjs";
2
+ import { t as require_src } from "./src-DNBS5Yjj.mjs";
3
+ //#region ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
4
+ var require_helpers = /* @__PURE__ */ __commonJSMin(((exports) => {
5
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === void 0) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
9
+ enumerable: true,
10
+ get: function() {
11
+ return m[k];
12
+ }
13
+ };
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === void 0) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", {
21
+ enumerable: true,
22
+ value: v
23
+ });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = exports && exports.__importStar || function(mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) {
31
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
+ }
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.req = exports.json = exports.toBuffer = void 0;
38
+ const http$1 = __importStar(__require("http"));
39
+ const https = __importStar(__require("https"));
40
+ async function toBuffer(stream) {
41
+ let length = 0;
42
+ const chunks = [];
43
+ for await (const chunk of stream) {
44
+ length += chunk.length;
45
+ chunks.push(chunk);
46
+ }
47
+ return Buffer.concat(chunks, length);
48
+ }
49
+ exports.toBuffer = toBuffer;
50
+ async function json(stream) {
51
+ const str = (await toBuffer(stream)).toString("utf8");
52
+ try {
53
+ return JSON.parse(str);
54
+ } catch (_err) {
55
+ const err = _err;
56
+ err.message += ` (input: ${str})`;
57
+ throw err;
58
+ }
59
+ }
60
+ exports.json = json;
61
+ function req(url, opts = {}) {
62
+ const req = ((typeof url === "string" ? url : url.href).startsWith("https:") ? https : http$1).request(url, opts);
63
+ const promise = new Promise((resolve, reject) => {
64
+ req.once("response", resolve).once("error", reject).end();
65
+ });
66
+ req.then = promise.then.bind(promise);
67
+ return req;
68
+ }
69
+ exports.req = req;
70
+ }));
71
+ //#endregion
72
+ //#region ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
73
+ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
74
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
75
+ if (k2 === void 0) k2 = k;
76
+ var desc = Object.getOwnPropertyDescriptor(m, k);
77
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
78
+ enumerable: true,
79
+ get: function() {
80
+ return m[k];
81
+ }
82
+ };
83
+ Object.defineProperty(o, k2, desc);
84
+ }) : (function(o, m, k, k2) {
85
+ if (k2 === void 0) k2 = k;
86
+ o[k2] = m[k];
87
+ }));
88
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
89
+ Object.defineProperty(o, "default", {
90
+ enumerable: true,
91
+ value: v
92
+ });
93
+ }) : function(o, v) {
94
+ o["default"] = v;
95
+ });
96
+ var __importStar = exports && exports.__importStar || function(mod) {
97
+ if (mod && mod.__esModule) return mod;
98
+ var result = {};
99
+ if (mod != null) {
100
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
101
+ }
102
+ __setModuleDefault(result, mod);
103
+ return result;
104
+ };
105
+ var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
106
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
107
+ };
108
+ Object.defineProperty(exports, "__esModule", { value: true });
109
+ exports.Agent = void 0;
110
+ const net$1 = __importStar(__require("net"));
111
+ const http = __importStar(__require("http"));
112
+ const https_1 = __require("https");
113
+ __exportStar(require_helpers(), exports);
114
+ const INTERNAL = Symbol("AgentBaseInternalState");
115
+ var Agent = class extends http.Agent {
116
+ constructor(opts) {
117
+ super(opts);
118
+ this[INTERNAL] = {};
119
+ }
120
+ /**
121
+ * Determine whether this is an `http` or `https` request.
122
+ */
123
+ isSecureEndpoint(options) {
124
+ if (options) {
125
+ if (typeof options.secureEndpoint === "boolean") return options.secureEndpoint;
126
+ if (typeof options.protocol === "string") return options.protocol === "https:";
127
+ }
128
+ const { stack } = /* @__PURE__ */ new Error();
129
+ if (typeof stack !== "string") return false;
130
+ return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
131
+ }
132
+ incrementSockets(name) {
133
+ if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) return null;
134
+ if (!this.sockets[name]) this.sockets[name] = [];
135
+ const fakeSocket = new net$1.Socket({ writable: false });
136
+ this.sockets[name].push(fakeSocket);
137
+ this.totalSocketCount++;
138
+ return fakeSocket;
139
+ }
140
+ decrementSockets(name, socket) {
141
+ if (!this.sockets[name] || socket === null) return;
142
+ const sockets = this.sockets[name];
143
+ const index = sockets.indexOf(socket);
144
+ if (index !== -1) {
145
+ sockets.splice(index, 1);
146
+ this.totalSocketCount--;
147
+ if (sockets.length === 0) delete this.sockets[name];
148
+ }
149
+ }
150
+ getName(options) {
151
+ if (this.isSecureEndpoint(options)) return https_1.Agent.prototype.getName.call(this, options);
152
+ return super.getName(options);
153
+ }
154
+ createSocket(req, options, cb) {
155
+ const connectOpts = {
156
+ ...options,
157
+ secureEndpoint: this.isSecureEndpoint(options)
158
+ };
159
+ const name = this.getName(connectOpts);
160
+ const fakeSocket = this.incrementSockets(name);
161
+ Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
162
+ this.decrementSockets(name, fakeSocket);
163
+ if (socket instanceof http.Agent) try {
164
+ return socket.addRequest(req, connectOpts);
165
+ } catch (err) {
166
+ return cb(err);
167
+ }
168
+ this[INTERNAL].currentSocket = socket;
169
+ super.createSocket(req, options, cb);
170
+ }, (err) => {
171
+ this.decrementSockets(name, fakeSocket);
172
+ cb(err);
173
+ });
174
+ }
175
+ createConnection() {
176
+ const socket = this[INTERNAL].currentSocket;
177
+ this[INTERNAL].currentSocket = void 0;
178
+ if (!socket) throw new Error("No socket was returned in the `connect()` function");
179
+ return socket;
180
+ }
181
+ get defaultPort() {
182
+ return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
183
+ }
184
+ set defaultPort(v) {
185
+ if (this[INTERNAL]) this[INTERNAL].defaultPort = v;
186
+ }
187
+ get protocol() {
188
+ return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
189
+ }
190
+ set protocol(v) {
191
+ if (this[INTERNAL]) this[INTERNAL].protocol = v;
192
+ }
193
+ };
194
+ exports.Agent = Agent;
195
+ }));
196
+ //#endregion
197
+ //#region ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js
198
+ var require_parse_proxy_response = /* @__PURE__ */ __commonJSMin(((exports) => {
199
+ var __importDefault = exports && exports.__importDefault || function(mod) {
200
+ return mod && mod.__esModule ? mod : { "default": mod };
201
+ };
202
+ Object.defineProperty(exports, "__esModule", { value: true });
203
+ exports.parseProxyResponse = void 0;
204
+ const debug = (0, __importDefault(require_src()).default)("https-proxy-agent:parse-proxy-response");
205
+ function parseProxyResponse(socket) {
206
+ return new Promise((resolve, reject) => {
207
+ let buffersLength = 0;
208
+ const buffers = [];
209
+ function read() {
210
+ const b = socket.read();
211
+ if (b) ondata(b);
212
+ else socket.once("readable", read);
213
+ }
214
+ function cleanup() {
215
+ socket.removeListener("end", onend);
216
+ socket.removeListener("error", onerror);
217
+ socket.removeListener("readable", read);
218
+ }
219
+ function onend() {
220
+ cleanup();
221
+ debug("onend");
222
+ reject(/* @__PURE__ */ new Error("Proxy connection ended before receiving CONNECT response"));
223
+ }
224
+ function onerror(err) {
225
+ cleanup();
226
+ debug("onerror %o", err);
227
+ reject(err);
228
+ }
229
+ function ondata(b) {
230
+ buffers.push(b);
231
+ buffersLength += b.length;
232
+ const buffered = Buffer.concat(buffers, buffersLength);
233
+ const endOfHeaders = buffered.indexOf("\r\n\r\n");
234
+ if (endOfHeaders === -1) {
235
+ debug("have not received end of HTTP headers yet...");
236
+ read();
237
+ return;
238
+ }
239
+ const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
240
+ const firstLine = headerParts.shift();
241
+ if (!firstLine) {
242
+ socket.destroy();
243
+ return reject(/* @__PURE__ */ new Error("No header received from proxy CONNECT response"));
244
+ }
245
+ const firstLineParts = firstLine.split(" ");
246
+ const statusCode = +firstLineParts[1];
247
+ const statusText = firstLineParts.slice(2).join(" ");
248
+ const headers = {};
249
+ for (const header of headerParts) {
250
+ if (!header) continue;
251
+ const firstColon = header.indexOf(":");
252
+ if (firstColon === -1) {
253
+ socket.destroy();
254
+ return reject(/* @__PURE__ */ new Error(`Invalid header from proxy CONNECT response: "${header}"`));
255
+ }
256
+ const key = header.slice(0, firstColon).toLowerCase();
257
+ const value = header.slice(firstColon + 1).trimStart();
258
+ const current = headers[key];
259
+ if (typeof current === "string") headers[key] = [current, value];
260
+ else if (Array.isArray(current)) current.push(value);
261
+ else headers[key] = value;
262
+ }
263
+ debug("got proxy server response: %o %o", firstLine, headers);
264
+ cleanup();
265
+ resolve({
266
+ connect: {
267
+ statusCode,
268
+ statusText,
269
+ headers
270
+ },
271
+ buffered
272
+ });
273
+ }
274
+ socket.on("error", onerror);
275
+ socket.on("end", onend);
276
+ read();
277
+ });
278
+ }
279
+ exports.parseProxyResponse = parseProxyResponse;
280
+ }));
281
+ //#endregion
282
+ //#region ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js
283
+ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
284
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
285
+ if (k2 === void 0) k2 = k;
286
+ var desc = Object.getOwnPropertyDescriptor(m, k);
287
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
288
+ enumerable: true,
289
+ get: function() {
290
+ return m[k];
291
+ }
292
+ };
293
+ Object.defineProperty(o, k2, desc);
294
+ }) : (function(o, m, k, k2) {
295
+ if (k2 === void 0) k2 = k;
296
+ o[k2] = m[k];
297
+ }));
298
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
299
+ Object.defineProperty(o, "default", {
300
+ enumerable: true,
301
+ value: v
302
+ });
303
+ }) : function(o, v) {
304
+ o["default"] = v;
305
+ });
306
+ var __importStar = exports && exports.__importStar || function(mod) {
307
+ if (mod && mod.__esModule) return mod;
308
+ var result = {};
309
+ if (mod != null) {
310
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
311
+ }
312
+ __setModuleDefault(result, mod);
313
+ return result;
314
+ };
315
+ var __importDefault = exports && exports.__importDefault || function(mod) {
316
+ return mod && mod.__esModule ? mod : { "default": mod };
317
+ };
318
+ Object.defineProperty(exports, "__esModule", { value: true });
319
+ exports.HttpsProxyAgent = void 0;
320
+ const net = __importStar(__require("net"));
321
+ const tls = __importStar(__require("tls"));
322
+ const assert_1 = __importDefault(__require("assert"));
323
+ const debug_1 = __importDefault(require_src());
324
+ const agent_base_1 = require_dist$1();
325
+ const url_1 = __require("url");
326
+ const parse_proxy_response_1 = require_parse_proxy_response();
327
+ const debug = (0, debug_1.default)("https-proxy-agent");
328
+ const setServernameFromNonIpHost = (options) => {
329
+ if (options.servername === void 0 && options.host && !net.isIP(options.host)) return {
330
+ ...options,
331
+ servername: options.host
332
+ };
333
+ return options;
334
+ };
335
+ /**
336
+ * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
337
+ * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
338
+ *
339
+ * Outgoing HTTP requests are first tunneled through the proxy server using the
340
+ * `CONNECT` HTTP request method to establish a connection to the proxy server,
341
+ * and then the proxy server connects to the destination target and issues the
342
+ * HTTP request from the proxy server.
343
+ *
344
+ * `https:` requests have their socket connection upgraded to TLS once
345
+ * the connection to the proxy server has been established.
346
+ */
347
+ var HttpsProxyAgent = class extends agent_base_1.Agent {
348
+ constructor(proxy, opts) {
349
+ super(opts);
350
+ this.options = { path: void 0 };
351
+ this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
352
+ this.proxyHeaders = opts?.headers ?? {};
353
+ debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
354
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
355
+ const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
356
+ this.connectOpts = {
357
+ ALPNProtocols: ["http/1.1"],
358
+ ...opts ? omit(opts, "headers") : null,
359
+ host,
360
+ port
361
+ };
362
+ }
363
+ /**
364
+ * Called when the node-core HTTP client library is creating a
365
+ * new HTTP request.
366
+ */
367
+ async connect(req, opts) {
368
+ const { proxy } = this;
369
+ if (!opts.host) throw new TypeError("No \"host\" provided");
370
+ let socket;
371
+ if (proxy.protocol === "https:") {
372
+ debug("Creating `tls.Socket`: %o", this.connectOpts);
373
+ socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
374
+ } else {
375
+ debug("Creating `net.Socket`: %o", this.connectOpts);
376
+ socket = net.connect(this.connectOpts);
377
+ }
378
+ const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
379
+ const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
380
+ let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
381
+ if (proxy.username || proxy.password) {
382
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
383
+ headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
384
+ }
385
+ headers.Host = `${host}:${opts.port}`;
386
+ if (!headers["Proxy-Connection"]) headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
387
+ for (const name of Object.keys(headers)) payload += `${name}: ${headers[name]}\r\n`;
388
+ const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
389
+ socket.write(`${payload}\r\n`);
390
+ const { connect, buffered } = await proxyResponsePromise;
391
+ req.emit("proxyConnect", connect);
392
+ this.emit("proxyConnect", connect, req);
393
+ if (connect.statusCode === 200) {
394
+ req.once("socket", resume);
395
+ if (opts.secureEndpoint) {
396
+ debug("Upgrading socket connection to TLS");
397
+ return tls.connect({
398
+ ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
399
+ socket
400
+ });
401
+ }
402
+ return socket;
403
+ }
404
+ socket.destroy();
405
+ const fakeSocket = new net.Socket({ writable: false });
406
+ fakeSocket.readable = true;
407
+ req.once("socket", (s) => {
408
+ debug("Replaying proxy buffer for failed request");
409
+ (0, assert_1.default)(s.listenerCount("data") > 0);
410
+ s.push(buffered);
411
+ s.push(null);
412
+ });
413
+ return fakeSocket;
414
+ }
415
+ };
416
+ HttpsProxyAgent.protocols = ["http", "https"];
417
+ exports.HttpsProxyAgent = HttpsProxyAgent;
418
+ function resume(socket) {
419
+ socket.resume();
420
+ }
421
+ function omit(obj, ...keys) {
422
+ const ret = {};
423
+ let key;
424
+ for (key in obj) if (!keys.includes(key)) ret[key] = obj[key];
425
+ return ret;
426
+ }
427
+ }));
428
+ //#endregion
429
+ export default require_dist();
430
+ export {};
@@ -1,6 +1,13 @@
1
1
  import { z } from "zod";
2
2
  //#region ../shared/dist/index.mjs
3
3
  const MENTION_REGEX = /(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\b/g;
4
+ /**
5
+ * Strip Markdown code regions (fenced + inline) so identifier-shaped
6
+ * tokens inside code (`@param`, `@staticmethod`, etc.) don't get
7
+ * misclassified as mentions. Shared between `extractMentions` (routing)
8
+ * and `extractSummary` (auto-title) so they agree on what counts as a
9
+ * "real" mention vs a code reference.
10
+ */
4
11
  function stripCode(content) {
5
12
  return content.replace(/```[\s\S]*?```/g, "").replace(/~~~[\s\S]*?~~~/g, "").replace(/`[^`\n]+`/g, "");
6
13
  }
@@ -577,7 +584,11 @@ z.object({
577
584
  metadata: z.record(z.string(), z.unknown()),
578
585
  createdAt: z.string(),
579
586
  updatedAt: z.string()
580
- }).extend({ participants: z.array(chatParticipantSchema) });
587
+ }).extend({
588
+ participants: z.array(chatParticipantSchema),
589
+ title: z.string(),
590
+ firstMessagePreview: z.string().nullable()
591
+ });
581
592
  const updateChatSchema = z.object({ topic: z.string().trim().max(500).nullable() });
582
593
  const addParticipantSchema = z.object({
583
594
  agentId: z.string().min(1),
@@ -876,6 +887,59 @@ z.object({
876
887
  /** Body for joining via invite token. */
877
888
  const joinByInvitationSchema = z.object({ token: z.string().min(1) });
878
889
  z.object({}).optional();
890
+ const meChatFilterSchema = z.enum([
891
+ "all",
892
+ "unread",
893
+ "watching"
894
+ ]);
895
+ const meChatMembershipKindSchema = z.enum(["participant", "watching"]);
896
+ const listMeChatsQuerySchema = z.object({
897
+ cursor: z.string().optional(),
898
+ limit: z.coerce.number().int().min(1).max(200).default(50),
899
+ filter: meChatFilterSchema.default("all")
900
+ });
901
+ const meChatParticipantSchema = z.object({
902
+ agentId: z.string(),
903
+ displayName: z.string(),
904
+ type: z.string()
905
+ });
906
+ const meChatRowSchema = z.object({
907
+ chatId: z.string(),
908
+ type: z.string(),
909
+ membershipKind: meChatMembershipKindSchema,
910
+ title: z.string(),
911
+ topic: z.string().nullable(),
912
+ participants: z.array(meChatParticipantSchema),
913
+ participantCount: z.number().int(),
914
+ lastMessageAt: z.string().nullable(),
915
+ lastMessagePreview: z.string().nullable(),
916
+ unreadMentionCount: z.number().int(),
917
+ canReply: z.boolean(),
918
+ taskId: z.string().nullable(),
919
+ taskStatus: z.string().nullable()
920
+ });
921
+ z.object({
922
+ rows: z.array(meChatRowSchema),
923
+ nextCursor: z.string().nullable()
924
+ });
925
+ const createMeChatSchema = z.object({
926
+ participantIds: z.array(z.string().min(1)).min(1),
927
+ topic: z.string().trim().max(500).optional().nullable()
928
+ });
929
+ const addMeChatParticipantsSchema = z.object({ participantIds: z.array(z.string().min(1)).min(1) });
930
+ z.object({
931
+ chatId: z.string(),
932
+ lastReadAt: z.string(),
933
+ unreadMentionCount: z.number().int()
934
+ });
935
+ z.object({
936
+ chatId: z.string(),
937
+ membershipKind: meChatMembershipKindSchema.nullable()
938
+ });
939
+ z.object({
940
+ type: z.literal("chat:message"),
941
+ chatId: z.string()
942
+ });
879
943
  z.enum([
880
944
  "connect",
881
945
  "create_agent",
@@ -892,8 +956,6 @@ const createOrgFromMeSchema = z.object({
892
956
  name: z.string().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),
893
957
  displayName: z.string().min(1).max(200)
894
958
  });
895
- /** Body for `POST /auth/switch-org`. */
896
- const switchOrgSchema = z.object({ organizationId: z.string().min(1) });
897
959
  z.object({
898
960
  id: z.string(),
899
961
  organizationId: z.string(),
@@ -981,7 +1043,7 @@ const githubDevCallbackQuerySchema = z.object({
981
1043
  next: z.string().max(256).optional()
982
1044
  });
983
1045
  const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
984
- const createOrganizationSchema = z.object({
1046
+ z.object({
985
1047
  name: z.string().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/, "Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine((v) => !UUID_PATTERN.test(v), "Name must not be a UUID format"),
986
1048
  displayName: z.string().min(1).max(200),
987
1049
  maxAgents: z.number().int().min(0).default(0),
@@ -1136,24 +1198,6 @@ z.object({
1136
1198
  totalMessages: z.number(),
1137
1199
  byOrganization: z.array(orgStatsSchema)
1138
1200
  });
1139
- z.object({
1140
- key: z.string(),
1141
- value: z.unknown(),
1142
- updatedAt: z.string()
1143
- });
1144
- const updateSystemConfigSchema = z.record(z.string(), z.unknown());
1145
- const SYSTEM_CONFIG_KEYS = {
1146
- INBOX_TIMEOUT_SECONDS: "inbox_timeout_seconds",
1147
- MAX_RETRY_COUNT: "max_retry_count",
1148
- POLLING_INTERVAL_SECONDS: "polling_interval_seconds",
1149
- PRESENCE_CLEANUP_SECONDS: "presence_cleanup_seconds"
1150
- };
1151
- const SYSTEM_CONFIG_DEFAULTS = {
1152
- [SYSTEM_CONFIG_KEYS.INBOX_TIMEOUT_SECONDS]: 300,
1153
- [SYSTEM_CONFIG_KEYS.MAX_RETRY_COUNT]: 3,
1154
- [SYSTEM_CONFIG_KEYS.POLLING_INTERVAL_SECONDS]: 5,
1155
- [SYSTEM_CONFIG_KEYS.PRESENCE_CLEANUP_SECONDS]: 60
1156
- };
1157
1201
  /** Fixed 5-state machine. No custom statuses. */
1158
1202
  const TASK_STATUSES = {
1159
1203
  PENDING: "pending",
@@ -1325,4 +1369,4 @@ z.object({
1325
1369
  capabilities: serverCapabilitiesSchema.optional()
1326
1370
  }).passthrough();
1327
1371
  //#endregion
1328
- export { refreshTokenSchema as $, createOrgFromMeSchema as A, imageInlineContentSchema as B, clientRegisterSchema as C, createAgentSchema as D, createAdapterMappingSchema as E, dryRunAgentRuntimeConfigSchema as F, isReservedAgentName as G, inboxDeliverFrameSchema as H, extractMentions as I, loginSchema as J, joinByInvitationSchema as K, githubCallbackQuerySchema as L, createTaskSchema as M, defaultRuntimeConfigPayload as N, createChatSchema as O, delegateFeishuUserSchema as P, rebindAgentSchema as Q, githubDevCallbackQuerySchema as R, clientCapabilitiesSchema as S, wsAuthFrameSchema as St, createAdapterConfigSchema as T, inboxPollQuerySchema as U, inboxAckFrameSchema as V, isRedactedEnvValue as W, notificationQuerySchema as X, messageSourceSchema as Y, paginationQuerySchema as Z, adminUpdateTaskSchema as _, updateClientCapabilitiesSchema as _t, AGENT_STATUSES as a, sendToAgentSchema as at, agentRuntimeConfigPayloadSchema as b, updateSystemConfigSchema as bt, DEFAULT_RUNTIME_PROVIDER as c, sessionEventSchema as ct, TASK_HEALTH_SIGNALS as d, switchOrgSchema as dt, runtimeStateMessageSchema as et, TASK_STATUSES as f, taskListQuerySchema as ft, adminCreateTaskSchema as g, updateChatSchema as gt, addParticipantSchema as h, updateAgentSchema as ht, AGENT_SOURCES as i, sendMessageSchema as it, createOrganizationSchema as j, createMemberSchema as k, SYSTEM_CONFIG_DEFAULTS as l, sessionReconcileRequestSchema as lt, WS_AUTH_FRAME_TIMEOUT_MS as m, updateAgentRuntimeConfigSchema as mt, AGENT_NAME_REGEX as n, scanMentionTokens as nt, AGENT_TYPES as o, sessionCompletionMessageSchema as ot, TASK_TERMINAL_STATUSES as p, updateAdapterConfigSchema as pt, linkTaskChatSchema as q, AGENT_SELECTOR_HEADER as r, selfServiceFeishuBotSchema as rt, AGENT_VISIBILITY as s, sessionEventMessageSchema as st, AGENT_BIND_REJECT_REASONS as t, safeRedirectPath as tt, TASK_CREATOR_TYPES as u, sessionStateMessageSchema as ut, agentBindRequestSchema as v, updateMemberSchema as vt, connectTokenExchangeSchema as w, agentTypeSchema as x, updateTaskStatusSchema as xt, agentPinnedMessageSchema as y, updateOrganizationSchema as yt, githubStartQuerySchema as z };
1372
+ export { paginationQuerySchema as $, createMeChatSchema as A, githubStartQuerySchema as B, clientCapabilitiesSchema as C, wsAuthFrameSchema as Ct, createAdapterMappingSchema as D, createAdapterConfigSchema as E, delegateFeishuUserSchema as F, isRedactedEnvValue as G, inboxAckFrameSchema as H, dryRunAgentRuntimeConfigSchema as I, linkTaskChatSchema as J, isReservedAgentName as K, extractMentions as L, createOrgFromMeSchema as M, createTaskSchema as N, createAgentSchema as O, defaultRuntimeConfigPayload as P, notificationQuerySchema as Q, githubCallbackQuerySchema as R, agentTypeSchema as S, updateTaskStatusSchema as St, connectTokenExchangeSchema as T, inboxDeliverFrameSchema as U, imageInlineContentSchema as V, inboxPollQuerySchema as W, loginSchema as X, listMeChatsQuerySchema as Y, messageSourceSchema as Z, adminCreateTaskSchema as _, updateAgentSchema as _t, AGENT_STATUSES as a, selfServiceFeishuBotSchema as at, agentPinnedMessageSchema as b, updateMemberSchema as bt, DEFAULT_RUNTIME_PROVIDER as c, sessionCompletionMessageSchema as ct, TASK_HEALTH_SIGNALS as d, sessionReconcileRequestSchema as dt, rebindAgentSchema as et, TASK_STATUSES as f, sessionStateMessageSchema as ft, addParticipantSchema as g, updateAgentRuntimeConfigSchema as gt, addMeChatParticipantsSchema as h, updateAdapterConfigSchema as ht, AGENT_SOURCES as i, scanMentionTokens as it, createMemberSchema as j, createChatSchema as k, MENTION_REGEX as l, sessionEventMessageSchema as lt, WS_AUTH_FRAME_TIMEOUT_MS as m, taskListQuerySchema as mt, AGENT_NAME_REGEX as n, runtimeStateMessageSchema as nt, AGENT_TYPES as o, sendMessageSchema as ot, TASK_TERMINAL_STATUSES as p, stripCode as pt, joinByInvitationSchema as q, AGENT_SELECTOR_HEADER as r, safeRedirectPath as rt, AGENT_VISIBILITY as s, sendToAgentSchema as st, AGENT_BIND_REJECT_REASONS as t, refreshTokenSchema as tt, TASK_CREATOR_TYPES as u, sessionEventSchema as ut, adminUpdateTaskSchema as v, updateChatSchema as vt, clientRegisterSchema as w, agentRuntimeConfigPayloadSchema as x, updateOrganizationSchema as xt, agentBindRequestSchema as y, updateClientCapabilitiesSchema as yt, githubDevCallbackQuerySchema as z };