@bike4mind/cli 0.2.82 → 0.4.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/{ConfigStore-DTyUBb3A.mjs → ConfigStore-DBUmvCfe.mjs} +546 -116
- package/dist/commands/doctorCommand.mjs +1 -1
- package/dist/commands/headlessCommand.mjs +8 -4
- package/dist/commands/mcpCommand.mjs +1 -1
- package/dist/commands/updateCommand.mjs +1 -1
- package/dist/index.mjs +874 -23
- package/dist/{store-Dw1nZX2Y.mjs → store-B7-LLvvx.mjs} +18 -0
- package/dist/store-B_ILRSdP.mjs +3 -0
- package/dist/{tools-C0eJHV0Y.mjs → tools-DiSJh1Dv.mjs} +564 -111
- package/dist/{treeSitterEngine-DCSXcm_3.mjs → treeSitterEngine-BFTHnDwH.mjs} +4 -1
- package/dist/{updateChecker-CPr5OfMn.mjs → updateChecker-DcJC1C8S.mjs} +1 -1
- package/package.json +25 -27
- package/dist/store-nZExNOWX.mjs +0 -3
|
@@ -6,7 +6,7 @@ import os, { homedir } from "os";
|
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { v4 } from "uuid";
|
|
8
8
|
import * as z$2 from "zod";
|
|
9
|
-
import z$1, { z } from "zod";
|
|
9
|
+
import z$1, { ZodError, z } from "zod";
|
|
10
10
|
import dayjs from "dayjs";
|
|
11
11
|
import timezone from "dayjs/plugin/timezone.js";
|
|
12
12
|
import utc from "dayjs/plugin/utc.js";
|
|
@@ -23,9 +23,41 @@ let CollectionType = /* @__PURE__ */ function(CollectionType) {
|
|
|
23
23
|
}({});
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region ../../b4m-core/common/dist/index.mjs
|
|
26
|
+
var HTTPError = class extends Error {
|
|
27
|
+
constructor(statusCode, message, additionalInfo) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.statusCode = statusCode;
|
|
30
|
+
this.additionalInfo = additionalInfo;
|
|
31
|
+
this.name = "HTTPError";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var InternalServerError = class extends HTTPError {
|
|
35
|
+
constructor(message, additionalInfo) {
|
|
36
|
+
super(500, message, additionalInfo);
|
|
37
|
+
this.additionalInfo = additionalInfo;
|
|
38
|
+
this.name = "InternalServerError";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var NotFoundError = class extends HTTPError {
|
|
42
|
+
constructor(message, additionalInfo) {
|
|
43
|
+
super(404, message, additionalInfo);
|
|
44
|
+
this.additionalInfo = additionalInfo;
|
|
45
|
+
this.name = "NotFoundError";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var UnprocessableEntityError = class extends HTTPError {
|
|
49
|
+
constructor(message, additionalInfo) {
|
|
50
|
+
super(422, message, additionalInfo);
|
|
51
|
+
this.additionalInfo = additionalInfo;
|
|
52
|
+
this.name = "UnprocessableEntityError";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
function isZodError(err) {
|
|
56
|
+
return Boolean(err && (err instanceof ZodError || err.name === "ZodError"));
|
|
57
|
+
}
|
|
26
58
|
/**
|
|
27
|
-
* Error thrown when user denies permission for a tool
|
|
28
|
-
* This should break the agent loop immediately and return control to the user
|
|
59
|
+
* Error thrown when user denies permission for a tool.
|
|
60
|
+
* This should break the agent loop immediately and return control to the user.
|
|
29
61
|
*/
|
|
30
62
|
var PermissionDeniedError = class extends Error {
|
|
31
63
|
constructor(toolName, toolArgs) {
|
|
@@ -35,6 +67,18 @@ var PermissionDeniedError = class extends Error {
|
|
|
35
67
|
this.name = "PermissionDeniedError";
|
|
36
68
|
}
|
|
37
69
|
};
|
|
70
|
+
function secureParameters(params, schema) {
|
|
71
|
+
try {
|
|
72
|
+
return schema.parse(params);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
if (isZodError(e)) throw new UnprocessableEntityError(e.issues.map((err) => `${err.path.join(".")}: ${err.message}`).join(", "));
|
|
75
|
+
throw new InternalServerError();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function obfuscateApiKey(apiKey) {
|
|
79
|
+
if (!apiKey) return apiKey;
|
|
80
|
+
return `${apiKey.slice(0, 3)}${"*".repeat(apiKey.length - 6)}${apiKey.slice(-3)}`;
|
|
81
|
+
}
|
|
38
82
|
/**
|
|
39
83
|
* Model backends
|
|
40
84
|
*/
|
|
@@ -57,6 +101,7 @@ let ImageModels = /* @__PURE__ */ function(ImageModels) {
|
|
|
57
101
|
ImageModels["GPT_IMAGE_1"] = "gpt-image-1";
|
|
58
102
|
ImageModels["GPT_IMAGE_1_5"] = "gpt-image-1.5";
|
|
59
103
|
ImageModels["GPT_IMAGE_1_MINI"] = "gpt-image-1-mini";
|
|
104
|
+
ImageModels["GPT_IMAGE_2"] = "gpt-image-2";
|
|
60
105
|
ImageModels["DALL_E_2"] = "dall-e-2";
|
|
61
106
|
ImageModels["FLUX_PRO"] = "flux-pro";
|
|
62
107
|
ImageModels["FLUX_PRO_1_1"] = "flux-pro-1.1";
|
|
@@ -105,6 +150,7 @@ let ChatModels = /* @__PURE__ */ function(ChatModels) {
|
|
|
105
150
|
ChatModels["GPT5_4"] = "gpt-5.4";
|
|
106
151
|
ChatModels["GPT5_4_MINI"] = "gpt-5.4-mini";
|
|
107
152
|
ChatModels["GPT5_4_NANO"] = "gpt-5.4-nano";
|
|
153
|
+
ChatModels["GPT5_5"] = "gpt-5.5";
|
|
108
154
|
ChatModels["LLAMA3_INSTRUCT_8B_V1"] = "meta.llama3-8b-instruct-v1:0";
|
|
109
155
|
ChatModels["LLAMA3_INSTRUCT_70B_V1"] = "meta.llama3-70b-instruct-v1:0";
|
|
110
156
|
ChatModels["LLAMA4_MAVERICK_17B_INSTRUCT_BEDROCK"] = "us.meta.llama4-maverick-17b-instruct-v1:0";
|
|
@@ -176,27 +222,30 @@ const supportedChatModels = z.enum(ChatModels);
|
|
|
176
222
|
* o1-preview and o1-mini do NOT support reasoning_effort.
|
|
177
223
|
*/
|
|
178
224
|
const REASONING_SUPPORTED_MODELS = new Set([
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
225
|
+
"o1-2024-12-17",
|
|
226
|
+
"o3-mini-2025-01-31",
|
|
227
|
+
"o3-2025-04-16",
|
|
228
|
+
"o4-mini-2025-04-16",
|
|
229
|
+
"gpt-5",
|
|
230
|
+
"gpt-5-mini",
|
|
231
|
+
"gpt-5-nano",
|
|
232
|
+
"gpt-5.1",
|
|
233
|
+
"gpt-5.2"
|
|
188
234
|
]);
|
|
189
235
|
/**
|
|
190
236
|
* Models that only support temperature=1 (no custom temperature).
|
|
191
|
-
* Includes
|
|
192
|
-
*
|
|
237
|
+
* Includes:
|
|
238
|
+
* - All reasoning models (OpenAI requires temp=1 when reasoning is active)
|
|
239
|
+
* - chat-latest variants that enforce this constraint
|
|
240
|
+
* - GPT-5.5, which rejects custom temperature even though it does not expose
|
|
241
|
+
* reasoning controls
|
|
193
242
|
*/
|
|
194
243
|
const FIXED_TEMPERATURE_MODELS = new Set([
|
|
195
244
|
...REASONING_SUPPORTED_MODELS,
|
|
196
|
-
|
|
197
|
-
|
|
245
|
+
"gpt-5.1-chat-latest",
|
|
246
|
+
"gpt-5.2-chat-latest",
|
|
247
|
+
"gpt-5.5"
|
|
198
248
|
]);
|
|
199
|
-
new Set([ChatModels.CLAUDE_4_7_OPUS, ChatModels.CLAUDE_4_7_OPUS_BEDROCK]);
|
|
200
249
|
/**
|
|
201
250
|
* Speech to Text Models
|
|
202
251
|
*
|
|
@@ -250,49 +299,62 @@ z$1.enum([
|
|
|
250
299
|
"gemini"
|
|
251
300
|
]);
|
|
252
301
|
z$1.enum(["openai"]);
|
|
253
|
-
VideoModels.SORA_2, VideoModels.SORA_2_PRO;
|
|
254
302
|
VIDEO_SIZE_CONSTRAINTS.SORA.durations;
|
|
255
303
|
VIDEO_SIZE_CONSTRAINTS.SORA.sizes;
|
|
256
304
|
z.object({
|
|
305
|
+
/** Text description of the video to generate */
|
|
257
306
|
prompt: z.string().min(1).max(1e4),
|
|
258
|
-
|
|
307
|
+
/** Model to use for generation */
|
|
308
|
+
model: z.enum(VideoModels).prefault("sora-2"),
|
|
309
|
+
/** Video duration in seconds: 4, 8, or 12 */
|
|
259
310
|
seconds: z.union([
|
|
260
311
|
z.literal(4),
|
|
261
312
|
z.literal(8),
|
|
262
313
|
z.literal(12)
|
|
263
314
|
]).prefault(4),
|
|
315
|
+
/** Video resolution */
|
|
264
316
|
size: z.enum([
|
|
265
317
|
"720x1280",
|
|
266
318
|
"1280x720",
|
|
267
319
|
"1024x1792",
|
|
268
320
|
"1792x1024"
|
|
269
321
|
]).prefault(VIDEO_SIZE_CONSTRAINTS.SORA.defaultSize),
|
|
322
|
+
/** Optional user identifier for abuse tracking */
|
|
270
323
|
user: z.string().optional()
|
|
271
324
|
});
|
|
272
325
|
z.object({
|
|
326
|
+
/** Unique identifier for the video generation job */
|
|
273
327
|
id: z.string(),
|
|
328
|
+
/** Current status of the job */
|
|
274
329
|
status: z.enum([
|
|
275
330
|
"queued",
|
|
276
331
|
"in_progress",
|
|
277
332
|
"completed",
|
|
278
333
|
"failed"
|
|
279
334
|
]),
|
|
335
|
+
/** Error message if the job failed */
|
|
280
336
|
error: z.object({
|
|
281
337
|
message: z.string(),
|
|
282
338
|
code: z.string().optional()
|
|
283
339
|
}).optional(),
|
|
340
|
+
/** Timestamp when the job was created */
|
|
284
341
|
created_at: z.number().optional()
|
|
285
342
|
});
|
|
286
343
|
z.object({
|
|
344
|
+
/** Unique identifier for the video */
|
|
287
345
|
id: z.string(),
|
|
346
|
+
/** Status should be 'completed' */
|
|
288
347
|
status: z.literal("completed"),
|
|
348
|
+
/** URL to download the video (temporary, expires after a period) */
|
|
289
349
|
video_url: z.url().optional(),
|
|
350
|
+
/** Video duration in seconds */
|
|
290
351
|
duration: z.number().optional(),
|
|
352
|
+
/** Video resolution */
|
|
291
353
|
resolution: z.string().optional()
|
|
292
354
|
});
|
|
293
355
|
z.object({
|
|
294
356
|
prompt: z.string().min(1),
|
|
295
|
-
model: z.enum(VideoModels).optional().prefault(
|
|
357
|
+
model: z.enum(VideoModels).optional().prefault("sora-2"),
|
|
296
358
|
seconds: z.union([
|
|
297
359
|
z.literal(4),
|
|
298
360
|
z.literal(8),
|
|
@@ -681,8 +743,14 @@ const groupShareSchema = z.object({
|
|
|
681
743
|
const userShareSchema = z.object({
|
|
682
744
|
userId: z.string(),
|
|
683
745
|
permissions: z.array(z.enum(Permission)),
|
|
746
|
+
/** The project ID if the user is shared from a project */
|
|
684
747
|
projectId: z.string().optional(),
|
|
685
|
-
extraData: z.object({
|
|
748
|
+
extraData: z.object({
|
|
749
|
+
/** The last time the user exported data */
|
|
750
|
+
lastExportDate: z.date().optional() }).optional(),
|
|
751
|
+
/**
|
|
752
|
+
* TODO: To be replaced with proper user zod schema
|
|
753
|
+
*/
|
|
686
754
|
user: z.any().optional()
|
|
687
755
|
});
|
|
688
756
|
const shareableDocumentSchema = z.object({
|
|
@@ -691,7 +759,6 @@ const shareableDocumentSchema = z.object({
|
|
|
691
759
|
users: z.array(userShareSchema),
|
|
692
760
|
groups: z.array(groupShareSchema)
|
|
693
761
|
});
|
|
694
|
-
ChatModels.GPT4o_MINI;
|
|
695
762
|
let ApiKeyScope = /* @__PURE__ */ function(ApiKeyScope) {
|
|
696
763
|
ApiKeyScope["READ_NOTEBOOKS"] = "notebooks:read";
|
|
697
764
|
ApiKeyScope["WRITE_NOTEBOOKS"] = "notebooks:write";
|
|
@@ -732,6 +799,9 @@ const BaseCreditTransaction = z.object({
|
|
|
732
799
|
id: z.string().optional(),
|
|
733
800
|
ownerId: z.string(),
|
|
734
801
|
ownerType: z.enum(CreditHolderType),
|
|
802
|
+
/**
|
|
803
|
+
* Credits used or added
|
|
804
|
+
*/
|
|
735
805
|
credits: z.number(),
|
|
736
806
|
description: z.string().optional(),
|
|
737
807
|
metadata: z.record(z.string(), z.any()).optional(),
|
|
@@ -743,6 +813,9 @@ const BaseCreditTransaction = z.object({
|
|
|
743
813
|
*/
|
|
744
814
|
const PurchaseTransaction = BaseCreditTransaction.extend({
|
|
745
815
|
type: z.literal("purchase"),
|
|
816
|
+
/**
|
|
817
|
+
* @deprecated Use ownerId and ownerType instead
|
|
818
|
+
*/
|
|
746
819
|
userId: z.string().optional(),
|
|
747
820
|
status: z.enum(CreditPurchaseStatus),
|
|
748
821
|
stripePaymentIntentId: z.string(),
|
|
@@ -768,7 +841,13 @@ const ReceivedCreditTransaction = BaseCreditTransaction.extend({
|
|
|
768
841
|
*/
|
|
769
842
|
const GenericCreditAddTransaction = BaseCreditTransaction.extend({
|
|
770
843
|
type: z.literal("generic_add"),
|
|
844
|
+
/**
|
|
845
|
+
* @deprecated Use ownerId and ownerType instead
|
|
846
|
+
*/
|
|
771
847
|
userId: z.string().optional(),
|
|
848
|
+
/**
|
|
849
|
+
* Optional reason/source for the transaction (e.g., 'admin_grant', 'refund', 'adjustment', 'legacy_purchase')
|
|
850
|
+
*/
|
|
772
851
|
reason: z.string().optional()
|
|
773
852
|
});
|
|
774
853
|
/**
|
|
@@ -778,7 +857,13 @@ const GenericCreditAddTransaction = BaseCreditTransaction.extend({
|
|
|
778
857
|
*/
|
|
779
858
|
const GenericCreditDeductTransaction = BaseCreditTransaction.extend({
|
|
780
859
|
type: z.literal("generic_deduct"),
|
|
860
|
+
/**
|
|
861
|
+
* @deprecated Use ownerId and ownerType instead
|
|
862
|
+
*/
|
|
781
863
|
userId: z.string().optional(),
|
|
864
|
+
/**
|
|
865
|
+
* Optional reason/source for the transaction (e.g., 'admin_adjustment', 'legacy_usage', 'manual_deduction')
|
|
866
|
+
*/
|
|
782
867
|
reason: z.string().optional()
|
|
783
868
|
});
|
|
784
869
|
const TextGenerationUsageTransaction = BaseCreditTransaction.extend({
|
|
@@ -899,6 +984,15 @@ let TagType = /* @__PURE__ */ function(TagType) {
|
|
|
899
984
|
TagType["SESSION"] = "session";
|
|
900
985
|
return TagType;
|
|
901
986
|
}({});
|
|
987
|
+
const SRE_BLOCKED_FILE_DEFAULTS = [
|
|
988
|
+
"infra/**",
|
|
989
|
+
"*.secret*",
|
|
990
|
+
"*.env*",
|
|
991
|
+
"*migration*",
|
|
992
|
+
".github/workflows/**",
|
|
993
|
+
"**/package.json",
|
|
994
|
+
"pnpm-lock.yaml"
|
|
995
|
+
];
|
|
902
996
|
const SRE_GATE_DEFAULTS = {
|
|
903
997
|
enabled: true,
|
|
904
998
|
autoThreshold: 85,
|
|
@@ -914,38 +1008,68 @@ const SreGateConfigSchema = z.object({
|
|
|
914
1008
|
message: "autoThreshold must be >= askThreshold",
|
|
915
1009
|
path: ["autoThreshold"]
|
|
916
1010
|
});
|
|
917
|
-
/**
|
|
918
|
-
*
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1011
|
+
/**
|
|
1012
|
+
* Each repo is a completely independent, self-contained configuration unit.
|
|
1013
|
+
* No defaults, no inheritance — every project is different.
|
|
1014
|
+
*/
|
|
1015
|
+
const SreRepoConfigSchema = z.object({
|
|
1016
|
+
/** GitHub org/user that owns the target repo */
|
|
1017
|
+
owner: z.string().min(1),
|
|
1018
|
+
/** Repository name */
|
|
1019
|
+
repo: z.string().min(1),
|
|
1020
|
+
/** Whether this repo's SRE pipeline is active */
|
|
927
1021
|
enabled: z.boolean().default(false),
|
|
928
|
-
|
|
929
|
-
maxDiffLines: z.number().min(1).default(50),
|
|
1022
|
+
/** LLM model ID for Diagnostician */
|
|
930
1023
|
modelId: z.string().default("claude-sonnet-4-20250514"),
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1024
|
+
/** Max diff lines per fix */
|
|
1025
|
+
maxDiffLines: z.number().min(1).default(50),
|
|
1026
|
+
/** Max fixes dispatched per day for this repo */
|
|
1027
|
+
maxFixesPerDay: z.number().min(0).default(5),
|
|
1028
|
+
/** Max revision attempts before escalating to human */
|
|
1029
|
+
maxRevisions: z.number().int().min(0).max(10).default(2),
|
|
1030
|
+
/** Log actions without dispatching */
|
|
1031
|
+
dryRun: z.boolean().default(false),
|
|
1032
|
+
/** Comma-separated GitHub usernames to request as PR reviewers */
|
|
1033
|
+
reviewers: z.string().default(""),
|
|
1034
|
+
/** Default branch name (auto-detected via GitHub API if empty) */
|
|
1035
|
+
defaultBranch: z.string().default(""),
|
|
1036
|
+
/** Build command for the workflow */
|
|
1037
|
+
buildCommand: z.string().default(""),
|
|
1038
|
+
/** Files the Surgeon can modify (glob patterns). Base patterns always merged in. */
|
|
1039
|
+
allowedFilePatterns: z.array(z.string()).default([]),
|
|
1040
|
+
/** Files never auto-fixed (glob patterns) */
|
|
1041
|
+
blockedFilePatterns: z.array(z.string()).default([...SRE_BLOCKED_FILE_DEFAULTS]),
|
|
1042
|
+
/** HMAC secret for webhook verification (encrypted at rest) */
|
|
1043
|
+
webhookSecret: z.string().default(""),
|
|
1044
|
+
/** Bearer token for workflow callback auth (encrypted at rest) */
|
|
1045
|
+
callbackToken: z.string().default(""),
|
|
1046
|
+
/** Human-in-the-loop approval gates */
|
|
1047
|
+
gates: z.object({
|
|
1048
|
+
sentinelToDiagnostician: SreGateConfigSchema.default({ ...SRE_GATE_DEFAULTS }),
|
|
1049
|
+
diagnosticianToSurgeon: SreGateConfigSchema.default({ ...SRE_GATE_DEFAULTS })
|
|
942
1050
|
}).default({
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
reviewers: "",
|
|
946
|
-
webhookSecret: "",
|
|
947
|
-
callbackToken: ""
|
|
1051
|
+
sentinelToDiagnostician: { ...SRE_GATE_DEFAULTS },
|
|
1052
|
+
diagnosticianToSurgeon: { ...SRE_GATE_DEFAULTS }
|
|
948
1053
|
}),
|
|
1054
|
+
/** Circuit breaker */
|
|
1055
|
+
circuitBreaker: z.object({
|
|
1056
|
+
failureThreshold: z.number().min(1).default(3),
|
|
1057
|
+
cooldownMinutes: z.number().min(1).default(30)
|
|
1058
|
+
}).default({
|
|
1059
|
+
failureThreshold: 3,
|
|
1060
|
+
cooldownMinutes: 30
|
|
1061
|
+
}),
|
|
1062
|
+
/** Token budget per analysis */
|
|
1063
|
+
tokenBudget: z.object({
|
|
1064
|
+
maxInputTokens: z.number().default(5e4),
|
|
1065
|
+
maxOutputTokens: z.number().default(8e3),
|
|
1066
|
+
maxGithubApiCalls: z.number().default(20)
|
|
1067
|
+
}).default({
|
|
1068
|
+
maxInputTokens: 5e4,
|
|
1069
|
+
maxOutputTokens: 8e3,
|
|
1070
|
+
maxGithubApiCalls: 20
|
|
1071
|
+
}),
|
|
1072
|
+
/** Error sources */
|
|
949
1073
|
sources: z.object({
|
|
950
1074
|
cloudwatch: z.object({ enabled: z.boolean().default(false) }).default({ enabled: false }),
|
|
951
1075
|
github: z.object({
|
|
@@ -974,32 +1098,7 @@ const SreAgentConfigSchema = z.object({
|
|
|
974
1098
|
}
|
|
975
1099
|
}
|
|
976
1100
|
}),
|
|
977
|
-
|
|
978
|
-
sentinelToDiagnostician: SreGateConfigSchema.default({ ...SRE_GATE_DEFAULTS }),
|
|
979
|
-
diagnosticianToSurgeon: SreGateConfigSchema.default({ ...SRE_GATE_DEFAULTS })
|
|
980
|
-
}).default({
|
|
981
|
-
sentinelToDiagnostician: { ...SRE_GATE_DEFAULTS },
|
|
982
|
-
diagnosticianToSurgeon: { ...SRE_GATE_DEFAULTS }
|
|
983
|
-
}),
|
|
984
|
-
allowedFilePatterns: z.array(z.string()).default([...SRE_BASE_ALLOWED_PATTERNS]).transform((patterns) => {
|
|
985
|
-
return [...new Set([...SRE_BASE_ALLOWED_PATTERNS, ...patterns])];
|
|
986
|
-
}),
|
|
987
|
-
blockedFilePatterns: z.array(z.string()).default([
|
|
988
|
-
"infra/**",
|
|
989
|
-
"*.secret*",
|
|
990
|
-
"*.env*",
|
|
991
|
-
"*migration*",
|
|
992
|
-
".github/workflows/**",
|
|
993
|
-
"**/package.json",
|
|
994
|
-
"pnpm-lock.yaml"
|
|
995
|
-
]),
|
|
996
|
-
circuitBreaker: z.object({
|
|
997
|
-
failureThreshold: z.number().min(1).default(3),
|
|
998
|
-
cooldownMinutes: z.number().min(1).default(30)
|
|
999
|
-
}).default({
|
|
1000
|
-
failureThreshold: 3,
|
|
1001
|
-
cooldownMinutes: 30
|
|
1002
|
-
}),
|
|
1101
|
+
/** Recurrence guard */
|
|
1003
1102
|
recurrence: z.object({
|
|
1004
1103
|
enabled: z.boolean().default(true),
|
|
1005
1104
|
windowDays: z.number().int().min(1).max(30).default(14),
|
|
@@ -1009,15 +1108,7 @@ const SreAgentConfigSchema = z.object({
|
|
|
1009
1108
|
windowDays: 14,
|
|
1010
1109
|
threshold: 1
|
|
1011
1110
|
}),
|
|
1012
|
-
|
|
1013
|
-
maxInputTokens: z.number().default(5e4),
|
|
1014
|
-
maxOutputTokens: z.number().default(8e3),
|
|
1015
|
-
maxGithubApiCalls: z.number().default(20)
|
|
1016
|
-
}).default({
|
|
1017
|
-
maxInputTokens: 5e4,
|
|
1018
|
-
maxOutputTokens: 8e3,
|
|
1019
|
-
maxGithubApiCalls: 20
|
|
1020
|
-
}),
|
|
1111
|
+
/** Pattern library */
|
|
1021
1112
|
patternLibrary: z.object({
|
|
1022
1113
|
enabled: z.boolean().default(true),
|
|
1023
1114
|
minConfidence: z.number().min(0).max(100).default(80)
|
|
@@ -1025,10 +1116,48 @@ const SreAgentConfigSchema = z.object({
|
|
|
1025
1116
|
enabled: true,
|
|
1026
1117
|
minConfidence: 80
|
|
1027
1118
|
}),
|
|
1028
|
-
|
|
1029
|
-
|
|
1119
|
+
/** Slack integration */
|
|
1120
|
+
slack: z.object({
|
|
1121
|
+
workspaceId: z.string().optional(),
|
|
1122
|
+
channelId: z.string().optional(),
|
|
1123
|
+
approverIds: z.string().default("")
|
|
1124
|
+
}).default({ approverIds: "" })
|
|
1030
1125
|
});
|
|
1031
1126
|
/**
|
|
1127
|
+
* SRE Agent Config — stored in AdminSettings.
|
|
1128
|
+
*
|
|
1129
|
+
* Structure: `{ repos[] }`. Each repo is fully self-contained.
|
|
1130
|
+
* v1 (flat) configs are transparently migrated via `z.preprocess`.
|
|
1131
|
+
*/
|
|
1132
|
+
const SreAgentConfigSchema = z.preprocess((raw) => {
|
|
1133
|
+
const obj = raw && typeof raw === "object" ? raw : {};
|
|
1134
|
+
if (obj.repos) return obj;
|
|
1135
|
+
const github = obj.github ?? {};
|
|
1136
|
+
const legacyRepo = github.owner && github.repo ? {
|
|
1137
|
+
owner: github.owner,
|
|
1138
|
+
repo: github.repo,
|
|
1139
|
+
reviewers: github.reviewers || "",
|
|
1140
|
+
webhookSecret: github.webhookSecret || "",
|
|
1141
|
+
callbackToken: github.callbackToken || "",
|
|
1142
|
+
...obj.enabled !== void 0 ? { enabled: obj.enabled } : {},
|
|
1143
|
+
...obj.modelId !== void 0 ? { modelId: obj.modelId } : {},
|
|
1144
|
+
...obj.maxDiffLines !== void 0 ? { maxDiffLines: obj.maxDiffLines } : {},
|
|
1145
|
+
...obj.maxFixesPerDay !== void 0 ? { maxFixesPerDay: obj.maxFixesPerDay } : {},
|
|
1146
|
+
...obj.maxRevisions !== void 0 ? { maxRevisions: obj.maxRevisions } : {},
|
|
1147
|
+
...obj.dryRun !== void 0 ? { dryRun: obj.dryRun } : {},
|
|
1148
|
+
...obj.gates ? { gates: obj.gates } : {},
|
|
1149
|
+
...obj.circuitBreaker ? { circuitBreaker: obj.circuitBreaker } : {},
|
|
1150
|
+
...obj.tokenBudget ? { tokenBudget: obj.tokenBudget } : {},
|
|
1151
|
+
...obj.recurrence ? { recurrence: obj.recurrence } : {},
|
|
1152
|
+
...obj.patternLibrary ? { patternLibrary: obj.patternLibrary } : {},
|
|
1153
|
+
...obj.allowedFilePatterns ? { allowedFilePatterns: obj.allowedFilePatterns } : {},
|
|
1154
|
+
...obj.blockedFilePatterns ? { blockedFilePatterns: obj.blockedFilePatterns } : {},
|
|
1155
|
+
...obj.sources ? { sources: obj.sources } : {},
|
|
1156
|
+
...obj.slack ? { slack: obj.slack } : {}
|
|
1157
|
+
} : null;
|
|
1158
|
+
return { repos: legacyRepo ? [legacyRepo] : [] };
|
|
1159
|
+
}, z.object({ repos: z.array(SreRepoConfigSchema).default([]) }));
|
|
1160
|
+
/**
|
|
1032
1161
|
* Configuration schema for the SecOps Triage feature.
|
|
1033
1162
|
*
|
|
1034
1163
|
* Controls automatic GitHub issue creation for critical/high ZAP scan findings.
|
|
@@ -1037,9 +1166,13 @@ const SreAgentConfigSchema = z.object({
|
|
|
1037
1166
|
* Setting name: 'secopsTriageConfig'
|
|
1038
1167
|
*/
|
|
1039
1168
|
const SecopsTriageConfigSchema = z.object({
|
|
1169
|
+
/** Master kill switch */
|
|
1040
1170
|
enabled: z.boolean().default(false),
|
|
1171
|
+
/** GitHub repository to create issues in (e.g. 'MillionOnMars/lumina5') */
|
|
1041
1172
|
githubRepo: z.string().default("MillionOnMars/lumina5"),
|
|
1173
|
+
/** Minimum ZAP severity level that triggers issue creation */
|
|
1042
1174
|
severityThreshold: z.enum(["critical", "high"]).default("high"),
|
|
1175
|
+
/** Map ZAP severity levels to GitHub issue priority labels */
|
|
1043
1176
|
severityToPriority: z.object({
|
|
1044
1177
|
critical: z.enum(["P0", "P1"]).default("P0"),
|
|
1045
1178
|
high: z.enum(["P0", "P1"]).default("P1")
|
|
@@ -1047,11 +1180,17 @@ const SecopsTriageConfigSchema = z.object({
|
|
|
1047
1180
|
critical: "P0",
|
|
1048
1181
|
high: "P1"
|
|
1049
1182
|
}),
|
|
1183
|
+
/** Maximum number of issues to create per scan (sorted by severity, highest first) */
|
|
1050
1184
|
maxIssuesPerScan: z.number().min(1).max(100).default(20),
|
|
1185
|
+
/** Slack workspace ID to use for posting (must match an active workspace in Admin → Slack Workspaces). Falls back to first active workspace if not set. */
|
|
1051
1186
|
slackWorkspaceId: z.string().optional(),
|
|
1187
|
+
/** Slack channel ID to post triage summary to (optional) */
|
|
1052
1188
|
slackChannelId: z.string().optional(),
|
|
1189
|
+
/** Enable LLM enrichment: per-finding remediation guidance + overall health assessment */
|
|
1053
1190
|
llmEnrichment: z.boolean().default(false),
|
|
1191
|
+
/** LLM model ID to use for enrichment (e.g. 'claude-3-5-haiku-20241022') */
|
|
1054
1192
|
modelId: z.string().optional(),
|
|
1193
|
+
/** Log actions without creating real GitHub issues or posting to Slack */
|
|
1055
1194
|
dryRun: z.boolean().default(false)
|
|
1056
1195
|
}).refine((data) => !data.llmEnrichment || !!data.modelId, {
|
|
1057
1196
|
message: "modelId is required when llmEnrichment is enabled",
|
|
@@ -1100,7 +1239,6 @@ let SupportedFabFileMimeTypes = /* @__PURE__ */ function(SupportedFabFileMimeTyp
|
|
|
1100
1239
|
SupportedFabFileMimeTypes["CONF"] = "text/plain";
|
|
1101
1240
|
return SupportedFabFileMimeTypes;
|
|
1102
1241
|
}({});
|
|
1103
|
-
SupportedFabFileMimeTypes.TS, SupportedFabFileMimeTypes.JS, SupportedFabFileMimeTypes.CSS, SupportedFabFileMimeTypes.PY, SupportedFabFileMimeTypes.JAVA, SupportedFabFileMimeTypes.CPP, SupportedFabFileMimeTypes.CS, SupportedFabFileMimeTypes.PHP, SupportedFabFileMimeTypes.RUBY, SupportedFabFileMimeTypes.GO, SupportedFabFileMimeTypes.SWIFT, SupportedFabFileMimeTypes.KOTLIN, SupportedFabFileMimeTypes.RUST;
|
|
1104
1242
|
/**
|
|
1105
1243
|
* ========================================
|
|
1106
1244
|
* Client to Server Actions
|
|
@@ -1792,7 +1930,14 @@ const SceneCommandSchema = z.discriminatedUnion("type", [
|
|
|
1792
1930
|
row: z.number(),
|
|
1793
1931
|
gid: z.number()
|
|
1794
1932
|
})),
|
|
1795
|
-
worldVersion: z.number().optional()
|
|
1933
|
+
worldVersion: z.number().optional(),
|
|
1934
|
+
floorId: z.string().optional()
|
|
1935
|
+
}),
|
|
1936
|
+
z.object({
|
|
1937
|
+
type: z.literal("change_floor"),
|
|
1938
|
+
id: z.string(),
|
|
1939
|
+
floorId: z.string(),
|
|
1940
|
+
position: TilePositionSchema
|
|
1796
1941
|
}),
|
|
1797
1942
|
z.object({
|
|
1798
1943
|
type: z.literal("update_metadata"),
|
|
@@ -1873,6 +2018,7 @@ const TavernHeartbeatLogAction = z.object({
|
|
|
1873
2018
|
/** Server → Client: real-time quest board update (replaces polling) */
|
|
1874
2019
|
const TavernQuestUpdateAction = z.object({
|
|
1875
2020
|
action: z.literal("tavern_quest_update"),
|
|
2021
|
+
/** The full refreshed quest list (top-level only, no sub-quests) */
|
|
1876
2022
|
quests: z.array(z.object({
|
|
1877
2023
|
_id: z.string(),
|
|
1878
2024
|
title: z.string(),
|
|
@@ -1936,6 +2082,26 @@ const CcAgentStatus = z.enum([
|
|
|
1936
2082
|
"disconnected"
|
|
1937
2083
|
]);
|
|
1938
2084
|
/**
|
|
2085
|
+
* Engine behind a code agent. Drives chip color in the Tavern and gates which
|
|
2086
|
+
* command shapes the server will dispatch to the bridge.
|
|
2087
|
+
* - `claude`: the official Claude Code CLI, surfaced via hooks + transcript
|
|
2088
|
+
* tail (observer+). Read-only — no interactive commands.
|
|
2089
|
+
* - `sdk-embedded`: Claude Agent SDK hosted in-process inside cc-bridge.
|
|
2090
|
+
* Interactive — prompt composer + permission resolver + abort.
|
|
2091
|
+
* - `b4m-cli`: the in-house `@bike4mind/cli` announcing over cc-bridge
|
|
2092
|
+
* loopback. Interactive.
|
|
2093
|
+
*/
|
|
2094
|
+
const CcAgentSource = z.enum([
|
|
2095
|
+
"claude",
|
|
2096
|
+
"sdk-embedded",
|
|
2097
|
+
"b4m-cli"
|
|
2098
|
+
]);
|
|
2099
|
+
/**
|
|
2100
|
+
* Capabilities an agent exposes. Gates interactive UI in `CodeAgentModal`.
|
|
2101
|
+
* Open-ended for forward-compat; v1 recognises `interactive` only.
|
|
2102
|
+
*/
|
|
2103
|
+
const CcAgentCapability = z.enum(["interactive"]);
|
|
2104
|
+
/**
|
|
1939
2105
|
* Bridge → Server: announce a new Claude Code session.
|
|
1940
2106
|
*
|
|
1941
2107
|
* The server persists an ActiveCodeAgent record keyed by instanceId, picks a
|
|
@@ -1949,12 +2115,27 @@ const CcBridgeAccessTokenSchema = z.string().max(512).optional();
|
|
|
1949
2115
|
const CcAgentRegisterAction = z.object({
|
|
1950
2116
|
action: z.literal("cc_agent_register"),
|
|
1951
2117
|
accessToken: CcBridgeAccessTokenSchema,
|
|
2118
|
+
/** Stable ID the bridge generates per CC session (uuid). */
|
|
1952
2119
|
instanceId: z.string().min(1).max(128),
|
|
2120
|
+
/** ID of the paired device (from `CcBridgeDevice`). */
|
|
1953
2121
|
deviceId: z.string().min(1).max(128),
|
|
2122
|
+
/** Display name — typically the basename of workspacePath. */
|
|
1954
2123
|
workspaceName: z.string().min(1).max(200),
|
|
2124
|
+
/** Absolute cwd of the CC session on the user's machine. Bound below
|
|
2125
|
+
* Linux PATH_MAX (4096) to keep broadcasts and Mongo docs small. */
|
|
1955
2126
|
workspacePath: z.string().max(1024),
|
|
2127
|
+
/** Claude Code CLI version if the bridge can detect it. */
|
|
1956
2128
|
claudeVersion: z.string().max(32).optional(),
|
|
1957
|
-
|
|
2129
|
+
/** ISO timestamp the CC session started. */
|
|
2130
|
+
startedAt: z.string().max(40),
|
|
2131
|
+
/** Engine behind this session. Drives chip color + command dispatch. Older
|
|
2132
|
+
* bridges that predate the interactive path don't send this; server defaults
|
|
2133
|
+
* to `'claude'` (observer+) to preserve their current behavior. */
|
|
2134
|
+
source: CcAgentSource.optional(),
|
|
2135
|
+
/** Capabilities this session supports. Gates interactive UI affordances in
|
|
2136
|
+
* the modal. Absent == read-only (observer+). `max(8)` is a belt-and-braces
|
|
2137
|
+
* bound; we only recognise `'interactive'` today. */
|
|
2138
|
+
capabilities: z.array(CcAgentCapability).max(8).optional()
|
|
1958
2139
|
});
|
|
1959
2140
|
/**
|
|
1960
2141
|
* Bridge → Server: stream an event for an already-registered session.
|
|
@@ -1964,39 +2145,68 @@ const CcAgentRegisterAction = z.object({
|
|
|
1964
2145
|
* 2. Tailing the session's transcript.jsonl in `~/.claude/projects/`
|
|
1965
2146
|
* (observer+ mode) → `message`, `tool_use`, `tool_result`.
|
|
1966
2147
|
*
|
|
1967
|
-
*
|
|
1968
|
-
*
|
|
1969
|
-
* `
|
|
2148
|
+
* The interactive SDK-embed path (inside cc-bridge, per D13) and B4M CLI
|
|
2149
|
+
* announces emit the same shapes plus the `permission_request` /
|
|
2150
|
+
* `permission_resolved` variants below for the prompt-the-user flow.
|
|
1970
2151
|
*/
|
|
1971
2152
|
const CcAgentEventPayload = z.discriminatedUnion("type", [
|
|
1972
2153
|
z.object({
|
|
1973
2154
|
type: z.literal("status"),
|
|
1974
2155
|
status: CcAgentStatus,
|
|
2156
|
+
/** Optional human-readable reason for the status change. Bounded here
|
|
2157
|
+
* to defend against oversized broadcasts; the server also truncates to
|
|
2158
|
+
* MAX_SUMMARY_LEN before persisting. */
|
|
1975
2159
|
text: z.string().max(4e3).optional()
|
|
1976
2160
|
}),
|
|
1977
2161
|
z.object({
|
|
1978
2162
|
type: z.literal("message"),
|
|
1979
2163
|
role: z.enum(["user", "assistant"]),
|
|
2164
|
+
/** Full message text (bridge clamps to this cap before sending). */
|
|
1980
2165
|
text: z.string().max(4e3)
|
|
1981
2166
|
}),
|
|
1982
2167
|
z.object({
|
|
1983
2168
|
type: z.literal("tool_use"),
|
|
2169
|
+
/** Tool name as emitted by Claude (e.g. `Bash`, `Read`, `Edit`). */
|
|
1984
2170
|
tool: z.string().min(1).max(128),
|
|
2171
|
+
/** Stable ID so a later `tool_result` can be matched back. */
|
|
1985
2172
|
toolUseId: z.string().min(1).max(128),
|
|
2173
|
+
/** Human-readable summary of the tool input (e.g. command, file path).
|
|
2174
|
+
* Bridge pre-summarizes rich inputs; we don't store raw JSON blobs. */
|
|
1986
2175
|
text: z.string().max(4e3).optional()
|
|
1987
2176
|
}),
|
|
1988
2177
|
z.object({
|
|
1989
2178
|
type: z.literal("tool_result"),
|
|
1990
2179
|
tool: z.string().min(1).max(128).optional(),
|
|
1991
2180
|
toolUseId: z.string().min(1).max(128),
|
|
2181
|
+
/** Result body (truncated by the bridge to this cap). */
|
|
1992
2182
|
text: z.string().max(4e3).optional(),
|
|
1993
2183
|
isError: z.boolean().optional()
|
|
2184
|
+
}),
|
|
2185
|
+
z.object({
|
|
2186
|
+
type: z.literal("permission_request"),
|
|
2187
|
+
/** Opaque id the agent generated. The resolve command must echo it. */
|
|
2188
|
+
requestId: z.string().min(1).max(128),
|
|
2189
|
+
/** Tool (or broader capability) the agent wants to use, e.g. `Bash`. */
|
|
2190
|
+
toolName: z.string().min(1).max(128),
|
|
2191
|
+
/** Human-readable summary of what the agent wants to do. Bridge/CLI
|
|
2192
|
+
* pre-summarizes rich input blobs; this is display-safe. */
|
|
2193
|
+
input: z.string().max(4e3).optional()
|
|
2194
|
+
}),
|
|
2195
|
+
z.object({
|
|
2196
|
+
type: z.literal("permission_resolved"),
|
|
2197
|
+
requestId: z.string().min(1).max(128),
|
|
2198
|
+
allow: z.boolean(),
|
|
2199
|
+
/** Who resolved it; `'auto'` covers SDK/CLI local rules. */
|
|
2200
|
+
resolvedBy: z.enum(["user", "auto"]).optional()
|
|
1994
2201
|
})
|
|
1995
2202
|
]);
|
|
1996
2203
|
const CcAgentEventAction = z.object({
|
|
1997
2204
|
action: z.literal("cc_agent_event"),
|
|
1998
2205
|
accessToken: CcBridgeAccessTokenSchema,
|
|
1999
2206
|
instanceId: z.string().min(1).max(128),
|
|
2207
|
+
/** ISO timestamp when the event occurred on the user's machine. `.datetime()`
|
|
2208
|
+
* gives an explicit first-line validator; the handler still defends with a
|
|
2209
|
+
* `new Date()` fallback for older bridges. */
|
|
2000
2210
|
timestamp: z.string().datetime().max(40),
|
|
2001
2211
|
event: CcAgentEventPayload
|
|
2002
2212
|
});
|
|
@@ -2012,6 +2222,38 @@ const CcAgentDisconnectAction = z.object({
|
|
|
2012
2222
|
instanceId: z.string().min(1).max(128),
|
|
2013
2223
|
reason: z.string().max(200).optional()
|
|
2014
2224
|
});
|
|
2225
|
+
/**
|
|
2226
|
+
* Server → Bridge: a user-driven command the bridge should apply to one of
|
|
2227
|
+
* its active sessions. Dispatched by `POST /api/cc-bridge/command` after the
|
|
2228
|
+
* server validates ownership + rate-limits, pushed over the bridge's WS via
|
|
2229
|
+
* the existing `sendToConnection` mechanism.
|
|
2230
|
+
*
|
|
2231
|
+
* The bridge is responsible for routing to the right local session and (for
|
|
2232
|
+
* external engines like the B4M CLI) forwarding over its loopback back-channel.
|
|
2233
|
+
*/
|
|
2234
|
+
const CcAgentCommandPayload = z.discriminatedUnion("type", [
|
|
2235
|
+
z.object({
|
|
2236
|
+
type: z.literal("send_prompt"),
|
|
2237
|
+
/** Full prompt text. Same cap as user-turn messages; UI will enforce. */
|
|
2238
|
+
text: z.string().min(1).max(4e3)
|
|
2239
|
+
}),
|
|
2240
|
+
z.object({
|
|
2241
|
+
type: z.literal("resolve_permission"),
|
|
2242
|
+
/** Must match the `requestId` from a prior `permission_request` event. */
|
|
2243
|
+
requestId: z.string().min(1).max(128),
|
|
2244
|
+
allow: z.boolean()
|
|
2245
|
+
}),
|
|
2246
|
+
z.object({ type: z.literal("abort") })
|
|
2247
|
+
]);
|
|
2248
|
+
const CcAgentCommandAction = z.object({
|
|
2249
|
+
action: z.literal("cc_agent_command"),
|
|
2250
|
+
/** Target session on the bridge; bridge looks it up in its session map. */
|
|
2251
|
+
instanceId: z.string().min(1).max(128),
|
|
2252
|
+
/** Server-minted correlation id so the client can follow up on failures
|
|
2253
|
+
* without racing against the eventual event echo. */
|
|
2254
|
+
requestId: z.string().min(1).max(128),
|
|
2255
|
+
command: CcAgentCommandPayload
|
|
2256
|
+
});
|
|
2015
2257
|
const SessionCreatedAction = shareableDocumentSchema.extend({
|
|
2016
2258
|
action: z.literal("session.created"),
|
|
2017
2259
|
id: z.string(),
|
|
@@ -2102,7 +2344,8 @@ z.discriminatedUnion("action", [
|
|
|
2102
2344
|
TavernQuestUpdateAction,
|
|
2103
2345
|
TavernStockUpdateAction,
|
|
2104
2346
|
JupyterNotebookProgressAction,
|
|
2105
|
-
DataLakeBatchProgressAction
|
|
2347
|
+
DataLakeBatchProgressAction,
|
|
2348
|
+
CcAgentCommandAction
|
|
2106
2349
|
]);
|
|
2107
2350
|
z.object({
|
|
2108
2351
|
model: z.string(),
|
|
@@ -2618,10 +2861,15 @@ z$1.object({
|
|
|
2618
2861
|
fileName: z$1.string(),
|
|
2619
2862
|
mimeType: z$1.string(),
|
|
2620
2863
|
fileSize: z$1.number(),
|
|
2864
|
+
/** The path to the file */
|
|
2621
2865
|
path: z$1.string().optional(),
|
|
2866
|
+
/** SHA-256 content hash for deduplication */
|
|
2622
2867
|
contentHash: z$1.string().optional(),
|
|
2868
|
+
/** Batch ID for data lake uploads */
|
|
2623
2869
|
batchId: z$1.string().optional(),
|
|
2870
|
+
/** Original relative path from folder upload */
|
|
2624
2871
|
relativePath: z$1.string().optional(),
|
|
2872
|
+
/** Tags to apply to the file on creation */
|
|
2625
2873
|
tags: z$1.array(z$1.object({
|
|
2626
2874
|
name: z$1.string(),
|
|
2627
2875
|
strength: z$1.number()
|
|
@@ -2633,7 +2881,9 @@ z$1.object({
|
|
|
2633
2881
|
mimeType: z$1.string(),
|
|
2634
2882
|
fileSize: z$1.number(),
|
|
2635
2883
|
fileContent: z$1.string().optional(),
|
|
2884
|
+
/** Set to true if the file should be publicly accessible */
|
|
2636
2885
|
public: z$1.boolean().optional(),
|
|
2886
|
+
/** The prefix to use for the file path */
|
|
2637
2887
|
prefix: z$1.string().optional()
|
|
2638
2888
|
});
|
|
2639
2889
|
/**
|
|
@@ -2648,12 +2898,12 @@ const BFL_SAFETY_TOLERANCE = {
|
|
|
2648
2898
|
* List of image models supported by BlackForest Labs
|
|
2649
2899
|
*/
|
|
2650
2900
|
const BFL_IMAGE_MODELS = [
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2901
|
+
"flux-pro-1.1",
|
|
2902
|
+
"flux-pro",
|
|
2903
|
+
"flux-pro-1.1-ultra",
|
|
2904
|
+
"flux-pro-1.0-fill",
|
|
2905
|
+
"flux-kontext-pro",
|
|
2906
|
+
"flux-kontext-max"
|
|
2657
2907
|
];
|
|
2658
2908
|
const CommonBFLParams = z.object({
|
|
2659
2909
|
prompt: z.string().nullable().optional(),
|
|
@@ -2689,12 +2939,12 @@ CommonBFLParams.extend({
|
|
|
2689
2939
|
* XAI/Grok Image Models
|
|
2690
2940
|
* Based on https://docs.x.ai/docs/guides/image-generations
|
|
2691
2941
|
*/
|
|
2692
|
-
const XAI_IMAGE_MODELS = [
|
|
2942
|
+
const XAI_IMAGE_MODELS = ["grok-2-image"];
|
|
2693
2943
|
/**
|
|
2694
2944
|
* Gemini Image Models (Nano Banana)
|
|
2695
2945
|
* Based on https://ai.google.dev/gemini-api/docs/image-generation
|
|
2696
2946
|
*/
|
|
2697
|
-
const GEMINI_IMAGE_MODELS = [
|
|
2947
|
+
const GEMINI_IMAGE_MODELS = ["gemini-2.5-flash-image", "gemini-3-pro-image-preview"];
|
|
2698
2948
|
z.object({
|
|
2699
2949
|
prompt: z.string().min(1),
|
|
2700
2950
|
n: z.number().min(1).max(8).prefault(1).optional(),
|
|
@@ -2736,9 +2986,10 @@ const ChatCompletionCreateInputSchema = z.object({
|
|
|
2736
2986
|
})).optional()
|
|
2737
2987
|
});
|
|
2738
2988
|
const OPENAI_IMAGE_MODELS = [
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2989
|
+
"gpt-image-1",
|
|
2990
|
+
"gpt-image-1.5",
|
|
2991
|
+
"gpt-image-1-mini",
|
|
2992
|
+
"gpt-image-2"
|
|
2742
2993
|
];
|
|
2743
2994
|
const ALL_IMAGE_MODELS = [
|
|
2744
2995
|
...OPENAI_IMAGE_MODELS,
|
|
@@ -2751,9 +3002,23 @@ const OPENAI_GPT_IMAGE_1_IMAGE_SIZES = [
|
|
|
2751
3002
|
"1024x1536",
|
|
2752
3003
|
"1536x1024"
|
|
2753
3004
|
];
|
|
3005
|
+
const OPENAI_GPT_IMAGE_2_IMAGE_SIZES = [
|
|
3006
|
+
"1024x1024",
|
|
3007
|
+
"1536x1024",
|
|
3008
|
+
"1024x1536",
|
|
3009
|
+
"2048x2048",
|
|
3010
|
+
"2048x1152",
|
|
3011
|
+
"3840x2160",
|
|
3012
|
+
"2160x3840",
|
|
3013
|
+
"auto"
|
|
3014
|
+
];
|
|
2754
3015
|
const BFL_IMAGE_SIZES = ["1024x768"];
|
|
2755
3016
|
const OPENAI_IMAGE_SIZES = [...OPENAI_GPT_IMAGE_1_IMAGE_SIZES];
|
|
2756
|
-
const ALL_IMAGE_SIZES = [
|
|
3017
|
+
const ALL_IMAGE_SIZES = [
|
|
3018
|
+
...OPENAI_IMAGE_SIZES,
|
|
3019
|
+
...OPENAI_GPT_IMAGE_2_IMAGE_SIZES,
|
|
3020
|
+
...BFL_IMAGE_SIZES
|
|
3021
|
+
];
|
|
2757
3022
|
z.enum(OPENAI_IMAGE_SIZES);
|
|
2758
3023
|
const ImageSizeSchema = z.union([z.enum(ALL_IMAGE_SIZES), z.string().regex(/^\d+x\d+$/, { error: "Size must be in format 'widthxheight'" })]);
|
|
2759
3024
|
const OpenAIImageQualitySchema = z.enum([
|
|
@@ -2761,7 +3026,8 @@ const OpenAIImageQualitySchema = z.enum([
|
|
|
2761
3026
|
"hd",
|
|
2762
3027
|
"low",
|
|
2763
3028
|
"medium",
|
|
2764
|
-
"high"
|
|
3029
|
+
"high",
|
|
3030
|
+
"auto"
|
|
2765
3031
|
]);
|
|
2766
3032
|
const OpenAIImageStyleSchema = z.enum(["vivid", "natural"]);
|
|
2767
3033
|
/**
|
|
@@ -2769,8 +3035,8 @@ const OpenAIImageStyleSchema = z.enum(["vivid", "natural"]);
|
|
|
2769
3035
|
* Prevents Zod validation failures when clients send stale persisted model names.
|
|
2770
3036
|
*/
|
|
2771
3037
|
const LEGACY_IMAGE_MODEL_MAP = {
|
|
2772
|
-
"dall-e-3":
|
|
2773
|
-
"dall-e-2":
|
|
3038
|
+
"dall-e-3": "gpt-image-1",
|
|
3039
|
+
"dall-e-2": "gpt-image-1"
|
|
2774
3040
|
};
|
|
2775
3041
|
const OpenAIImageGenerationInput = z.object({
|
|
2776
3042
|
prompt: z.string(),
|
|
@@ -2939,6 +3205,9 @@ z.enum([
|
|
|
2939
3205
|
"WolframAlphaKey",
|
|
2940
3206
|
"FmpApiKey",
|
|
2941
3207
|
"EnableFmpFinancialData",
|
|
3208
|
+
"PotionQuestApiKey",
|
|
3209
|
+
"EnablePotionQuest",
|
|
3210
|
+
"EnableTavernQuestBoardContext",
|
|
2942
3211
|
"VectorThreshold",
|
|
2943
3212
|
"bflApiKey",
|
|
2944
3213
|
"EnableMCPServer",
|
|
@@ -3211,7 +3480,13 @@ const WhatsNewSyncConfigSchema = z.object({
|
|
|
3211
3480
|
"failed"
|
|
3212
3481
|
]).optional(),
|
|
3213
3482
|
lastSyncModalId: z.string().optional(),
|
|
3483
|
+
/** Error message from last sync attempt (only populated when lastSyncResult is 'failed') */
|
|
3214
3484
|
lastSyncError: z.string().max(500).optional(),
|
|
3485
|
+
/**
|
|
3486
|
+
* Admin override for distribution URL.
|
|
3487
|
+
* Must be validated against domain allowlist (CloudFront/S3 only) before saving.
|
|
3488
|
+
* Takes precedence over SST secret when set.
|
|
3489
|
+
*/
|
|
3215
3490
|
distributionUrlOverride: z.url().nullable().optional()
|
|
3216
3491
|
});
|
|
3217
3492
|
const CONTEXT_TELEMETRY_VALIDATION_LIMITS = {
|
|
@@ -3302,31 +3577,57 @@ const CONTEXT_TELEMETRY_VALIDATION_LIMITS = {
|
|
|
3302
3577
|
};
|
|
3303
3578
|
const CT = CONTEXT_TELEMETRY_VALIDATION_LIMITS;
|
|
3304
3579
|
const ContextTelemetryAlertsSchema = z.object({
|
|
3580
|
+
/** Whether telemetry alerts are enabled */
|
|
3305
3581
|
enabled: z.boolean().default(false),
|
|
3582
|
+
/** MongoDB ObjectId of the Slack workspace to use */
|
|
3306
3583
|
slackWorkspaceId: z.string().optional(),
|
|
3584
|
+
/** Slack channel ID for posting anomaly alerts */
|
|
3307
3585
|
slackChannelId: z.string().optional(),
|
|
3586
|
+
/** GitHub repository owner (user or organization) */
|
|
3308
3587
|
githubOwner: z.string().optional(),
|
|
3588
|
+
/** GitHub repository name */
|
|
3309
3589
|
githubRepo: z.string().optional(),
|
|
3590
|
+
/** Whether to automatically create GitHub issues for anomalies that meet the threshold */
|
|
3310
3591
|
autoCreateIssues: z.boolean().default(false),
|
|
3592
|
+
/** Model ID for priority analysis (e.g., 'gpt-4o-mini', 'claude-3-haiku') */
|
|
3311
3593
|
modelId: z.string().optional(),
|
|
3594
|
+
/** Temperature for LLM responses (lower = more deterministic) */
|
|
3312
3595
|
temperature: z.number().min(CT.temperature.min).max(CT.temperature.max).default(CT.temperature.default),
|
|
3596
|
+
/** Maximum tokens for LLM response */
|
|
3313
3597
|
maxTokens: z.number().min(CT.maxTokens.min).max(CT.maxTokens.max).default(CT.maxTokens.default),
|
|
3598
|
+
/** Timeout for LLM calls in milliseconds */
|
|
3314
3599
|
timeoutMs: z.number().min(CT.timeoutMs.min).max(CT.timeoutMs.max).default(CT.timeoutMs.default),
|
|
3600
|
+
/** Minimum anomaly score to use LLM analysis. Lower scores use rule-based analysis (saves cost). */
|
|
3315
3601
|
llmAnalysisThreshold: z.number().min(CT.llmAnalysisThreshold.min).max(CT.llmAnalysisThreshold.max).default(CT.llmAnalysisThreshold.default),
|
|
3602
|
+
/** Minimum anomaly score to trigger alerts (default: 30) */
|
|
3316
3603
|
alertThreshold: z.number().min(CT.alertThreshold.min).max(CT.alertThreshold.max).default(CT.alertThreshold.default),
|
|
3604
|
+
/** Score threshold that triggers @here mentions (default: 50) */
|
|
3317
3605
|
criticalThreshold: z.number().min(CT.criticalThreshold.min).max(CT.criticalThreshold.max).default(CT.criticalThreshold.default),
|
|
3606
|
+
/** Deduplication window in minutes (default: 5) - for Slack alerts */
|
|
3318
3607
|
dedupWindowMinutes: z.number().min(CT.dedupWindowMinutes.min).max(CT.dedupWindowMinutes.max).default(CT.dedupWindowMinutes.default),
|
|
3608
|
+
/** Days to look back for closed issues when checking for regressions (default: 30) */
|
|
3319
3609
|
regressionLookbackDays: z.number().min(CT.regressionLookbackDays.min).max(CT.regressionLookbackDays.max).default(CT.regressionLookbackDays.default),
|
|
3610
|
+
/** Hours after issue closure before same fingerprint is considered regression (default: 48) */
|
|
3320
3611
|
regressionGracePeriodHours: z.number().min(CT.regressionGracePeriodHours.min).max(CT.regressionGracePeriodHours.max).default(CT.regressionGracePeriodHours.default),
|
|
3612
|
+
/** Hours before re-alerting Slack for same fingerprint - duplicate cooldown (default: 24) */
|
|
3321
3613
|
duplicateAlertCooldownHours: z.number().min(CT.duplicateAlertCooldownHours.min).max(CT.duplicateAlertCooldownHours.max).default(CT.duplicateAlertCooldownHours.default),
|
|
3614
|
+
/** Whether to use LLM for priority determination (falls back to rule-based if disabled/fails) */
|
|
3322
3615
|
enableLlmPriority: z.boolean().default(false),
|
|
3616
|
+
/** Custom prompt template for LLM priority analysis (optional) */
|
|
3323
3617
|
promptTemplate: z.string().min(CT.promptTemplate.min, `Prompt template must be at least ${CT.promptTemplate.min} characters`).max(CT.promptTemplate.max, `Prompt template cannot exceed ${CT.promptTemplate.max.toLocaleString()} characters`).trim().optional(),
|
|
3618
|
+
/** Number of days to look back for historical baseline computation (default: 7) */
|
|
3324
3619
|
baselineWindowDays: z.number().min(CT.baselineWindowDays.min).max(CT.baselineWindowDays.max).default(CT.baselineWindowDays.default),
|
|
3620
|
+
/** P95 response time target in milliseconds (default: 60000 = 60s) */
|
|
3325
3621
|
sloResponseTimeP95Ms: z.number().min(CT.sloResponseTimeP95Ms.min).max(CT.sloResponseTimeP95Ms.max).default(CT.sloResponseTimeP95Ms.default),
|
|
3622
|
+
/** Time to first token target in milliseconds (default: 5000 = 5s) */
|
|
3326
3623
|
sloFirstTokenTimeMs: z.number().min(CT.sloFirstTokenTimeMs.min).max(CT.sloFirstTokenTimeMs.max).default(CT.sloFirstTokenTimeMs.default),
|
|
3624
|
+
/** Acceptable error rate percentage (default: 2%) */
|
|
3327
3625
|
sloErrorRatePercent: z.number().min(CT.sloErrorRatePercent.min).max(CT.sloErrorRatePercent.max).default(CT.sloErrorRatePercent.default),
|
|
3626
|
+
/** Maximum acceptable context utilization percentage (default: 85%) */
|
|
3328
3627
|
sloContextUtilizationPercent: z.number().min(CT.sloContextUtilizationPercent.min).max(CT.sloContextUtilizationPercent.max).default(CT.sloContextUtilizationPercent.default),
|
|
3628
|
+
/** Maximum GitHub issues to create per hour (prevents runaway automation) */
|
|
3329
3629
|
maxIssuesPerHour: z.number().min(CT.maxIssuesPerHour.min).max(CT.maxIssuesPerHour.max).default(CT.maxIssuesPerHour.default),
|
|
3630
|
+
/** When enabled, logs what would happen without creating issues or sending alerts */
|
|
3330
3631
|
dryRun: z.boolean().default(false)
|
|
3331
3632
|
});
|
|
3332
3633
|
const LT = {
|
|
@@ -3702,6 +4003,10 @@ const API_SERVICE_GROUPS = {
|
|
|
3702
4003
|
{
|
|
3703
4004
|
key: "FmpApiKey",
|
|
3704
4005
|
order: 3
|
|
4006
|
+
},
|
|
4007
|
+
{
|
|
4008
|
+
key: "PotionQuestApiKey",
|
|
4009
|
+
order: 4
|
|
3705
4010
|
}
|
|
3706
4011
|
]
|
|
3707
4012
|
},
|
|
@@ -3882,6 +4187,14 @@ const API_SERVICE_GROUPS = {
|
|
|
3882
4187
|
{
|
|
3883
4188
|
key: "EnableFmpFinancialData",
|
|
3884
4189
|
order: 22
|
|
4190
|
+
},
|
|
4191
|
+
{
|
|
4192
|
+
key: "EnablePotionQuest",
|
|
4193
|
+
order: 23
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
key: "EnableTavernQuestBoardContext",
|
|
4197
|
+
order: 24
|
|
3885
4198
|
}
|
|
3886
4199
|
]
|
|
3887
4200
|
},
|
|
@@ -4090,7 +4403,7 @@ const API_SERVICE_GROUPS = {
|
|
|
4090
4403
|
makeStringSetting({
|
|
4091
4404
|
key: "DefaultAPIModel",
|
|
4092
4405
|
name: "Default API Model",
|
|
4093
|
-
defaultValue:
|
|
4406
|
+
defaultValue: "gpt-5",
|
|
4094
4407
|
description: "The default AI model to use for API requests when no model is specified.",
|
|
4095
4408
|
options: CHAT_MODELS,
|
|
4096
4409
|
category: "AI",
|
|
@@ -4478,7 +4791,7 @@ makeStringSetting({
|
|
|
4478
4791
|
}), makeStringSetting({
|
|
4479
4792
|
key: "serverStatus",
|
|
4480
4793
|
name: "Server Status",
|
|
4481
|
-
defaultValue:
|
|
4794
|
+
defaultValue: "live",
|
|
4482
4795
|
description: "The current status of the server.",
|
|
4483
4796
|
category: "Admin",
|
|
4484
4797
|
group: API_SERVICE_GROUPS.ADMIN.id,
|
|
@@ -4650,6 +4963,31 @@ makeStringSetting({
|
|
|
4650
4963
|
category: "Experimental",
|
|
4651
4964
|
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
4652
4965
|
order: 13
|
|
4966
|
+
}), makeStringSetting({
|
|
4967
|
+
key: "PotionQuestApiKey",
|
|
4968
|
+
name: "PotionQuest API Key",
|
|
4969
|
+
defaultValue: "",
|
|
4970
|
+
description: "API key for PotionQuest (procedural RPG content: NPCs, encounters, quests, loot, prophecies, legendary affixes, dice rolls). Get one at potionquest.com.",
|
|
4971
|
+
category: "Tools",
|
|
4972
|
+
group: API_SERVICE_GROUPS.SEARCH.id,
|
|
4973
|
+
order: 4,
|
|
4974
|
+
isSensitive: true
|
|
4975
|
+
}), makeBooleanSetting({
|
|
4976
|
+
key: "EnablePotionQuest",
|
|
4977
|
+
name: "Enable PotionQuest Tools",
|
|
4978
|
+
defaultValue: false,
|
|
4979
|
+
description: "Whether to expose the PotionQuest dice + content generators as tools to tavern agents. Requires PotionQuestApiKey to be set.",
|
|
4980
|
+
category: "Experimental",
|
|
4981
|
+
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
4982
|
+
order: 14
|
|
4983
|
+
}), makeBooleanSetting({
|
|
4984
|
+
key: "EnableTavernQuestBoardContext",
|
|
4985
|
+
name: "Inject Quest Board Into Heartbeat Prompt",
|
|
4986
|
+
defaultValue: true,
|
|
4987
|
+
description: "Whether agent heartbeats see the quest board and their claimed quests in the system prompt. Toggle OFF for diagnostic isolation: when disabled, agents only see user @mentions and direct context, removing the pull from previously-claimed quests. The quest board itself still functions; only the prompt context is suppressed.",
|
|
4988
|
+
category: "Experimental",
|
|
4989
|
+
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
4990
|
+
order: 15
|
|
4653
4991
|
}), makeNumberSetting({
|
|
4654
4992
|
key: "VectorThreshold",
|
|
4655
4993
|
name: "Vector Threshold",
|
|
@@ -4795,7 +5133,7 @@ makeStringSetting({
|
|
|
4795
5133
|
}), makeStringSetting({
|
|
4796
5134
|
key: "defaultEmbeddingModel",
|
|
4797
5135
|
name: "Default Embedding Model",
|
|
4798
|
-
defaultValue:
|
|
5136
|
+
defaultValue: "text-embedding-ada-002",
|
|
4799
5137
|
description: "The default embedding model to use",
|
|
4800
5138
|
category: "AI",
|
|
4801
5139
|
group: API_SERVICE_GROUPS.EMBEDDING.id,
|
|
@@ -4967,7 +5305,7 @@ makeStringSetting({
|
|
|
4967
5305
|
}), makeStringSetting({
|
|
4968
5306
|
key: "EmailAnalysisModel",
|
|
4969
5307
|
name: "Email Analysis Model",
|
|
4970
|
-
defaultValue:
|
|
5308
|
+
defaultValue: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
4971
5309
|
description: "The AI model to use for email analysis. Defaults to Claude 4.5 Haiku via Bedrock.",
|
|
4972
5310
|
options: CHAT_MODELS,
|
|
4973
5311
|
category: "AI",
|
|
@@ -5201,11 +5539,15 @@ z.preprocess((val) => {
|
|
|
5201
5539
|
return val;
|
|
5202
5540
|
}, z.boolean());
|
|
5203
5541
|
const AnonymousSessionIdSchema = z.object({
|
|
5542
|
+
/** SHA256(userId|orgId|dailySalt|date) - cannot be reversed */
|
|
5204
5543
|
hash: z.string(),
|
|
5544
|
+
/** YYYY-MM-DD for salt lookup during deletion */
|
|
5205
5545
|
dateKey: z.string()
|
|
5206
5546
|
});
|
|
5207
5547
|
const SpanContextSchema = z.object({
|
|
5548
|
+
/** gen_ai.trace_id */
|
|
5208
5549
|
traceId: z.string(),
|
|
5550
|
+
/** gen_ai.span_id */
|
|
5209
5551
|
spanId: z.string()
|
|
5210
5552
|
});
|
|
5211
5553
|
const OperationSchema = z.object({
|
|
@@ -5223,6 +5565,7 @@ const OperationSchema = z.object({
|
|
|
5223
5565
|
]).optional()
|
|
5224
5566
|
});
|
|
5225
5567
|
const ModelTelemetrySchema = z.object({
|
|
5568
|
+
/** gen_ai.request.model */
|
|
5226
5569
|
modelId: z.string(),
|
|
5227
5570
|
provider: z.enum([
|
|
5228
5571
|
"anthropic",
|
|
@@ -5236,6 +5579,7 @@ const ModelTelemetrySchema = z.object({
|
|
|
5236
5579
|
fallbackReason: z.string().optional(),
|
|
5237
5580
|
originalModelId: z.string().optional(),
|
|
5238
5581
|
usedThinking: z.boolean(),
|
|
5582
|
+
/** Extended thinking tokens */
|
|
5239
5583
|
thinkingTokensUsed: z.number().optional(),
|
|
5240
5584
|
usedTools: z.boolean()
|
|
5241
5585
|
});
|
|
@@ -5248,6 +5592,7 @@ const SystemPromptDetailSchema = z.object({
|
|
|
5248
5592
|
"session",
|
|
5249
5593
|
"org"
|
|
5250
5594
|
]),
|
|
5595
|
+
/** e.g., "date_context", "tool_guidance" */
|
|
5251
5596
|
name: z.string(),
|
|
5252
5597
|
tokenCount: z.number(),
|
|
5253
5598
|
wasIncluded: z.boolean(),
|
|
@@ -5263,6 +5608,7 @@ const SystemPromptsTelemetrySchema = z.object({
|
|
|
5263
5608
|
duplicateCount: z.number()
|
|
5264
5609
|
});
|
|
5265
5610
|
const FeatureContributionSchema = z.object({
|
|
5611
|
+
/** e.g., "mementos", "quest_master", "deep_research" */
|
|
5266
5612
|
featureName: z.string(),
|
|
5267
5613
|
messagesAdded: z.number(),
|
|
5268
5614
|
tokenCount: z.number(),
|
|
@@ -5281,18 +5627,24 @@ const TokensBySourceSchema = z.object({
|
|
|
5281
5627
|
userPrompt: z.number()
|
|
5282
5628
|
});
|
|
5283
5629
|
z.object({
|
|
5630
|
+
/** gen_ai.usage.input_tokens */
|
|
5284
5631
|
inputTokens: z.number(),
|
|
5632
|
+
/** gen_ai.usage.output_tokens */
|
|
5285
5633
|
outputTokens: z.number(),
|
|
5286
5634
|
contextWindowLimit: z.number(),
|
|
5287
5635
|
utilizationPercentage: z.number(),
|
|
5288
5636
|
reservedOutputTokens: z.number(),
|
|
5289
5637
|
overflowDetected: z.boolean(),
|
|
5290
5638
|
overflowAmount: z.number().optional(),
|
|
5639
|
+
/** Token breakdown by source */
|
|
5291
5640
|
tokensBySource: TokensBySourceSchema
|
|
5292
5641
|
});
|
|
5293
5642
|
const CacheTelemetrySchema = z.object({
|
|
5643
|
+
/** Anthropic cache_read_input_tokens */
|
|
5294
5644
|
cacheReadTokens: z.number(),
|
|
5645
|
+
/** Anthropic cache_creation_input_tokens */
|
|
5295
5646
|
cacheWriteTokens: z.number(),
|
|
5647
|
+
/** 0-100% */
|
|
5296
5648
|
cacheHitRate: z.number(),
|
|
5297
5649
|
costSavingsPercent: z.number().optional()
|
|
5298
5650
|
});
|
|
@@ -5325,14 +5677,18 @@ const ToolErrorCategorySchema = z.enum([
|
|
|
5325
5677
|
]);
|
|
5326
5678
|
const ToolTelemetrySchema = z.object({
|
|
5327
5679
|
toolName: z.string(),
|
|
5680
|
+
/** MCP vs native tool */
|
|
5328
5681
|
isMcpTool: z.boolean(),
|
|
5682
|
+
/** For MCP tools */
|
|
5329
5683
|
mcpServerName: z.string().optional(),
|
|
5330
5684
|
invocationCount: z.number(),
|
|
5331
5685
|
successCount: z.number(),
|
|
5332
5686
|
failureCount: z.number(),
|
|
5333
5687
|
totalDurationMs: z.number(),
|
|
5334
5688
|
maxDurationMs: z.number(),
|
|
5689
|
+
/** Retry tracking */
|
|
5335
5690
|
retryCount: z.number(),
|
|
5691
|
+
/** Max 200 chars */
|
|
5336
5692
|
lastError: z.string().max(200).optional(),
|
|
5337
5693
|
errorCategories: z.array(ToolErrorCategorySchema).optional()
|
|
5338
5694
|
});
|
|
@@ -5361,6 +5717,7 @@ const PerformanceTelemetrySchema = z.object({
|
|
|
5361
5717
|
contextRetrievalMs: z.number().optional(),
|
|
5362
5718
|
modelInferenceMs: z.number().optional(),
|
|
5363
5719
|
toolExecutionMs: z.number().optional(),
|
|
5720
|
+
/** Latency percentiles for trend analysis */
|
|
5364
5721
|
latencyPercentiles: LatencyPercentilesSchema.optional()
|
|
5365
5722
|
});
|
|
5366
5723
|
const AnomalySeveritySchema = z.enum([
|
|
@@ -5380,17 +5737,29 @@ const PrimaryAnomalySchema = z.enum([
|
|
|
5380
5737
|
]);
|
|
5381
5738
|
const AnomaliesTelemetrySchema = z.object({
|
|
5382
5739
|
contextOverflow: z.boolean(),
|
|
5740
|
+
/** >= 90% */
|
|
5383
5741
|
highUtilization: z.boolean(),
|
|
5742
|
+
/** >= 95% */
|
|
5384
5743
|
criticalUtilization: z.boolean(),
|
|
5744
|
+
/** >= 50% */
|
|
5385
5745
|
highTruncation: z.boolean(),
|
|
5746
|
+
/** >= 75% */
|
|
5386
5747
|
criticalTruncation: z.boolean(),
|
|
5748
|
+
/** >= 3 failures */
|
|
5387
5749
|
toolFailureSpike: z.boolean(),
|
|
5750
|
+
/** > 30s */
|
|
5388
5751
|
toolTimeout: z.boolean(),
|
|
5752
|
+
/** > 5min */
|
|
5389
5753
|
subagentTimeout: z.boolean(),
|
|
5754
|
+
/** > 10s */
|
|
5390
5755
|
slowFirstToken: z.boolean(),
|
|
5756
|
+
/** > 60s */
|
|
5391
5757
|
slowTotalResponse: z.boolean(),
|
|
5758
|
+
/** 0-100 */
|
|
5392
5759
|
anomalyScore: z.number().min(0).max(100),
|
|
5760
|
+
/** Severity mapping */
|
|
5393
5761
|
severity: AnomalySeveritySchema,
|
|
5762
|
+
/** Pattern-based dedup key, e.g., "tool_failure_claude-3-5-sonnet_delegate-to-agent" */
|
|
5394
5763
|
dedupKey: z.string(),
|
|
5395
5764
|
primaryAnomaly: PrimaryAnomalySchema
|
|
5396
5765
|
});
|
|
@@ -5406,19 +5775,25 @@ const RequestMetadataSchema = z.object({
|
|
|
5406
5775
|
enabledFeatures: z.array(z.string())
|
|
5407
5776
|
});
|
|
5408
5777
|
const ContextWindowTelemetryWithOptionalSourceSchema = z.object({
|
|
5778
|
+
/** gen_ai.usage.input_tokens */
|
|
5409
5779
|
inputTokens: z.number(),
|
|
5780
|
+
/** gen_ai.usage.output_tokens */
|
|
5410
5781
|
outputTokens: z.number(),
|
|
5411
5782
|
contextWindowLimit: z.number(),
|
|
5412
5783
|
utilizationPercentage: z.number(),
|
|
5413
5784
|
reservedOutputTokens: z.number(),
|
|
5414
5785
|
overflowDetected: z.boolean(),
|
|
5415
5786
|
overflowAmount: z.number().optional(),
|
|
5787
|
+
/** Token breakdown by source (enhanced only) */
|
|
5416
5788
|
tokensBySource: TokensBySourceSchema.optional()
|
|
5417
5789
|
});
|
|
5418
5790
|
const ContextTelemetrySchema = z.object({
|
|
5419
5791
|
schemaVersion: z.enum(["1.0", "1.1"]),
|
|
5792
|
+
/** ISO 8601 */
|
|
5420
5793
|
timestamp: z.string(),
|
|
5794
|
+
/** Self-monitoring: time to capture telemetry */
|
|
5421
5795
|
captureOverheadMs: z.number(),
|
|
5796
|
+
/** Capture level: basic or enhanced */
|
|
5422
5797
|
captureLevel: z.enum(["basic", "enhanced"]).optional(),
|
|
5423
5798
|
anonymousSessionId: AnonymousSessionIdSchema,
|
|
5424
5799
|
spanContext: SpanContextSchema.optional(),
|
|
@@ -5438,7 +5813,9 @@ const ContextTelemetrySchema = z.object({
|
|
|
5438
5813
|
captureErrors: z.array(z.string()).optional()
|
|
5439
5814
|
});
|
|
5440
5815
|
const ALERT_THRESHOLDS = {
|
|
5816
|
+
/** Minimum score to trigger any alert */
|
|
5441
5817
|
warning: 30,
|
|
5818
|
+
/** Score threshold for @here mentions */
|
|
5442
5819
|
critical: 50
|
|
5443
5820
|
};
|
|
5444
5821
|
z.object({
|
|
@@ -5611,6 +5988,7 @@ const PromptMetaFunctionCallSchema = z.object({
|
|
|
5611
5988
|
success: z.boolean().optional(),
|
|
5612
5989
|
error: z.string().optional(),
|
|
5613
5990
|
creditsUsed: z.number().optional(),
|
|
5991
|
+
/** Tool use ID for Anthropic API tool pairing (#6181) */
|
|
5614
5992
|
id: z.string().optional()
|
|
5615
5993
|
});
|
|
5616
5994
|
const PromptMetaPerformanceSchema = z.object({
|
|
@@ -5658,24 +6036,33 @@ const ToolHealthSchema = z.object({
|
|
|
5658
6036
|
successRate: z.number().optional()
|
|
5659
6037
|
});
|
|
5660
6038
|
const CitableSourceSchema = z.object({
|
|
6039
|
+
/** Unique identifier - can be URL, UUID, or composite key */
|
|
5661
6040
|
id: z.string(),
|
|
6041
|
+
/** Source classification for UI rendering */
|
|
5662
6042
|
type: z.enum([
|
|
5663
6043
|
"web_url",
|
|
5664
6044
|
"document",
|
|
5665
6045
|
"dataset",
|
|
5666
6046
|
"mcp"
|
|
5667
6047
|
]),
|
|
6048
|
+
/** Human-readable title/name */
|
|
5668
6049
|
title: z.string(),
|
|
6050
|
+
/** Navigation target (external URL, deep link, or hash route) */
|
|
5669
6051
|
url: z.string().optional(),
|
|
6052
|
+
/** Brief description or excerpt (1-2 sentences) */
|
|
5670
6053
|
description: z.string().optional(),
|
|
6054
|
+
/** ISO 8601 timestamp for freshness indication */
|
|
5671
6055
|
timestamp: z.string().optional(),
|
|
6056
|
+
/** Attribution for non-report sources */
|
|
5672
6057
|
author: z.string().optional(),
|
|
6058
|
+
/** Processing status for real-time updates */
|
|
5673
6059
|
status: z.enum([
|
|
5674
6060
|
"pending",
|
|
5675
6061
|
"processing",
|
|
5676
6062
|
"complete",
|
|
5677
6063
|
"error"
|
|
5678
6064
|
]).optional(),
|
|
6065
|
+
/** Extensibility metadata */
|
|
5679
6066
|
metadata: z.looseObject({
|
|
5680
6067
|
sourceSystem: z.string().optional(),
|
|
5681
6068
|
icon: z.string().optional(),
|
|
@@ -5804,6 +6191,7 @@ let FileEvents = /* @__PURE__ */ function(FileEvents) {
|
|
|
5804
6191
|
FileEvents["DELETE_ALL_FILES"] = "All Files Deleted";
|
|
5805
6192
|
FileEvents["UPDATE_FILE"] = "File Updated";
|
|
5806
6193
|
FileEvents["GENERATE_FILE_PRESIGNED_URL"] = "File Presigned URL Generated";
|
|
6194
|
+
FileEvents["UNSHARE_FILE"] = "File Unshared";
|
|
5807
6195
|
return FileEvents;
|
|
5808
6196
|
}({});
|
|
5809
6197
|
let InviteEvents = /* @__PURE__ */ function(InviteEvents) {
|
|
@@ -6411,11 +6799,14 @@ const InferTaxonomyFolderEntry = z$1.object({
|
|
|
6411
6799
|
fileName: z$1.string(),
|
|
6412
6800
|
fileSize: z$1.number(),
|
|
6413
6801
|
mimeType: z$1.string().optional(),
|
|
6802
|
+
/** First ~500 chars of file content for AI analysis */
|
|
6414
6803
|
contentSample: z$1.string().max(1e3).optional()
|
|
6415
6804
|
});
|
|
6416
6805
|
z$1.object({
|
|
6417
6806
|
folderTree: z$1.array(InferTaxonomyFolderEntry).min(1).max(500),
|
|
6807
|
+
/** If re-running for an existing data lake, pass its prefix */
|
|
6418
6808
|
existingPrefix: z$1.string().optional(),
|
|
6809
|
+
/** User description of the data (helps the AI) */
|
|
6419
6810
|
context: z$1.string().max(2e3).optional()
|
|
6420
6811
|
});
|
|
6421
6812
|
z$1.object({ hashes: z$1.array(z$1.string().regex(sha256Regex)).min(1).max(500) });
|
|
@@ -6621,6 +7012,7 @@ OpenAIImageGenerationInput.extend({
|
|
|
6621
7012
|
image: z.string()
|
|
6622
7013
|
});
|
|
6623
7014
|
z.object({
|
|
7015
|
+
/** Notebook session ID */
|
|
6624
7016
|
sessionId: z.string(),
|
|
6625
7017
|
historyCount: z.number(),
|
|
6626
7018
|
imageConfig: GenerateImageToolCallSchema.optional(),
|
|
@@ -6630,9 +7022,11 @@ z.object({
|
|
|
6630
7022
|
searchers: z.array(z.any()).optional()
|
|
6631
7023
|
}).optional(),
|
|
6632
7024
|
fabFileIds: z.array(z.string()),
|
|
7025
|
+
/** Prompt message */
|
|
6633
7026
|
message: z.string(),
|
|
6634
7027
|
messageFileIds: z.array(z.string()).prefault([]),
|
|
6635
7028
|
questId: z.string().optional(),
|
|
7029
|
+
/** Extra context messages to include in the conversation from external sources */
|
|
6636
7030
|
extraContextMessages: z.array(z.object({
|
|
6637
7031
|
role: z.enum([
|
|
6638
7032
|
"user",
|
|
@@ -6644,27 +7038,48 @@ z.object({
|
|
|
6644
7038
|
content: z.union([z.string(), z.array(z.any())]),
|
|
6645
7039
|
fabFileIds: z.array(z.string()).optional()
|
|
6646
7040
|
})).optional(),
|
|
7041
|
+
/** Dashboard related params */
|
|
6647
7042
|
dashboardParams: DashboardParamsSchema.optional(),
|
|
7043
|
+
/** LLM params */
|
|
6648
7044
|
params: ChatCompletionCreateInputSchema,
|
|
7045
|
+
/** Whether Quest Master is enabled */
|
|
6649
7046
|
enableQuestMaster: z.boolean().optional(),
|
|
7047
|
+
/** Whether Mementos is enabled */
|
|
6650
7048
|
enableMementos: z.boolean().optional(),
|
|
7049
|
+
/** Whether Artifacts is enabled */
|
|
6651
7050
|
enableArtifacts: z.boolean().optional(),
|
|
7051
|
+
/** Whether Agents is enabled */
|
|
6652
7052
|
enableAgents: z.boolean().optional(),
|
|
7053
|
+
/** Whether Lattice (financial pro-forma modeling) is enabled */
|
|
6653
7054
|
enableLattice: z.boolean().optional(),
|
|
7055
|
+
/** LLM tools to enable (built-in tools or MCP tool names) */
|
|
6654
7056
|
tools: z.array(z.union([b4mLLMTools, z.string()])).optional(),
|
|
7057
|
+
/** Enabled MCP servers */
|
|
6655
7058
|
mcpServers: z.array(z.string()).optional(),
|
|
7059
|
+
/** Project ID */
|
|
6656
7060
|
projectId: z.string().optional(),
|
|
7061
|
+
/** Organization ID */
|
|
6657
7062
|
organizationId: z.string().nullable().optional(),
|
|
7063
|
+
/** Tool prompt ID to use for the LLM */
|
|
6658
7064
|
toolPromptId: z.string().optional(),
|
|
7065
|
+
/** Quest Master related params */
|
|
6659
7066
|
questMaster: QuestMasterParamsSchema.optional(),
|
|
7067
|
+
/** Research Mode related params */
|
|
6660
7068
|
researchMode: ResearchModeParamsSchema.optional(),
|
|
7069
|
+
/** Fallback model ID to try if primary model fails */
|
|
6661
7070
|
fallbackModel: z.string().optional(),
|
|
7071
|
+
/** Embedding model to use */
|
|
6662
7072
|
embeddingModel: z.string().optional(),
|
|
7073
|
+
/** User's timezone (IANA format, e.g., "America/New_York") */
|
|
6663
7074
|
timezone: z.string().optional(),
|
|
7075
|
+
/** Persona-based sub-agent filter — only these agent names are available for delegation */
|
|
6664
7076
|
allowedAgents: z.array(z.string()).optional(),
|
|
7077
|
+
/** When true, Quest Processor injects Slack-specific tool configs (help, notebooks, curated files) */
|
|
6665
7078
|
enableSlackTools: z.boolean().optional()
|
|
6666
7079
|
}).extend({
|
|
7080
|
+
/** Notebook session ID */
|
|
6667
7081
|
sessionId: z.string().optional(),
|
|
7082
|
+
/** Notebook session name */
|
|
6668
7083
|
sessionName: z.string().optional()
|
|
6669
7084
|
});
|
|
6670
7085
|
z.object({
|
|
@@ -6943,20 +7358,35 @@ const ExportFormatSchema = z.enum([
|
|
|
6943
7358
|
"html"
|
|
6944
7359
|
]);
|
|
6945
7360
|
z.object({
|
|
6946
|
-
|
|
7361
|
+
/** Curation type: transcript (Option 1) or executive_summary (Option 2) */
|
|
7362
|
+
curationType: CurationTypeSchema.prefault("transcript"),
|
|
7363
|
+
/** Include code artifacts in the curated notebook */
|
|
6947
7364
|
includeCode: z.boolean().prefault(true),
|
|
7365
|
+
/** Include diagrams (Mermaid, SVG) in the curated notebook */
|
|
6948
7366
|
includeDiagrams: z.boolean().prefault(true),
|
|
7367
|
+
/** Include data visualizations (Recharts) in the curated notebook */
|
|
6949
7368
|
includeDataViz: z.boolean().prefault(true),
|
|
7369
|
+
/** Include QuestMaster plans in the curated notebook */
|
|
6950
7370
|
includeQuestMaster: z.boolean().prefault(true),
|
|
7371
|
+
/** Include Deep Research findings in the curated notebook */
|
|
6951
7372
|
includeResearch: z.boolean().prefault(true),
|
|
7373
|
+
/** Include images in the curated notebook */
|
|
6952
7374
|
includeImages: z.boolean().prefault(true),
|
|
7375
|
+
/** Token budget for processing (varies by curation type) */
|
|
6953
7376
|
tokenBudget: z.number().optional(),
|
|
7377
|
+
/** Export format for the curated notebook */
|
|
6954
7378
|
exportFormat: ExportFormatSchema.prefault("markdown"),
|
|
7379
|
+
/** Custom notebook name (optional, defaults to curated-notebook-{sessionId}) */
|
|
6955
7380
|
customNotebookName: z.string().optional()
|
|
6956
7381
|
});
|
|
6957
7382
|
function isGPTImageModel(model) {
|
|
6958
7383
|
if (!model) return false;
|
|
6959
|
-
return OPENAI_IMAGE_MODELS.includes(model) || model.startsWith("gpt-image-
|
|
7384
|
+
return OPENAI_IMAGE_MODELS.includes(model) || model.startsWith("gpt-image-");
|
|
7385
|
+
}
|
|
7386
|
+
/** Returns true specifically for gpt-image-2 (including versioned snapshots like gpt-image-2-2026-04-21). */
|
|
7387
|
+
function isGPTImage2Model(model) {
|
|
7388
|
+
if (!model) return false;
|
|
7389
|
+
return model === "gpt-image-2" || model.startsWith("gpt-image-2");
|
|
6960
7390
|
}
|
|
6961
7391
|
/**
|
|
6962
7392
|
* Telemetry Error Sanitizer
|
|
@@ -8994,4 +9424,4 @@ var ConfigStore = class {
|
|
|
8994
9424
|
}
|
|
8995
9425
|
};
|
|
8996
9426
|
//#endregion
|
|
8997
|
-
export {
|
|
9427
|
+
export { RechartsChartTypeList as $, ImageGenerationUsageTransaction as A, secureParameters as At, NotFoundError as B, FileEvents as C, getMcpProviderMetadata as Ct, GenericCreditAddTransaction as D, obfuscateApiKey as Dt, GenerateImageToolCallSchema as E, isGPTImageModel as Et, KnowledgeType as F, ProfileEvents as G, OpenAIImageGenerationInput as H, LLMEvents as I, PurchaseTransaction as J, ProjectEvents as K, MiscEvents as L, InboxEvents as M, validateNotebookPath as Mt, InviteEvents as N, CollectionType as Nt, GenericCreditDeductTransaction as O, resolveNavigationIntents as Ot, InviteType as P, ReceivedCreditTransaction as Q, ModalEvents as R, FeedbackEvents as S, getDataLakeTags as St, GEMINI_IMAGE_MODELS as T, isGPTImage2Model as Tt, Permission as U, OpenAIEmbeddingModel as V, PermissionDeniedError as W, REASONING_SUPPORTED_MODELS as X, QuestMasterParamsSchema as Y, RealtimeVoiceUsageTransaction as Z, CompletionApiUsageTransaction as _, VideoModels as _t, ApiKeyEvents as a, SessionEvents as at, FIXED_TEMPERATURE_MODELS as b, b4mLLMTools as bt, AppFileEvents as c, SupportedFabFileMimeTypes as ct, BFL_IMAGE_MODELS as d, TextGenerationUsageTransaction as dt, RegInviteEvents as et, BFL_SAFETY_TOLERANCE as f, ToolUsageTransaction as ft, ChatModels as g, VideoGenerationUsageTransaction as gt, ChatCompletionCreateInputSchema as h, VIDEO_SIZE_CONSTRAINTS as ht, AiEvents as i, ResearchTaskType as it, ImageModels as j, validateJupyterKernelName as jt, ImageEditUsageTransaction as k, sanitizeTelemetryError as kt, ArtifactTypeSchema as l, TagType as lt, CREDIT_DEDUCT_TRANSACTION_TYPES as m, UiNavigationEvents as mt, logger as n, ResearchTaskExecutionType as nt, ApiKeyScope as o, SpeechToTextModels as ot, BedrockEmbeddingModel as p, TransferCreditTransaction as pt, PromptMetaZodSchema as q, ALERT_THRESHOLDS as r, ResearchTaskPeriodicFrequencyType as rt, ApiKeyType as s, SubscriptionCreditTransaction as st, ConfigStore as t, ResearchModeParamsSchema as tt, AuthEvents as u, TaskScheduleHandler as ut, DashboardParamsSchema as v, VoyageAIEmbeddingModel as vt, FriendshipEvents as w, getViewById as wt, FavoriteDocumentType as x, getAccessibleDataLakes as xt, ElabsEvents as y, XAI_IMAGE_MODELS as yt, ModelBackend as z };
|