@mtaap/mcp 0.1.2 → 0.2.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.
@@ -1,1314 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
14
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
- };
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
-
38
- // ../../packages/core/dist/constants/enums.js
39
- var TaskState;
40
- (function(TaskState2) {
41
- TaskState2["BACKLOG"] = "BACKLOG";
42
- TaskState2["READY"] = "READY";
43
- TaskState2["IN_PROGRESS"] = "IN_PROGRESS";
44
- TaskState2["REVIEW"] = "REVIEW";
45
- TaskState2["DONE"] = "DONE";
46
- })(TaskState || (TaskState = {}));
47
- var UserRole;
48
- (function(UserRole2) {
49
- UserRole2["ADMIN"] = "ADMIN";
50
- UserRole2["MEMBER"] = "MEMBER";
51
- })(UserRole || (UserRole = {}));
52
- var ProjectType;
53
- (function(ProjectType2) {
54
- ProjectType2["TEAM"] = "TEAM";
55
- ProjectType2["PERSONAL"] = "PERSONAL";
56
- })(ProjectType || (ProjectType = {}));
57
- var ProjectOrigin;
58
- (function(ProjectOrigin2) {
59
- ProjectOrigin2["CREATED"] = "CREATED";
60
- ProjectOrigin2["PROMOTED"] = "PROMOTED";
61
- })(ProjectOrigin || (ProjectOrigin = {}));
62
- var TaskPriority;
63
- (function(TaskPriority2) {
64
- TaskPriority2["LOW"] = "LOW";
65
- TaskPriority2["MEDIUM"] = "MEDIUM";
66
- TaskPriority2["HIGH"] = "HIGH";
67
- TaskPriority2["CRITICAL"] = "CRITICAL";
68
- })(TaskPriority || (TaskPriority = {}));
69
- var DeploymentMode;
70
- (function(DeploymentMode2) {
71
- DeploymentMode2["SAAS"] = "saas";
72
- DeploymentMode2["ONPREM"] = "onprem";
73
- })(DeploymentMode || (DeploymentMode = {}));
74
- var ErrorType;
75
- (function(ErrorType2) {
76
- ErrorType2["BUILD_FAILURE"] = "BUILD_FAILURE";
77
- ErrorType2["TEST_FAILURE"] = "TEST_FAILURE";
78
- ErrorType2["CONFLICT"] = "CONFLICT";
79
- ErrorType2["AUTH_ERROR"] = "AUTH_ERROR";
80
- ErrorType2["OTHER"] = "OTHER";
81
- })(ErrorType || (ErrorType = {}));
82
- var PRStatus;
83
- (function(PRStatus2) {
84
- PRStatus2["OPEN"] = "OPEN";
85
- PRStatus2["CLOSED"] = "CLOSED";
86
- PRStatus2["MERGED"] = "MERGED";
87
- PRStatus2["DELETED"] = "DELETED";
88
- })(PRStatus || (PRStatus = {}));
89
- var PricingTier;
90
- (function(PricingTier2) {
91
- PricingTier2["FREE"] = "FREE";
92
- PricingTier2["PRO"] = "PRO";
93
- PricingTier2["ENTERPRISE"] = "ENTERPRISE";
94
- })(PricingTier || (PricingTier = {}));
95
- var ApiKeyPermission;
96
- (function(ApiKeyPermission2) {
97
- ApiKeyPermission2["READ"] = "READ";
98
- ApiKeyPermission2["WRITE"] = "WRITE";
99
- ApiKeyPermission2["ADMIN"] = "ADMIN";
100
- })(ApiKeyPermission || (ApiKeyPermission = {}));
101
- var WebSocketEventType;
102
- (function(WebSocketEventType2) {
103
- WebSocketEventType2["TASK_ASSIGNED"] = "task.assigned";
104
- WebSocketEventType2["TASK_ABANDONED"] = "task.abandoned";
105
- WebSocketEventType2["TASK_PROGRESS"] = "task.progress";
106
- WebSocketEventType2["TASK_PR_CREATED"] = "task.pr_created";
107
- WebSocketEventType2["TASK_REVIEW_REQUESTED"] = "task.review_requested";
108
- WebSocketEventType2["TASK_COMPLETED"] = "task.completed";
109
- WebSocketEventType2["TASK_ERROR"] = "task.error";
110
- WebSocketEventType2["TASK_STATE_CHANGED"] = "task.state_changed";
111
- WebSocketEventType2["MEMBER_JOINED"] = "member.joined";
112
- })(WebSocketEventType || (WebSocketEventType = {}));
113
- var AuthProvider;
114
- (function(AuthProvider2) {
115
- AuthProvider2["CREDENTIALS"] = "credentials";
116
- AuthProvider2["LDAP"] = "ldap";
117
- AuthProvider2["SSO"] = "sso";
118
- })(AuthProvider || (AuthProvider = {}));
119
- var SubscriptionStatus;
120
- (function(SubscriptionStatus2) {
121
- SubscriptionStatus2["ACTIVE"] = "ACTIVE";
122
- SubscriptionStatus2["INACTIVE"] = "INACTIVE";
123
- SubscriptionStatus2["PAST_DUE"] = "PAST_DUE";
124
- SubscriptionStatus2["CANCELED"] = "CANCELED";
125
- SubscriptionStatus2["INCOMPLETE"] = "INCOMPLETE";
126
- })(SubscriptionStatus || (SubscriptionStatus = {}));
127
- var EventType;
128
- (function(EventType2) {
129
- EventType2["AUTH"] = "AUTH";
130
- EventType2["AUTHORIZATION"] = "AUTHORIZATION";
131
- EventType2["ACCESS"] = "ACCESS";
132
- EventType2["MODIFICATION"] = "MODIFICATION";
133
- })(EventType || (EventType = {}));
134
-
135
- // ../../packages/core/dist/constants/state-machine.js
136
- var VALID_TRANSITIONS = {
137
- [TaskState.BACKLOG]: [TaskState.READY],
138
- [TaskState.READY]: [TaskState.BACKLOG, TaskState.IN_PROGRESS],
139
- [TaskState.IN_PROGRESS]: [
140
- TaskState.BACKLOG,
141
- TaskState.READY,
142
- TaskState.REVIEW
143
- ],
144
- [TaskState.REVIEW]: [
145
- TaskState.BACKLOG,
146
- TaskState.READY,
147
- TaskState.IN_PROGRESS,
148
- TaskState.DONE
149
- ],
150
- [TaskState.DONE]: []
151
- };
152
- function isValidStateTransition(from, to) {
153
- if (from === to)
154
- return true;
155
- return VALID_TRANSITIONS[from]?.includes(to) ?? false;
156
- }
157
- function getValidNextStates(current) {
158
- return VALID_TRANSITIONS[current] ?? [];
159
- }
160
- function validateStateTransition(from, to) {
161
- if (from === to) {
162
- return { valid: true };
163
- }
164
- if (!isValidStateTransition(from, to)) {
165
- const validNext = getValidNextStates(from);
166
- const validStates = validNext.length > 0 ? validNext.join(", ") : "none";
167
- return {
168
- valid: false,
169
- error: `Invalid state transition from ${from} to ${to}. Valid transitions: ${validStates}`
170
- };
171
- }
172
- return { valid: true };
173
- }
174
-
175
- // ../../packages/core/dist/version.js
176
- var VERSION = "0.1.0";
177
-
178
- // ../../packages/core/dist/config/index.js
179
- var DEPLOYMENT_MODE = process.env.DEPLOYMENT_MODE || "saas";
180
- var config = {
181
- version: VERSION,
182
- deploymentMode: DEPLOYMENT_MODE,
183
- billing: {
184
- enabled: DEPLOYMENT_MODE === "saas",
185
- revenuecat: {
186
- publicKey: process.env.REVENUECAT_PUBLIC_API_KEY,
187
- stripeKey: process.env.STRIPE_SECRET_KEY
188
- // Required by RevenueCat Web Billing
189
- }
190
- },
191
- licensing: {
192
- enabled: DEPLOYMENT_MODE === "onprem",
193
- licenseKey: process.env.LICENSE_KEY
194
- },
195
- auth: {
196
- credentials: true,
197
- ldap: process.env.LDAP_ENABLED === "true"
198
- },
199
- git: {
200
- deleteMergedBranches: process.env.DELETE_MERGED_BRANCHES !== "false",
201
- enforceConventionalCommits: process.env.ENFORCE_CONVENTIONAL_COMMITS === "true",
202
- defaultBaseBranch: process.env.DEFAULT_BASE_BRANCH || "develop"
203
- },
204
- pricing: {
205
- maxPersonalProjects: {
206
- FREE: 2,
207
- PRO: 5,
208
- ENTERPRISE: 10
209
- },
210
- maxCollaboratorsPerProject: {
211
- FREE: 3,
212
- PRO: -1,
213
- ENTERPRISE: -1
214
- },
215
- maxProjectsPerOrg: {
216
- FREE: 5,
217
- PRO: -1,
218
- ENTERPRISE: -1
219
- },
220
- maxSeats: {
221
- FREE: 3,
222
- PRO: -1,
223
- ENTERPRISE: -1
224
- },
225
- // Default seats when subscription doesn't specify an explicit seat count
226
- defaultSeats: {
227
- FREE: 3,
228
- PRO: 10,
229
- ENTERPRISE: 999999
230
- }
231
- },
232
- features: {
233
- stripe: {
234
- enabled: DEPLOYMENT_MODE === "saas"
235
- },
236
- gitlab: {
237
- enabled: true
238
- },
239
- ldap: {
240
- enabled: process.env.LDAP_ENABLED === "true"
241
- },
242
- auditLogs: {
243
- enabled: process.env.AUDIT_LOGS_ENABLED === "true"
244
- }
245
- },
246
- api: {
247
- apiKey: {
248
- defaultExpiryDays: 90,
249
- prefix: "usr_"
250
- },
251
- rateLimit: {
252
- requestsPerMinute: 100,
253
- requestsPerHour: 1e3
254
- }
255
- },
256
- limits: {
257
- projectNameMaxLength: 100,
258
- taskDescriptionMaxLength: 5e3,
259
- notesMaxLength: 500,
260
- conventionsNotesMaxLength: 500,
261
- recentCompletedTasksLimit: 10
262
- }
263
- };
264
- function getConfig(key) {
265
- return config[key];
266
- }
267
- function isFeatureEnabled(feature) {
268
- const featureConfig = config.features[feature];
269
- if (typeof featureConfig === "object" && "enabled" in featureConfig) {
270
- return featureConfig.enabled;
271
- }
272
- return true;
273
- }
274
- function getPricingLimits(tier) {
275
- return {
276
- maxPersonalProjects: config.pricing.maxPersonalProjects[tier],
277
- maxCollaboratorsPerProject: config.pricing.maxCollaboratorsPerProject[tier],
278
- maxProjectsPerOrg: config.pricing.maxProjectsPerOrg[tier],
279
- maxSeats: config.pricing.maxSeats[tier]
280
- };
281
- }
282
- var DEFAULT_SEAT_LIMITS = {
283
- [PricingTier.FREE]: config.pricing.defaultSeats.FREE,
284
- [PricingTier.PRO]: config.pricing.defaultSeats.PRO,
285
- [PricingTier.ENTERPRISE]: config.pricing.defaultSeats.ENTERPRISE
286
- };
287
-
288
- // ../../packages/core/dist/types/index.js
289
- import { z } from "zod";
290
- var UserIdSchema = z.string().regex(/^usr_[a-zA-Z0-9]+$/);
291
- var UserSchema = z.object({
292
- id: UserIdSchema,
293
- email: z.string().email(),
294
- name: z.string().min(1).max(255),
295
- role: z.nativeEnum(UserRole),
296
- organizationId: z.string().optional(),
297
- lastActiveAt: z.coerce.date().optional(),
298
- createdAt: z.coerce.date()
299
- });
300
- var OrganizationUserSchema = z.object({
301
- id: z.number().int(),
302
- userId: UserIdSchema,
303
- organizationId: z.string(),
304
- roleId: z.nativeEnum(UserRole).optional(),
305
- user: UserSchema.pick({ id: true, email: true, name: true, role: true }),
306
- createdAt: z.coerce.date()
307
- });
308
- var OrganizationIdSchema = z.string().regex(/^org_[a-zA-Z0-9]+$/);
309
- var OrganizationSchema = z.object({
310
- id: OrganizationIdSchema,
311
- name: z.string().min(1).max(255),
312
- slug: z.string().min(1).max(100).regex(/^[a-z0-9-]+$/),
313
- logoUrl: z.string().url().nullable(),
314
- accentColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/).nullable(),
315
- tenantName: z.string().nullable(),
316
- pricingTier: z.nativeEnum(PricingTier),
317
- createdAt: z.coerce.date()
318
- });
319
- var OrganizationSettingsSchema = z.object({
320
- organizationId: OrganizationIdSchema,
321
- ldapEnabled: z.boolean(),
322
- ldapUrl: z.string().url().nullable(),
323
- ldapBindDN: z.string().nullable(),
324
- ldapSearchBase: z.string().nullable(),
325
- deleteMergedBranches: z.boolean(),
326
- enforceConventionalCommits: z.boolean(),
327
- maxPersonalProjectsPerUser: z.number().int().min(0)
328
- });
329
- var TagSchema = z.object({
330
- id: z.string(),
331
- name: z.string().min(1).max(50),
332
- organizationId: OrganizationIdSchema,
333
- createdAt: z.coerce.date()
334
- });
335
- var ProjectIdSchema = z.string().regex(/^prj_[a-zA-Z0-9]+$/);
336
- var ProjectSchema = z.object({
337
- id: ProjectIdSchema,
338
- name: z.string().min(1).max(100),
339
- description: z.string().max(500).nullable(),
340
- type: z.nativeEnum(ProjectType),
341
- origin: z.nativeEnum(ProjectOrigin),
342
- organizationId: OrganizationIdSchema,
343
- ownerId: UserIdSchema.nullable(),
344
- repositoryUrl: z.string().url(),
345
- baseBranch: z.string().default("develop"),
346
- tags: z.array(z.string()),
347
- createdAt: z.coerce.date(),
348
- updatedAt: z.coerce.date()
349
- });
350
- var EpicIdSchema = z.string().regex(/^epc_[a-zA-Z0-9]+$/);
351
- var EpicSchema = z.object({
352
- id: EpicIdSchema,
353
- projectId: ProjectIdSchema,
354
- name: z.string().min(1).max(200),
355
- description: z.string().nullable(),
356
- createdAt: z.coerce.date(),
357
- updatedAt: z.coerce.date()
358
- });
359
- var TaskIdSchema = z.string().regex(/^tsk_[a-zA-Z0-9]+$/);
360
- function generateTaskDisplayId(taskCuid) {
361
- const lastChars = taskCuid.slice(-3).toUpperCase();
362
- return `TASK-${lastChars}`;
363
- }
364
- var TaskSchema = z.object({
365
- id: TaskIdSchema,
366
- projectId: ProjectIdSchema,
367
- epicId: EpicIdSchema.nullable(),
368
- title: z.string().min(1).max(200),
369
- description: z.string().max(5e3),
370
- state: z.nativeEnum(TaskState),
371
- priority: z.nativeEnum(TaskPriority),
372
- assigneeId: UserIdSchema.nullable(),
373
- createdBy: UserIdSchema.nullable(),
374
- assignedAt: z.coerce.date().nullable(),
375
- startedAt: z.coerce.date().nullable(),
376
- completedAt: z.coerce.date().nullable(),
377
- branchName: z.string().nullable(),
378
- pullRequestUrl: z.string().url().nullable(),
379
- pullRequestNumber: z.number().int().nullable(),
380
- pullRequestStatus: z.nativeEnum(PRStatus).nullable(),
381
- errorType: z.nativeEnum(ErrorType).nullable(),
382
- errorMessage: z.string().max(1e3).nullable(),
383
- createdAt: z.coerce.date(),
384
- updatedAt: z.coerce.date()
385
- });
386
- var AcceptanceCriterionSchema = z.object({
387
- id: z.string(),
388
- taskId: TaskIdSchema,
389
- description: z.string().min(1).max(500),
390
- completed: z.boolean(),
391
- completedAt: z.coerce.date().nullable(),
392
- order: z.number().int(),
393
- createdAt: z.coerce.date()
394
- });
395
- var ProgressUpdateSchema = z.object({
396
- id: z.string(),
397
- taskId: TaskIdSchema,
398
- userId: UserIdSchema,
399
- message: z.string().max(2e3),
400
- checkpoints: z.array(z.string()).optional(),
401
- createdAt: z.coerce.date()
402
- });
403
- var TaskNoteSchema = z.object({
404
- id: z.string(),
405
- taskId: TaskIdSchema,
406
- userId: UserIdSchema,
407
- content: z.string().max(500),
408
- createdAt: z.coerce.date()
409
- });
410
- var ApiKeyIdSchema = z.string().regex(/^key_[a-zA-Z0-9]+$/);
411
- var ApiKeySchema = z.object({
412
- id: ApiKeyIdSchema,
413
- userId: UserIdSchema,
414
- name: z.string().min(1).max(100),
415
- keyHash: z.string(),
416
- permissions: z.nativeEnum(ApiKeyPermission),
417
- lastUsedAt: z.coerce.date().nullable(),
418
- expiresAt: z.coerce.date().nullable(),
419
- revoked: z.boolean(),
420
- createdAt: z.coerce.date()
421
- });
422
- var SubscriptionIdSchema = z.string();
423
- var SubscriptionSchema = z.object({
424
- id: SubscriptionIdSchema,
425
- organizationId: OrganizationIdSchema,
426
- pricingTier: z.nativeEnum(PricingTier),
427
- seats: z.number().int().min(0),
428
- stripeSubscriptionId: z.string().nullable(),
429
- stripeCustomerId: z.string().nullable(),
430
- status: z.enum(["active", "past_due", "canceled", "incomplete"]),
431
- currentPeriodStart: z.coerce.date(),
432
- currentPeriodEnd: z.coerce.date(),
433
- createdAt: z.coerce.date()
434
- });
435
- var ProjectCollaboratorSchema = z.object({
436
- id: z.string(),
437
- projectId: ProjectIdSchema,
438
- userId: UserIdSchema,
439
- addedBy: UserIdSchema,
440
- createdAt: z.coerce.date()
441
- });
442
-
443
- // ../../packages/core/dist/validation/index.js
444
- import { z as z2 } from "zod";
445
-
446
- // ../../packages/core/dist/validation/tier-validation.js
447
- function validateTierLimit(context) {
448
- const limits = getPricingLimits(context.tier);
449
- let limit;
450
- let resourceName;
451
- switch (context.resourceType) {
452
- case "organization":
453
- case "seat":
454
- limit = limits.maxSeats;
455
- resourceName = "seats";
456
- break;
457
- case "personal_project":
458
- limit = limits.maxPersonalProjects;
459
- resourceName = "personal projects";
460
- break;
461
- case "team_project":
462
- limit = limits.maxProjectsPerOrg;
463
- resourceName = "team projects";
464
- break;
465
- case "collaborator":
466
- limit = limits.maxCollaboratorsPerProject;
467
- resourceName = "collaborators per project";
468
- break;
469
- default:
470
- throw new Error(`Unknown resource type: ${context.resourceType}`);
471
- }
472
- const isUnlimited = limit === -1;
473
- const allowed = isUnlimited || context.currentCount < limit;
474
- const available = isUnlimited ? -1 : Math.max(0, limit - context.currentCount);
475
- let message;
476
- if (allowed) {
477
- if (isUnlimited) {
478
- message = `Unlimited ${resourceName} available on ${context.tier} tier`;
479
- } else {
480
- message = `${available} of ${limit} ${resourceName} available`;
481
- }
482
- } else {
483
- message = `${context.tier} tier limit reached: ${context.currentCount}/${limit} ${resourceName}. Upgrade to increase limit.`;
484
- }
485
- return {
486
- allowed,
487
- limit: isUnlimited ? -1 : limit,
488
- current: context.currentCount,
489
- available,
490
- upgradeRequired: !allowed,
491
- message
492
- };
493
- }
494
- function calculateTierUsagePercentage(current, limit) {
495
- if (limit === -1)
496
- return 0;
497
- if (limit === 0)
498
- return 100;
499
- return Math.round(current / limit * 100);
500
- }
501
- function shouldShowUpgradePrompt(current, limit, threshold = 80) {
502
- if (limit === -1)
503
- return false;
504
- const percentage = calculateTierUsagePercentage(current, limit);
505
- return percentage >= threshold;
506
- }
507
- function getUpgradeMessage(tier) {
508
- switch (tier) {
509
- case PricingTier.FREE:
510
- return "Upgrade to PRO for unlimited projects and collaborators";
511
- case PricingTier.PRO:
512
- return "Upgrade to ENTERPRISE for priority support and advanced features";
513
- case PricingTier.ENTERPRISE:
514
- return "Contact us for custom enterprise solutions";
515
- }
516
- }
517
-
518
- // ../../packages/core/dist/validation/index.js
519
- var ListProjectsInputSchema = z2.object({
520
- workspaceType: z2.preprocess((val) => typeof val === "string" ? val.toUpperCase() : val, z2.enum(["TEAM", "PERSONAL", "ALL"]).optional())
521
- });
522
- var ListTasksInputSchema = z2.object({
523
- projectId: z2.string().optional(),
524
- state: z2.nativeEnum(TaskState).optional(),
525
- assigneeId: z2.string().optional()
526
- });
527
- var GetTaskInputSchema = z2.object({
528
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/)
529
- });
530
- var AssignTaskInputSchema = z2.object({
531
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/),
532
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/),
533
- expectedState: z2.nativeEnum(TaskState).default(TaskState.READY)
534
- });
535
- var UpdateProgressInputSchema = z2.object({
536
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/),
537
- statusMessage: z2.string().max(1e3).optional(),
538
- completedCheckpointIds: z2.array(z2.string()).optional(),
539
- currentCheckpointIndex: z2.number().int().optional()
540
- });
541
- var CompleteTaskInputSchema = z2.object({
542
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/),
543
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/),
544
- pullRequestTitle: z2.string().min(1).max(300).optional(),
545
- pullRequestBody: z2.string().max(1e4).optional()
546
- });
547
- var ReportErrorInputSchema = z2.object({
548
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/),
549
- errorType: z2.nativeEnum(ErrorType),
550
- errorMessage: z2.string().min(1).max(1e3),
551
- context: z2.string().max(2e3).optional()
552
- });
553
- var GetProjectContextInputSchema = z2.object({
554
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/)
555
- });
556
- var AddNoteInputSchema = z2.object({
557
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/),
558
- content: z2.string().min(1).max(500)
559
- });
560
- var AbandonTaskInputSchema = z2.object({
561
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/),
562
- taskId: z2.string().regex(/^tsk_[a-zA-Z0-9]+$/),
563
- deleteBranch: z2.boolean().optional()
564
- });
565
- var CreatePersonalProjectInputSchema = z2.object({
566
- name: z2.string().min(1).max(100),
567
- description: z2.string().max(500).optional(),
568
- repositoryUrl: z2.string().url()
569
- });
570
- var CheckActiveTaskInputSchema = z2.object({});
571
- var CreateOrganizationInputSchema = z2.object({
572
- name: z2.string().min(1).max(255),
573
- slug: z2.string().min(1).max(100).regex(/^[a-z0-9-]+$/).optional()
574
- });
575
- var UpdateOrganizationInputSchema = z2.object({
576
- organizationId: z2.string().regex(/^org_[a-zA-Z0-9]+$/),
577
- name: z2.string().min(1).max(255).optional(),
578
- logoUrl: z2.string().url().nullable().optional(),
579
- accentColor: z2.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color format. Expected #RRGGBB").nullable().optional(),
580
- tenantName: z2.string().max(255).nullable().optional()
581
- });
582
- var CreateProjectInputSchema = z2.object({
583
- name: z2.string().min(1).max(100),
584
- description: z2.string().max(500).optional(),
585
- type: z2.nativeEnum(ProjectType),
586
- repositoryUrl: z2.string().url(),
587
- baseBranch: z2.string().default("develop").optional(),
588
- tags: z2.array(z2.string()).default([])
589
- });
590
- var UpdateProjectInputSchema = z2.object({
591
- projectId: z2.string().min(1).optional(),
592
- name: z2.string().min(1).max(100).optional(),
593
- description: z2.string().max(500).optional(),
594
- repositoryUrl: z2.string().url().optional(),
595
- baseBranch: z2.string().optional(),
596
- tags: z2.array(z2.string()).optional()
597
- });
598
- var CreateEpicInputSchema = z2.object({
599
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/),
600
- name: z2.string().min(1).max(200),
601
- description: z2.string().max(2e3).optional()
602
- });
603
- var CreateTaskInputSchema = z2.object({
604
- projectId: z2.string().min(1),
605
- epicId: z2.string().min(1).nullable().optional(),
606
- title: z2.string().min(1).max(200),
607
- description: z2.string().max(5e3),
608
- priority: z2.nativeEnum(TaskPriority).default(TaskPriority.MEDIUM),
609
- acceptanceCriteria: z2.array(z2.object({
610
- description: z2.string().min(1).max(500)
611
- })).min(1)
612
- });
613
- var UpdateTaskInputSchema = z2.object({
614
- taskId: z2.string().min(1),
615
- title: z2.string().min(1).max(200).optional(),
616
- description: z2.string().max(5e3).optional(),
617
- priority: z2.nativeEnum(TaskPriority).optional(),
618
- state: z2.nativeEnum(TaskState).optional(),
619
- assigneeId: z2.string().nullable().optional(),
620
- acceptanceCriteria: z2.array(z2.object({
621
- id: z2.string().optional(),
622
- description: z2.string().min(1).max(500),
623
- completed: z2.boolean().optional()
624
- })).optional()
625
- });
626
- var AssignTaskWebappInputSchema = z2.object({
627
- taskId: z2.string().min(1),
628
- userId: z2.string().min(1)
629
- });
630
- var CreateTagInputSchema = z2.object({
631
- organizationId: z2.string().regex(/^org_[a-zA-Z0-9]+$/),
632
- name: z2.string().min(1).max(50).regex(/^[a-zA-Z0-9\s-]+$/)
633
- });
634
- var UpdateTagInputSchema = z2.object({
635
- name: z2.string().min(1).max(50).regex(/^[a-zA-Z0-9\s-]+$/)
636
- });
637
- var UpdateOrganizationSettingsInputSchema = z2.object({
638
- organizationId: z2.string().regex(/^org_[a-zA-Z0-9]+$/),
639
- ldapEnabled: z2.boolean().optional(),
640
- ldapUrl: z2.string().url().nullable().optional(),
641
- ldapBindDN: z2.string().nullable().optional(),
642
- ldapSearchBase: z2.string().nullable().optional(),
643
- deleteMergedBranches: z2.boolean().optional(),
644
- enforceConventionalCommits: z2.boolean().optional(),
645
- maxPersonalProjectsPerUser: z2.number().int().min(0).optional(),
646
- logoUrl: z2.string().url().nullable().optional(),
647
- accentColor: z2.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color format. Expected #RRGGBB").nullable().optional(),
648
- tenantName: z2.string().max(255).nullable().optional()
649
- });
650
- var InviteUserInputSchema = z2.object({
651
- organizationId: z2.string().regex(/^org_[a-zA-Z0-9]+$/),
652
- email: z2.string().email(),
653
- role: z2.nativeEnum(UserRole).default(UserRole.MEMBER),
654
- tags: z2.array(z2.string()).default([])
655
- });
656
- var AssignUserTagsInputSchema = z2.object({
657
- userId: z2.string().regex(/^usr_[a-zA-Z0-9]+$/),
658
- tags: z2.array(z2.string()).min(0)
659
- });
660
- var InviteCollaboratorInputSchema = z2.object({
661
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/),
662
- email: z2.string().email()
663
- });
664
- var PublishProjectInputSchema = z2.object({
665
- projectId: z2.string().regex(/^prj_[a-zA-Z0-9]+$/),
666
- transferOwnership: z2.boolean().default(false),
667
- tags: z2.array(z2.string()).min(1)
668
- });
669
- var GenerateApiKeyInputSchema = z2.object({
670
- name: z2.string().min(1).max(100),
671
- expiresInDays: z2.number().int().min(1).max(365).default(90),
672
- permissions: z2.nativeEnum(ApiKeyPermission).default(ApiKeyPermission.WRITE)
673
- });
674
- var RevokeApiKeyInputSchema = z2.object({
675
- keyId: z2.string().regex(/^key_[a-zA-Z0-9]+$/)
676
- });
677
- var LoginInputSchema = z2.object({
678
- email: z2.string().email(),
679
- password: z2.string().min(8).max(255)
680
- });
681
- var RegisterInputSchema = z2.object({
682
- email: z2.string().email(),
683
- password: z2.string().min(8).max(255),
684
- name: z2.string().min(1).max(255),
685
- organizationSlug: z2.string().min(1).max(100).regex(/^[a-z0-9-]+$/).optional()
686
- });
687
-
688
- // ../../packages/core/dist/logging/logger.js
689
- var LOG_LEVELS = {
690
- debug: 0,
691
- info: 1,
692
- warn: 2,
693
- error: 3
694
- };
695
- function getMinLogLevel() {
696
- const env = process.env.LOG_LEVEL?.toLowerCase();
697
- if (env && env in LOG_LEVELS) {
698
- return env;
699
- }
700
- return process.env.NODE_ENV === "production" ? "info" : "debug";
701
- }
702
- function shouldLog(level) {
703
- return LOG_LEVELS[level] >= LOG_LEVELS[getMinLogLevel()];
704
- }
705
- function formatError(error) {
706
- if (!error)
707
- return void 0;
708
- if (error instanceof Error) {
709
- return {
710
- name: error.name,
711
- message: error.message,
712
- stack: error.stack
713
- };
714
- }
715
- return {
716
- name: "UnknownError",
717
- message: String(error)
718
- };
719
- }
720
- function createLogEntry(level, message, context, error) {
721
- const entry = {
722
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
723
- level,
724
- message
725
- };
726
- if (context && Object.keys(context).length > 0) {
727
- entry.context = context;
728
- }
729
- if (error) {
730
- entry.error = formatError(error);
731
- }
732
- return entry;
733
- }
734
- function outputLog(entry) {
735
- const isProduction = process.env.NODE_ENV === "production";
736
- if (isProduction) {
737
- console[entry.level === "debug" ? "log" : entry.level](JSON.stringify(entry));
738
- } else {
739
- const prefix = `[${entry.timestamp}] [${entry.level.toUpperCase()}]`;
740
- const contextStr = entry.context ? ` ${JSON.stringify(entry.context)}` : "";
741
- if (entry.error) {
742
- console[entry.level === "debug" ? "log" : entry.level](`${prefix} ${entry.message}${contextStr}`, entry.error);
743
- } else {
744
- console[entry.level === "debug" ? "log" : entry.level](`${prefix} ${entry.message}${contextStr}`);
745
- }
746
- }
747
- }
748
- var logger = {
749
- debug(message, context) {
750
- if (shouldLog("debug")) {
751
- outputLog(createLogEntry("debug", message, context));
752
- }
753
- },
754
- info(message, context) {
755
- if (shouldLog("info")) {
756
- outputLog(createLogEntry("info", message, context));
757
- }
758
- },
759
- warn(message, context, error) {
760
- if (shouldLog("warn")) {
761
- outputLog(createLogEntry("warn", message, context, error));
762
- }
763
- },
764
- error(message, context, error) {
765
- if (shouldLog("error")) {
766
- outputLog(createLogEntry("error", message, context, error));
767
- }
768
- },
769
- withContext(baseContext) {
770
- return {
771
- debug: (message, context) => logger.debug(message, { ...baseContext, ...context }),
772
- info: (message, context) => logger.info(message, { ...baseContext, ...context }),
773
- warn: (message, context, error) => logger.warn(message, { ...baseContext, ...context }, error),
774
- error: (message, context, error) => logger.error(message, { ...baseContext, ...context }, error)
775
- };
776
- }
777
- };
778
- function createRequestLogger(requestId) {
779
- return logger.withContext({ requestId });
780
- }
781
-
782
- // ../../packages/core/dist/logging/metrics.js
783
- var metrics = /* @__PURE__ */ new Map();
784
- function labelsToKey(labels) {
785
- if (!labels || Object.keys(labels).length === 0)
786
- return "";
787
- return Object.entries(labels).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}="${v}"`).join(",");
788
- }
789
- function createCounter(name, help) {
790
- const data = {
791
- name,
792
- type: "counter",
793
- help,
794
- values: /* @__PURE__ */ new Map()
795
- };
796
- metrics.set(name, data);
797
- return {
798
- inc(labels, value = 1) {
799
- const key = labelsToKey(labels);
800
- const current = data.values.get(key) || 0;
801
- data.values.set(key, current + value);
802
- }
803
- };
804
- }
805
- function createGauge(name, help) {
806
- const data = {
807
- name,
808
- type: "gauge",
809
- help,
810
- values: /* @__PURE__ */ new Map()
811
- };
812
- metrics.set(name, data);
813
- return {
814
- set(labels, value) {
815
- const key = labelsToKey(labels);
816
- data.values.set(key, value);
817
- },
818
- inc(labels, value = 1) {
819
- const key = labelsToKey(labels);
820
- const current = data.values.get(key) || 0;
821
- data.values.set(key, current + value);
822
- },
823
- dec(labels, value = 1) {
824
- const key = labelsToKey(labels);
825
- const current = data.values.get(key) || 0;
826
- data.values.set(key, current - value);
827
- }
828
- };
829
- }
830
- function createHistogram(name, help, buckets = [5e-3, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]) {
831
- const data = {
832
- name,
833
- type: "histogram",
834
- help,
835
- values: /* @__PURE__ */ new Map(),
836
- buckets
837
- };
838
- metrics.set(name, data);
839
- return {
840
- observe(labels, value) {
841
- const baseKey = labelsToKey(labels);
842
- const sumKey = `${baseKey}|sum`;
843
- const countKey = `${baseKey}|count`;
844
- data.values.set(sumKey, (data.values.get(sumKey) || 0) + value);
845
- data.values.set(countKey, (data.values.get(countKey) || 0) + 1);
846
- for (const bucket of buckets) {
847
- const bucketKey = `${baseKey}|le="${bucket}"`;
848
- if (value <= bucket) {
849
- data.values.set(bucketKey, (data.values.get(bucketKey) || 0) + 1);
850
- }
851
- }
852
- const infKey = `${baseKey}|le="+Inf"`;
853
- data.values.set(infKey, (data.values.get(infKey) || 0) + 1);
854
- }
855
- };
856
- }
857
- function getMetricsAsPrometheus() {
858
- const lines = [];
859
- for (const [, data] of metrics) {
860
- lines.push(`# HELP ${data.name} ${data.help}`);
861
- lines.push(`# TYPE ${data.name} ${data.type}`);
862
- if (data.type === "histogram") {
863
- const grouped = /* @__PURE__ */ new Map();
864
- for (const [key, value] of data.values) {
865
- const [baseLabels, suffix] = key.split("|");
866
- if (!grouped.has(baseLabels)) {
867
- grouped.set(baseLabels, /* @__PURE__ */ new Map());
868
- }
869
- grouped.get(baseLabels).set(suffix, value);
870
- }
871
- for (const [baseLabels, suffixes] of grouped) {
872
- const labelStr = baseLabels ? `{${baseLabels}}` : "";
873
- for (const [suffix, value] of suffixes) {
874
- if (suffix.startsWith("le=")) {
875
- const le = suffix.replace("le=", "");
876
- const fullLabels = baseLabels ? `{${baseLabels},le=${le}}` : `{le=${le}}`;
877
- lines.push(`${data.name}_bucket${fullLabels} ${value}`);
878
- }
879
- }
880
- lines.push(`${data.name}_sum${labelStr} ${suffixes.get("sum") || 0}`);
881
- lines.push(`${data.name}_count${labelStr} ${suffixes.get("count") || 0}`);
882
- }
883
- } else {
884
- for (const [key, value] of data.values) {
885
- const labelStr = key ? `{${key}}` : "";
886
- lines.push(`${data.name}${labelStr} ${value}`);
887
- }
888
- }
889
- lines.push("");
890
- }
891
- return lines.join("\n");
892
- }
893
- function resetMetrics() {
894
- for (const data of metrics.values()) {
895
- data.values.clear();
896
- }
897
- }
898
- var httpRequestsTotal = createCounter("mtaap_http_requests_total", "Total number of HTTP requests");
899
- var httpRequestDuration = createHistogram("mtaap_http_request_duration_seconds", "HTTP request duration in seconds");
900
- var activeUsers = createGauge("mtaap_active_users", "Number of active users");
901
- var tasksTotal = createCounter("mtaap_tasks_total", "Total number of tasks by state");
902
- var taskStateChanges = createCounter("mtaap_task_state_changes_total", "Total number of task state changes");
903
- var httpErrorsTotal = createCounter("mtaap_http_errors_total", "Total number of HTTP errors");
904
- var httpActiveConnections = createGauge("mtaap_http_active_connections", "Number of active HTTP connections");
905
- var newSignupsTotal = createCounter("mtaap_new_signups_total", "Total number of new user signups");
906
- var loginSuccessTotal = createCounter("mtaap_login_success_total", "Total number of successful logins");
907
- var loginFailureTotal = createCounter("mtaap_login_failure_total", "Total number of failed logins");
908
- var dbConnectionPoolActive = createGauge("mtaap_db_connection_pool_active", "Number of active database connections");
909
- var dbConnectionPoolIdle = createGauge("mtaap_db_connection_pool_idle", "Number of idle database connections");
910
- var dbConnectionPoolMax = createGauge("mtaap_db_connection_pool_max", "Maximum number of database connections");
911
- var dbQueryDuration = createHistogram("mtaap_db_query_duration_seconds", "Database query duration in seconds");
912
- var dbSlowQueriesTotal = createCounter("mtaap_db_slow_queries_total", "Total number of slow database queries (>1s)");
913
- var dbErrorsTotal = createCounter("mtaap_db_errors_total", "Total number of database errors");
914
- var tasksCreatedTotal = createCounter("mtaap_tasks_created_total", "Total number of tasks created");
915
- var tasksAssignedTotal = createCounter("mtaap_tasks_assigned_total", "Total number of tasks assigned");
916
- var tasksCompletedTotal = createCounter("mtaap_tasks_completed_total", "Total number of tasks completed");
917
- var tasksByState = createGauge("mtaap_tasks_by_state", "Number of tasks by state");
918
-
919
- // ../../packages/core/dist/logging/performance-monitor.js
920
- var MAX_SAMPLES = 1e3;
921
- var ALERT_COOLDOWN_MS = 5 * 60 * 1e3;
922
- var DEFAULT_THRESHOLDS = {
923
- api: {
924
- p50: 100,
925
- p95: 500,
926
- p99: 1e3
927
- },
928
- db: {
929
- p95: 100,
930
- p99: 500
931
- },
932
- webvitals: {
933
- FCP: 2e3,
934
- LCP: 2500,
935
- FID: 100,
936
- CLS: 0.1
937
- }
938
- };
939
- function cloneThresholds() {
940
- return Object.fromEntries(Object.entries(DEFAULT_THRESHOLDS).map(([category, metrics2]) => [
941
- category,
942
- { ...metrics2 }
943
- ]));
944
- }
945
- function labelsToKey2(labels) {
946
- if (!labels || Object.keys(labels).length === 0)
947
- return "";
948
- return Object.entries(labels).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}="${value}"`).join(",");
949
- }
950
- function percentile(sortedValues, percentileValue) {
951
- if (sortedValues.length === 0)
952
- return 0;
953
- const rank = Math.ceil(percentileValue / 100 * sortedValues.length);
954
- const index = Math.min(Math.max(rank - 1, 0), sortedValues.length - 1);
955
- return sortedValues[index];
956
- }
957
- var CircularBuffer = class {
958
- capacity;
959
- values = [];
960
- index = 0;
961
- size = 0;
962
- constructor(capacity) {
963
- this.capacity = capacity;
964
- }
965
- add(value) {
966
- if (this.size < this.capacity) {
967
- this.values.push(value);
968
- this.size += 1;
969
- this.index = this.size % this.capacity;
970
- return;
971
- }
972
- this.values[this.index] = value;
973
- this.index = (this.index + 1) % this.capacity;
974
- }
975
- getValues() {
976
- if (this.size < this.capacity) {
977
- return this.values.slice(0, this.size);
978
- }
979
- return this.values.slice();
980
- }
981
- };
982
- var PerformanceMonitor = class {
983
- samples = /* @__PURE__ */ new Map();
984
- thresholds = cloneThresholds();
985
- alertCallback;
986
- lastAlertTimestamps = /* @__PURE__ */ new Map();
987
- recordTiming(category, name, durationMs, labels) {
988
- if (!Number.isFinite(durationMs))
989
- return;
990
- const categoryMap = this.getCategoryMap(category);
991
- const nameMap = this.getNameMap(categoryMap, name);
992
- const labelKey = labelsToKey2(labels);
993
- const buffer = nameMap.get(labelKey) ?? new CircularBuffer(MAX_SAMPLES);
994
- buffer.add(durationMs);
995
- nameMap.set(labelKey, buffer);
996
- }
997
- getPercentiles(category, name) {
998
- const samples = this.collectSamples(category, name);
999
- if (samples.length === 0) {
1000
- return { p50: 0, p95: 0, p99: 0 };
1001
- }
1002
- const sorted = [...samples].sort((a, b) => a - b);
1003
- return {
1004
- p50: percentile(sorted, 50),
1005
- p95: percentile(sorted, 95),
1006
- p99: percentile(sorted, 99)
1007
- };
1008
- }
1009
- checkThresholds() {
1010
- const alerts = [];
1011
- const now = Date.now();
1012
- const callbackAlerts = [];
1013
- for (const [category, nameMap] of this.samples) {
1014
- const thresholds = this.thresholds[category];
1015
- if (!thresholds)
1016
- continue;
1017
- for (const name of nameMap.keys()) {
1018
- const percentiles = this.getPercentiles(category, name);
1019
- for (const [metric, threshold] of Object.entries(thresholds)) {
1020
- const value = this.resolveMetricValue(metric, name, percentiles);
1021
- if (value === void 0 || value <= threshold)
1022
- continue;
1023
- const alert = {
1024
- category,
1025
- name,
1026
- metric,
1027
- value,
1028
- threshold
1029
- };
1030
- alerts.push(alert);
1031
- const alertKey = `${category}|${name}|${metric}`;
1032
- const lastAlertTime = this.lastAlertTimestamps.get(alertKey);
1033
- if (!lastAlertTime || now - lastAlertTime >= ALERT_COOLDOWN_MS) {
1034
- this.lastAlertTimestamps.set(alertKey, now);
1035
- callbackAlerts.push(alert);
1036
- }
1037
- }
1038
- }
1039
- }
1040
- if (callbackAlerts.length > 0 && this.alertCallback) {
1041
- this.alertCallback(callbackAlerts);
1042
- }
1043
- return alerts;
1044
- }
1045
- setAlertCallback(callback) {
1046
- this.alertCallback = callback;
1047
- }
1048
- setThreshold(category, metric, value) {
1049
- if (!this.thresholds[category]) {
1050
- this.thresholds[category] = {};
1051
- }
1052
- this.thresholds[category][metric] = value;
1053
- }
1054
- collectSamples(category, name) {
1055
- const categoryMap = this.samples.get(category);
1056
- if (!categoryMap)
1057
- return [];
1058
- const entries = name ? [[name, categoryMap.get(name)]] : Array.from(categoryMap.entries());
1059
- const samples = [];
1060
- for (const [, labelMap] of entries) {
1061
- if (!labelMap)
1062
- continue;
1063
- for (const buffer of labelMap.values()) {
1064
- samples.push(...buffer.getValues());
1065
- }
1066
- }
1067
- return samples;
1068
- }
1069
- resolveMetricValue(metric, name, percentiles) {
1070
- if (metric === "p50")
1071
- return percentiles.p50;
1072
- if (metric === "p95")
1073
- return percentiles.p95;
1074
- if (metric === "p99")
1075
- return percentiles.p99;
1076
- if (metric === name)
1077
- return percentiles.p95;
1078
- return void 0;
1079
- }
1080
- getCategoryMap(category) {
1081
- const existing = this.samples.get(category);
1082
- if (existing)
1083
- return existing;
1084
- const created = /* @__PURE__ */ new Map();
1085
- this.samples.set(category, created);
1086
- return created;
1087
- }
1088
- getNameMap(categoryMap, name) {
1089
- const existing = categoryMap.get(name);
1090
- if (existing)
1091
- return existing;
1092
- const created = /* @__PURE__ */ new Map();
1093
- categoryMap.set(name, created);
1094
- return created;
1095
- }
1096
- };
1097
- var defaultMonitor = new PerformanceMonitor();
1098
- function recordTiming(category, name, durationMs, labels) {
1099
- defaultMonitor.recordTiming(category, name, durationMs, labels);
1100
- }
1101
- function getPercentiles(category, name) {
1102
- return defaultMonitor.getPercentiles(category, name);
1103
- }
1104
- function checkThresholds() {
1105
- return defaultMonitor.checkThresholds();
1106
- }
1107
- function setAlertCallback(callback) {
1108
- defaultMonitor.setAlertCallback(callback);
1109
- }
1110
- function setThreshold(category, metric, value) {
1111
- defaultMonitor.setThreshold(category, metric, value);
1112
- }
1113
-
1114
- // ../../packages/core/dist/logging/error-tracker.js
1115
- var NoOpErrorTracker = class {
1116
- captureError(error, context) {
1117
- console.error("Error captured:", error.message, context);
1118
- }
1119
- captureException(error, context) {
1120
- console.error("Exception captured:", error, context);
1121
- }
1122
- captureMessage(message, level, context) {
1123
- console[level === "warning" ? "warn" : level](`Message captured [${level}]:`, message, context);
1124
- }
1125
- setUser(user) {
1126
- console.log("User set:", user);
1127
- }
1128
- clearUser() {
1129
- console.log("User cleared");
1130
- }
1131
- };
1132
- var errorTrackerInstance = new NoOpErrorTracker();
1133
- function initializeErrorTracker(tracker) {
1134
- errorTrackerInstance = tracker;
1135
- }
1136
- function getErrorTracker() {
1137
- return errorTrackerInstance;
1138
- }
1139
- function captureError(error, context) {
1140
- errorTrackerInstance.captureError(error, context);
1141
- }
1142
- function captureException(error, context) {
1143
- errorTrackerInstance.captureException(error, context);
1144
- }
1145
- function captureMessage(message, level = "error", context) {
1146
- errorTrackerInstance.captureMessage(message, level, context);
1147
- }
1148
- function setErrorUser(user) {
1149
- errorTrackerInstance.setUser(user);
1150
- }
1151
- function clearErrorUser() {
1152
- errorTrackerInstance.clearUser();
1153
- }
1154
- function shouldIgnoreError(statusCode) {
1155
- if (!statusCode) {
1156
- return false;
1157
- }
1158
- const ignoredStatusCodes = [404, 401];
1159
- return ignoredStatusCodes.includes(statusCode);
1160
- }
1161
- function shouldIgnoreErrorByMessage(error) {
1162
- const ignoredMessages = [
1163
- "ResizeObserver loop",
1164
- "ResizeObserver loop limit exceeded",
1165
- "Non-Error promise rejection captured",
1166
- "NEXT_NOT_FOUND",
1167
- "NEXT_REDIRECT"
1168
- ];
1169
- return ignoredMessages.some((msg) => error.message.toLowerCase().includes(msg.toLowerCase()));
1170
- }
1171
-
1172
- // ../../packages/core/dist/utils/slug.js
1173
- function generateSlug(input) {
1174
- const normalized = input.toLowerCase();
1175
- const alphanumeric = normalized.replace(/[^a-z0-9\s-]/g, "");
1176
- const withHyphens = alphanumeric.replace(/\s+/g, "-");
1177
- const singleHyphens = withHyphens.replace(/-+/g, "-");
1178
- const trimmedHyphens = singleHyphens.replace(/^-+|-+$/g, "");
1179
- return trimmedHyphens.slice(0, 100);
1180
- }
1181
-
1182
- export {
1183
- __require,
1184
- __commonJS,
1185
- __export,
1186
- __reExport,
1187
- __toESM,
1188
- TaskState,
1189
- UserRole,
1190
- ProjectType,
1191
- ProjectOrigin,
1192
- TaskPriority,
1193
- DeploymentMode,
1194
- ErrorType,
1195
- PRStatus,
1196
- PricingTier,
1197
- ApiKeyPermission,
1198
- WebSocketEventType,
1199
- AuthProvider,
1200
- SubscriptionStatus,
1201
- EventType,
1202
- isValidStateTransition,
1203
- getValidNextStates,
1204
- validateStateTransition,
1205
- VERSION,
1206
- config,
1207
- getConfig,
1208
- isFeatureEnabled,
1209
- getPricingLimits,
1210
- DEFAULT_SEAT_LIMITS,
1211
- UserIdSchema,
1212
- UserSchema,
1213
- OrganizationUserSchema,
1214
- OrganizationIdSchema,
1215
- OrganizationSchema,
1216
- OrganizationSettingsSchema,
1217
- TagSchema,
1218
- ProjectIdSchema,
1219
- ProjectSchema,
1220
- EpicIdSchema,
1221
- EpicSchema,
1222
- TaskIdSchema,
1223
- generateTaskDisplayId,
1224
- TaskSchema,
1225
- AcceptanceCriterionSchema,
1226
- ProgressUpdateSchema,
1227
- TaskNoteSchema,
1228
- ApiKeyIdSchema,
1229
- ApiKeySchema,
1230
- SubscriptionIdSchema,
1231
- SubscriptionSchema,
1232
- ProjectCollaboratorSchema,
1233
- validateTierLimit,
1234
- calculateTierUsagePercentage,
1235
- shouldShowUpgradePrompt,
1236
- getUpgradeMessage,
1237
- z2 as z,
1238
- ListProjectsInputSchema,
1239
- ListTasksInputSchema,
1240
- GetTaskInputSchema,
1241
- AssignTaskInputSchema,
1242
- UpdateProgressInputSchema,
1243
- CompleteTaskInputSchema,
1244
- ReportErrorInputSchema,
1245
- GetProjectContextInputSchema,
1246
- AddNoteInputSchema,
1247
- AbandonTaskInputSchema,
1248
- CreatePersonalProjectInputSchema,
1249
- CheckActiveTaskInputSchema,
1250
- CreateOrganizationInputSchema,
1251
- UpdateOrganizationInputSchema,
1252
- CreateProjectInputSchema,
1253
- UpdateProjectInputSchema,
1254
- CreateEpicInputSchema,
1255
- CreateTaskInputSchema,
1256
- UpdateTaskInputSchema,
1257
- AssignTaskWebappInputSchema,
1258
- CreateTagInputSchema,
1259
- UpdateTagInputSchema,
1260
- UpdateOrganizationSettingsInputSchema,
1261
- InviteUserInputSchema,
1262
- AssignUserTagsInputSchema,
1263
- InviteCollaboratorInputSchema,
1264
- PublishProjectInputSchema,
1265
- GenerateApiKeyInputSchema,
1266
- RevokeApiKeyInputSchema,
1267
- LoginInputSchema,
1268
- RegisterInputSchema,
1269
- logger,
1270
- createRequestLogger,
1271
- createCounter,
1272
- createGauge,
1273
- createHistogram,
1274
- getMetricsAsPrometheus,
1275
- resetMetrics,
1276
- httpRequestsTotal,
1277
- httpRequestDuration,
1278
- activeUsers,
1279
- tasksTotal,
1280
- taskStateChanges,
1281
- httpErrorsTotal,
1282
- httpActiveConnections,
1283
- newSignupsTotal,
1284
- loginSuccessTotal,
1285
- loginFailureTotal,
1286
- dbConnectionPoolActive,
1287
- dbConnectionPoolIdle,
1288
- dbConnectionPoolMax,
1289
- dbQueryDuration,
1290
- dbSlowQueriesTotal,
1291
- dbErrorsTotal,
1292
- tasksCreatedTotal,
1293
- tasksAssignedTotal,
1294
- tasksCompletedTotal,
1295
- tasksByState,
1296
- PerformanceMonitor,
1297
- recordTiming,
1298
- getPercentiles,
1299
- checkThresholds,
1300
- setAlertCallback,
1301
- setThreshold,
1302
- NoOpErrorTracker,
1303
- initializeErrorTracker,
1304
- getErrorTracker,
1305
- captureError,
1306
- captureException,
1307
- captureMessage,
1308
- setErrorUser,
1309
- clearErrorUser,
1310
- shouldIgnoreError,
1311
- shouldIgnoreErrorByMessage,
1312
- generateSlug
1313
- };
1314
- //# sourceMappingURL=chunk-ASNGTDTC.js.map