lancer-shared 1.2.77 → 1.2.79
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/bundle.cjs.js +470 -465
- package/dist/constants/routes.d.ts +5 -0
- package/dist/schemas/agent/index.d.ts +10 -0
- package/dist/schemas/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -6496,6 +6496,11 @@ const ROUTES = {
|
|
|
6496
6496
|
BASE: "admin/alerts",
|
|
6497
6497
|
SEND_ALERT: "admin/alerts/send",
|
|
6498
6498
|
},
|
|
6499
|
+
AGENT: {
|
|
6500
|
+
BASE: "admin/agent",
|
|
6501
|
+
TEST_SUITABILITY: "admin/agent/test-suitability",
|
|
6502
|
+
TEST_PROPOSAL: "admin/agent/test-proposal",
|
|
6503
|
+
},
|
|
6499
6504
|
},
|
|
6500
6505
|
BID: {
|
|
6501
6506
|
BASE: "bid",
|
|
@@ -12097,450 +12102,61 @@ const generateLeadCountsRequestSchema = z.object({
|
|
|
12097
12102
|
campaignId: z.string().optional(),
|
|
12098
12103
|
});
|
|
12099
12104
|
|
|
12100
|
-
const
|
|
12105
|
+
const bidPayloadProposalDataSchema = z.object({
|
|
12101
12106
|
coverLetter: z.string(),
|
|
12102
|
-
questionAnswerPairs: questionAnswerPairSchema.array(),
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
const LogEventTypeEnum = z.enum([
|
|
12106
|
-
// Scraper Events
|
|
12107
|
-
"scraperStarted",
|
|
12108
|
-
"scraperCompleted",
|
|
12109
|
-
"jobScraped",
|
|
12110
|
-
"jobScrapeFailed",
|
|
12111
|
-
"jobsIndexed",
|
|
12112
|
-
"jobDuplicateSkipped",
|
|
12113
|
-
"scraperFailed",
|
|
12114
|
-
"jobActivityScraped",
|
|
12115
|
-
"jobActivityScrapeFailed",
|
|
12116
|
-
"leadStatusCheckFailed",
|
|
12117
|
-
"leadStatusUpdated",
|
|
12118
|
-
// Feed Scraper Events
|
|
12119
|
-
"feedScrapeStarted",
|
|
12120
|
-
"feedScrapeCompleted",
|
|
12121
|
-
"feedScrapeFailed",
|
|
12122
|
-
"jobListingScraped",
|
|
12123
|
-
// Job Sync & Campaign Matching
|
|
12124
|
-
"jobSyncPublished",
|
|
12125
|
-
"jobSyncReceived",
|
|
12126
|
-
"leadsCreatedAndSynced",
|
|
12127
|
-
// Suitability Events
|
|
12128
|
-
"suitabilityPending",
|
|
12129
|
-
"suitabilityProcessing",
|
|
12130
|
-
"suitabilityComplete",
|
|
12131
|
-
"suitabilityFailed",
|
|
12132
|
-
"manualSuitabilityAnalyzed",
|
|
12133
|
-
// Proposal Events
|
|
12134
|
-
"proposalProcessing",
|
|
12135
|
-
"proposalComplete",
|
|
12136
|
-
"proposalFailed",
|
|
12137
|
-
"manualProposalGenerated",
|
|
12138
|
-
// Bidding Events
|
|
12139
|
-
"biddingProcessing",
|
|
12140
|
-
"biddingComplete",
|
|
12141
|
-
"biddingFailed",
|
|
12142
|
-
"biddingSkipped",
|
|
12143
|
-
"biddingPending",
|
|
12144
|
-
"biddingRetry",
|
|
12145
|
-
"biddingInsufficientConnects",
|
|
12146
|
-
"biddingWarningAlert",
|
|
12147
|
-
// System/Generic Events
|
|
12148
|
-
"errorLogged",
|
|
12149
|
-
"cloudTaskRetry",
|
|
12150
|
-
"manualLeadEdited",
|
|
12151
|
-
"leadArchived",
|
|
12152
|
-
"auditTrailLogged",
|
|
12153
|
-
]);
|
|
12154
|
-
const logEventSchema = z.object({
|
|
12155
|
-
// The type of event (use a z.enum if possible)
|
|
12156
|
-
type: LogEventTypeEnum, // e.g. "suitability-failed", "proposal-generated"
|
|
12157
|
-
// The service that triggered the event
|
|
12158
|
-
source: z.string(), // e.g. "lancer-agents", "lancer-bidding"
|
|
12159
|
-
// Optional: Allow logging non-lead events in the future
|
|
12160
|
-
resourceType: z.string().default("lead"), // e.g. "lead", "campaign", "user"
|
|
12161
|
-
// ID of the resource (primary entity affected)
|
|
12162
|
-
resourceId: z.string().nullable(), // fallback if leadId is not applicable
|
|
12163
|
-
// Lead-level metadata
|
|
12164
|
-
organizationId: z.string().nullable(),
|
|
12165
|
-
userId: z.string().nullable(),
|
|
12166
|
-
campaignId: z.string().nullable(),
|
|
12167
|
-
leadId: z.string().nullable(),
|
|
12168
|
-
// Reason or message for the event
|
|
12169
|
-
reason: z.string().nullable(),
|
|
12170
|
-
// Generic metadata (stacktrace, score, raw request, etc.)
|
|
12171
|
-
metadata: z.record(z.unknown()).nullable(),
|
|
12172
|
-
// Optional timestamp override
|
|
12173
|
-
timestamp: z.number(),
|
|
12174
|
-
});
|
|
12175
|
-
const listingScrapedEventMetadata = objectType({
|
|
12176
|
-
listing: jobListingSchema,
|
|
12177
|
-
region: regionSchema,
|
|
12178
|
-
});
|
|
12179
|
-
const jobActivityScrapedEventMetadata = objectType({
|
|
12180
|
-
activity: jobActivitySchema,
|
|
12181
|
-
region: regionSchema,
|
|
12182
|
-
offsetHour: jobActivityOffsetHourSchema,
|
|
12183
|
-
scrapedAt: numberType(),
|
|
12107
|
+
questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
|
|
12108
|
+
boostingEnabled: z.boolean(),
|
|
12109
|
+
maximumBoost: z.number().nullable(),
|
|
12184
12110
|
});
|
|
12185
|
-
const
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12111
|
+
const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
|
|
12112
|
+
const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
|
|
12113
|
+
agencyName: z.string(),
|
|
12114
|
+
contractorName: z.string(),
|
|
12115
|
+
specializedProfile: z.string().nullable(),
|
|
12189
12116
|
});
|
|
12190
|
-
const
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12117
|
+
const bidPayloadSchema = z.object({
|
|
12118
|
+
jobUrl: z.string(),
|
|
12119
|
+
username: z.string(),
|
|
12120
|
+
password: z.string(),
|
|
12194
12121
|
});
|
|
12195
|
-
const
|
|
12196
|
-
|
|
12197
|
-
endTime: numberType(),
|
|
12198
|
-
region: regionSchema,
|
|
12199
|
-
accountUsername: stringType(),
|
|
12200
|
-
listings: arrayType(jobListingSchema),
|
|
12122
|
+
const agencyBidPayloadSchema = bidPayloadSchema.extend({
|
|
12123
|
+
proposalData: agencyBidProposalDataSchema,
|
|
12201
12124
|
});
|
|
12202
|
-
const
|
|
12203
|
-
|
|
12204
|
-
boosted: booleanType(),
|
|
12205
|
-
boostingAmount: numberType(),
|
|
12125
|
+
const freelancerBidPayloadSchema = bidPayloadSchema.extend({
|
|
12126
|
+
proposalData: freelancerBidProposalDataSchema,
|
|
12206
12127
|
});
|
|
12207
|
-
const
|
|
12208
|
-
|
|
12128
|
+
const bidDtoSchema = z.object({
|
|
12129
|
+
organizationId: z.string(),
|
|
12130
|
+
campaignId: z.string(),
|
|
12131
|
+
leadId: z.string(),
|
|
12209
12132
|
});
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12133
|
+
|
|
12134
|
+
const bidSuccessSchema = z.object({
|
|
12135
|
+
status: z.literal("success"),
|
|
12136
|
+
biddingAmount: z.number(),
|
|
12137
|
+
boosted: z.boolean(),
|
|
12138
|
+
boostingAmount: z.number(),
|
|
12213
12139
|
});
|
|
12214
|
-
const
|
|
12215
|
-
|
|
12140
|
+
const bidFailedSchema = z.object({
|
|
12141
|
+
status: z.literal("failed"),
|
|
12216
12142
|
errorMessage: z.string(),
|
|
12217
|
-
context: z.string().optional(),
|
|
12218
|
-
});
|
|
12219
|
-
const leadStatusEventMetadata = objectType({
|
|
12220
|
-
campaignId: stringType(),
|
|
12221
|
-
organizationId: stringType(),
|
|
12222
|
-
leadId: stringType(),
|
|
12223
|
-
userId: stringType(),
|
|
12224
|
-
metadata: z
|
|
12225
|
-
.object({
|
|
12226
|
-
status: leadStatusSchema,
|
|
12227
|
-
proposalId: stringType().nullable(),
|
|
12228
|
-
})
|
|
12229
|
-
.optional(),
|
|
12230
|
-
reason: z.string().optional(),
|
|
12231
|
-
});
|
|
12232
|
-
const suitabilityCompleteEventMetadataSchema = objectType({
|
|
12233
|
-
suitabilityRating: z.number(),
|
|
12234
|
-
suitabilityReason: z.string(),
|
|
12235
|
-
agentStatus: z.string(),
|
|
12236
|
-
model: z.string(),
|
|
12237
|
-
provider: z.string(),
|
|
12238
|
-
promptTokens: z.number(),
|
|
12239
|
-
completionTokens: z.number(),
|
|
12240
|
-
messages: z.array(objectType({
|
|
12241
|
-
role: z.string(),
|
|
12242
|
-
content: z.string(),
|
|
12243
|
-
})),
|
|
12244
|
-
});
|
|
12245
|
-
const suitabilityFailedEventMetadataSchema = objectType({
|
|
12246
|
-
agentStatus: z.string(),
|
|
12247
|
-
reason: z.string(),
|
|
12248
|
-
});
|
|
12249
|
-
const proposalCompleteEventMetadataSchema = objectType({
|
|
12250
|
-
agentStatus: z.string(),
|
|
12251
|
-
proposal: proposalSchema,
|
|
12252
|
-
model: z.string(),
|
|
12253
|
-
provider: z.string(),
|
|
12254
|
-
promptTokens: z.number(),
|
|
12255
|
-
completionTokens: z.number(),
|
|
12256
|
-
messages: z.array(objectType({
|
|
12257
|
-
role: z.string(),
|
|
12258
|
-
content: z.string(),
|
|
12259
|
-
})),
|
|
12260
12143
|
});
|
|
12261
|
-
const eventLoggerPayloadSchema = unionType([
|
|
12262
|
-
logEventSchema,
|
|
12263
|
-
arrayType(logEventSchema),
|
|
12264
|
-
]);
|
|
12265
12144
|
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
userId: stringType().nullable(),
|
|
12274
|
-
stripeSubscriptionId: stringType().nullable(),
|
|
12275
|
-
planId: stringType().nullable(),
|
|
12276
|
-
});
|
|
12277
|
-
const usageEventSchema = objectType({
|
|
12278
|
-
organizationId: stringType(),
|
|
12279
|
-
typeId: usageEventTypeEnum,
|
|
12280
|
-
timestamp: numberType(),
|
|
12281
|
-
metadata: usageEventMetadataSchema,
|
|
12282
|
-
});
|
|
12145
|
+
class CloudflareChallengeFailedException extends Error {
|
|
12146
|
+
code = 'CLOUDFLARE_CHALLENGE_FAILED_EXCEPTION';
|
|
12147
|
+
constructor(url, errorMessage) {
|
|
12148
|
+
super(`Cloudflare challenge failed for ${url}\n\n ${errorMessage}`);
|
|
12149
|
+
}
|
|
12150
|
+
}
|
|
12151
|
+
const cloudflareProtectionFailure = (url, errorMessage) => new CloudflareChallengeFailedException(url, errorMessage);
|
|
12283
12152
|
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
const subscriptionStatusEnum = z.enum([
|
|
12293
|
-
"active",
|
|
12294
|
-
"trialing",
|
|
12295
|
-
"cancelled",
|
|
12296
|
-
"paused",
|
|
12297
|
-
"payment_processing",
|
|
12298
|
-
"payment_pending",
|
|
12299
|
-
"payment_failed",
|
|
12300
|
-
]);
|
|
12301
|
-
const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
|
|
12302
|
-
const subscriptionStripeMetadataItemSchema = objectType({
|
|
12303
|
-
id: stringType(),
|
|
12304
|
-
price: objectType({
|
|
12305
|
-
id: stringType(),
|
|
12306
|
-
}),
|
|
12307
|
-
});
|
|
12308
|
-
const subscriptionStripeMetadataSchema = objectType({
|
|
12309
|
-
id: stringType(),
|
|
12310
|
-
items: arrayType(subscriptionStripeMetadataItemSchema),
|
|
12311
|
-
invoice: objectType({
|
|
12312
|
-
id: stringType(),
|
|
12313
|
-
hosted_invoice_url: stringType().nullable(),
|
|
12314
|
-
}),
|
|
12315
|
-
});
|
|
12316
|
-
const subscriptionSchema = objectType({
|
|
12317
|
-
planId: stringType(),
|
|
12318
|
-
pendingPlanId: stringType().nullable(),
|
|
12319
|
-
status: subscriptionStatusEnum,
|
|
12320
|
-
startedAt: numberType(),
|
|
12321
|
-
currentPeriodEnd: numberType(),
|
|
12322
|
-
stripe: subscriptionStripeMetadataSchema,
|
|
12323
|
-
source: subscriptionSourceEnum,
|
|
12324
|
-
usage: recordType(usageEventTypeEnum, numberType()),
|
|
12325
|
-
});
|
|
12326
|
-
|
|
12327
|
-
const coverLetterTemplateSchema = z.object({
|
|
12328
|
-
id: z.string(),
|
|
12329
|
-
name: z.string(),
|
|
12330
|
-
description: z.string().nullable(),
|
|
12331
|
-
template: z.string(),
|
|
12332
|
-
instructions: z.string(),
|
|
12333
|
-
});
|
|
12334
|
-
const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
|
|
12335
|
-
name: true,
|
|
12336
|
-
template: true,
|
|
12337
|
-
instructions: true,
|
|
12338
|
-
});
|
|
12339
|
-
|
|
12340
|
-
const organizationMemberRoleEnum = z.enum(["admin", "member"]);
|
|
12341
|
-
const organizationMemberSchema = objectType({
|
|
12342
|
-
role: organizationMemberRoleEnum,
|
|
12343
|
-
joinedAt: numberType(),
|
|
12344
|
-
invitedBy: stringType(),
|
|
12345
|
-
});
|
|
12346
|
-
|
|
12347
|
-
const onboardingProgressSchema = z.object({
|
|
12348
|
-
profileSetup: z.boolean(),
|
|
12349
|
-
campaignCreated: z.boolean(),
|
|
12350
|
-
filtersAdded: z.boolean(),
|
|
12351
|
-
automationEnabled: z.boolean(),
|
|
12352
|
-
startCampaign: z.boolean(),
|
|
12353
|
-
});
|
|
12354
|
-
|
|
12355
|
-
const organizationTypeSchema = z.enum(["agency", "freelancer"]);
|
|
12356
|
-
const organizationTierEnum = z.enum(["free", "premium"]);
|
|
12357
|
-
const limitsSchema = objectType({
|
|
12358
|
-
monthlyCredits: numberType(),
|
|
12359
|
-
usedCredits: numberType(),
|
|
12360
|
-
extraCredits: numberType(),
|
|
12361
|
-
});
|
|
12362
|
-
const organizationSchema = objectType({
|
|
12363
|
-
id: stringType(),
|
|
12364
|
-
name: stringType(),
|
|
12365
|
-
type: organizationTypeSchema,
|
|
12366
|
-
associatedBidders: z.array(stringType()).nullable(),
|
|
12367
|
-
subscription: subscriptionSchema.nullable(),
|
|
12368
|
-
active: booleanType(),
|
|
12369
|
-
limits: limitsSchema,
|
|
12370
|
-
billing: billingSchema.nullable(),
|
|
12371
|
-
lastBidTime: numberType().nullable(),
|
|
12372
|
-
createdAt: numberType(),
|
|
12373
|
-
updatedAt: numberType(),
|
|
12374
|
-
openRouterApiKey: stringType().nullable(),
|
|
12375
|
-
});
|
|
12376
|
-
const caseStudySchema = objectType({
|
|
12377
|
-
title: stringType(),
|
|
12378
|
-
description: stringType(),
|
|
12379
|
-
});
|
|
12380
|
-
z.object({
|
|
12381
|
-
type: z.enum(["freelancer", "agency"]),
|
|
12382
|
-
name: z.string(),
|
|
12383
|
-
summary: z.string(),
|
|
12384
|
-
coreServices: z.string(),
|
|
12385
|
-
toolsSkillsTechnologies: z.string(),
|
|
12386
|
-
approach: z.string(),
|
|
12387
|
-
icp: z.string(),
|
|
12388
|
-
projectsTheyAvoid: z.string(),
|
|
12389
|
-
spokenLanguages: z.string(),
|
|
12390
|
-
agencyInfo: z.object({
|
|
12391
|
-
location: z.array(z.string()),
|
|
12392
|
-
website: z.string().url(),
|
|
12393
|
-
teamSize: z.number(),
|
|
12394
|
-
}),
|
|
12395
|
-
caseStudies: z.array(caseStudySchema),
|
|
12396
|
-
});
|
|
12397
|
-
const createOrganizationSchema = organizationSchema.pick({
|
|
12398
|
-
name: true,
|
|
12399
|
-
type: true,
|
|
12400
|
-
});
|
|
12401
|
-
const trackUsageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12402
|
-
"suitabilityComplete",
|
|
12403
|
-
"proposalComplete",
|
|
12404
|
-
"biddingComplete",
|
|
12405
|
-
]);
|
|
12406
|
-
const trackUsagePayloadSchema = objectType({
|
|
12407
|
-
event: usageEventTypeEnum,
|
|
12408
|
-
campaignId: stringType().nullish(),
|
|
12409
|
-
});
|
|
12410
|
-
const questionRulesSchema = objectType({
|
|
12411
|
-
question: stringType(),
|
|
12412
|
-
answer: stringType(),
|
|
12413
|
-
category: stringType(),
|
|
12414
|
-
});
|
|
12415
|
-
const aiConfigSchema = objectType({
|
|
12416
|
-
// suitabilityRules: string().nullable(),
|
|
12417
|
-
// coverLetterRules: string().nullable(),
|
|
12418
|
-
// coverLetterTemplate: string().nullable(),
|
|
12419
|
-
questionRules: arrayType(questionRulesSchema).nullable(),
|
|
12420
|
-
// approvedSuitabilityJobs: number().nullable(),
|
|
12421
|
-
// approvedProposalJobs: number().nullable(),
|
|
12422
|
-
});
|
|
12423
|
-
const notificationConfigSchema = objectType({
|
|
12424
|
-
emailEnabled: booleanType(),
|
|
12425
|
-
discordWebhookUrl: stringType().nullable(),
|
|
12426
|
-
slackWebhookUrl: stringType().nullable(),
|
|
12427
|
-
});
|
|
12428
|
-
const organizationSettingsSchema = objectType({
|
|
12429
|
-
aiConfig: aiConfigSchema,
|
|
12430
|
-
});
|
|
12431
|
-
const subscribePayloadSchema = objectType({
|
|
12432
|
-
planId: stringType().min(1, "Plan id is required."),
|
|
12433
|
-
paymentMethodId: stringType().min(1, "Payment method is required."),
|
|
12434
|
-
toltReferral: stringType().optional(),
|
|
12435
|
-
couponCode: stringType().nullish(),
|
|
12436
|
-
});
|
|
12437
|
-
|
|
12438
|
-
const systemPromptSchema = objectType({
|
|
12439
|
-
suitability: stringType(),
|
|
12440
|
-
proposal: stringType(),
|
|
12441
|
-
questionHandlingGuidelines: stringType(),
|
|
12442
|
-
});
|
|
12443
|
-
const systemSchema = objectType({
|
|
12444
|
-
prompts: systemPromptSchema,
|
|
12445
|
-
});
|
|
12446
|
-
|
|
12447
|
-
const agentTaskRequestSchema = z.object({
|
|
12448
|
-
userId: z.string().nullable(),
|
|
12449
|
-
organizationId: z.string(),
|
|
12450
|
-
campaignId: z.string(),
|
|
12451
|
-
lead: leadSchema,
|
|
12452
|
-
});
|
|
12453
|
-
const testSystemPromptsRequestSchema = z.object({
|
|
12454
|
-
organizationId: z.string(),
|
|
12455
|
-
modelSuitability: z.string(),
|
|
12456
|
-
modelProposal: z.string(),
|
|
12457
|
-
systemPrompt: systemPromptSchema,
|
|
12458
|
-
aiConfig: aiConfigSchema,
|
|
12459
|
-
lead: leadSchema,
|
|
12460
|
-
});
|
|
12461
|
-
const suitabilityRatingSchema = z.object({
|
|
12462
|
-
rating: z.number(),
|
|
12463
|
-
reason: z.string(),
|
|
12464
|
-
});
|
|
12465
|
-
const agentTaskResponseSchema = z.object({
|
|
12466
|
-
result: z.union([suitabilityRatingSchema, proposalSchema]),
|
|
12467
|
-
model: z.string(),
|
|
12468
|
-
provider: z.string(),
|
|
12469
|
-
promptTokens: z.number(),
|
|
12470
|
-
completionTokens: z.number(),
|
|
12471
|
-
});
|
|
12472
|
-
const testSystemPromptsResponseSchema = z.object({
|
|
12473
|
-
proposal: z.object({
|
|
12474
|
-
result: proposalSchema,
|
|
12475
|
-
model: z.string(),
|
|
12476
|
-
provider: z.string(),
|
|
12477
|
-
promptTokens: z.number(),
|
|
12478
|
-
completionTokens: z.number(),
|
|
12479
|
-
}),
|
|
12480
|
-
suitability: z.object({
|
|
12481
|
-
result: suitabilityRatingSchema,
|
|
12482
|
-
model: z.string(),
|
|
12483
|
-
provider: z.string(),
|
|
12484
|
-
promptTokens: z.number(),
|
|
12485
|
-
completionTokens: z.number(),
|
|
12486
|
-
}),
|
|
12487
|
-
});
|
|
12488
|
-
|
|
12489
|
-
const bidPayloadProposalDataSchema = z.object({
|
|
12490
|
-
coverLetter: z.string(),
|
|
12491
|
-
questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
|
|
12492
|
-
boostingEnabled: z.boolean(),
|
|
12493
|
-
maximumBoost: z.number().nullable(),
|
|
12494
|
-
});
|
|
12495
|
-
const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
|
|
12496
|
-
const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
|
|
12497
|
-
agencyName: z.string(),
|
|
12498
|
-
contractorName: z.string(),
|
|
12499
|
-
specializedProfile: z.string().nullable(),
|
|
12500
|
-
});
|
|
12501
|
-
const bidPayloadSchema = z.object({
|
|
12502
|
-
jobUrl: z.string(),
|
|
12503
|
-
username: z.string(),
|
|
12504
|
-
password: z.string(),
|
|
12505
|
-
});
|
|
12506
|
-
const agencyBidPayloadSchema = bidPayloadSchema.extend({
|
|
12507
|
-
proposalData: agencyBidProposalDataSchema,
|
|
12508
|
-
});
|
|
12509
|
-
const freelancerBidPayloadSchema = bidPayloadSchema.extend({
|
|
12510
|
-
proposalData: freelancerBidProposalDataSchema,
|
|
12511
|
-
});
|
|
12512
|
-
const bidDtoSchema = z.object({
|
|
12513
|
-
organizationId: z.string(),
|
|
12514
|
-
campaignId: z.string(),
|
|
12515
|
-
leadId: z.string(),
|
|
12516
|
-
});
|
|
12517
|
-
|
|
12518
|
-
const bidSuccessSchema = z.object({
|
|
12519
|
-
status: z.literal("success"),
|
|
12520
|
-
biddingAmount: z.number(),
|
|
12521
|
-
boosted: z.boolean(),
|
|
12522
|
-
boostingAmount: z.number(),
|
|
12523
|
-
});
|
|
12524
|
-
const bidFailedSchema = z.object({
|
|
12525
|
-
status: z.literal("failed"),
|
|
12526
|
-
errorMessage: z.string(),
|
|
12527
|
-
});
|
|
12528
|
-
|
|
12529
|
-
class CloudflareChallengeFailedException extends Error {
|
|
12530
|
-
code = 'CLOUDFLARE_CHALLENGE_FAILED_EXCEPTION';
|
|
12531
|
-
constructor(url, errorMessage) {
|
|
12532
|
-
super(`Cloudflare challenge failed for ${url}\n\n ${errorMessage}`);
|
|
12533
|
-
}
|
|
12534
|
-
}
|
|
12535
|
-
const cloudflareProtectionFailure = (url, errorMessage) => new CloudflareChallengeFailedException(url, errorMessage);
|
|
12536
|
-
|
|
12537
|
-
class DeleteMultiloginProfileException extends Error {
|
|
12538
|
-
code = 'DELETE_MULTILOGIN_PROFILE_EXCEPTION';
|
|
12539
|
-
constructor(message) {
|
|
12540
|
-
super(message);
|
|
12541
|
-
}
|
|
12542
|
-
}
|
|
12543
|
-
const deleteMultiloginProfileException = (message) => new DeleteMultiloginProfileException(message);
|
|
12153
|
+
class DeleteMultiloginProfileException extends Error {
|
|
12154
|
+
code = 'DELETE_MULTILOGIN_PROFILE_EXCEPTION';
|
|
12155
|
+
constructor(message) {
|
|
12156
|
+
super(message);
|
|
12157
|
+
}
|
|
12158
|
+
}
|
|
12159
|
+
const deleteMultiloginProfileException = (message) => new DeleteMultiloginProfileException(message);
|
|
12544
12160
|
|
|
12545
12161
|
class DropdownOptionNotPresentException extends Error {
|
|
12546
12162
|
code = 'DROPDOWN_OPTION_NOT_PRESENT_EXCEPTION';
|
|
@@ -12895,40 +12511,378 @@ const campaignAIMetricsSchema = z.object({
|
|
|
12895
12511
|
connectsSaved: z.number(),
|
|
12896
12512
|
});
|
|
12897
12513
|
|
|
12898
|
-
const
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
replied: z.number().optional(),
|
|
12902
|
-
won: z.number().optional(),
|
|
12903
|
-
proposalsGenerated: z.number().optional(),
|
|
12904
|
-
leadsAnalyzed: z.number().optional(),
|
|
12905
|
-
leadsFailed: z.number().optional(),
|
|
12906
|
-
suitableJobs: z.number().optional(),
|
|
12907
|
-
unsuitableJobs: z.number().optional(),
|
|
12908
|
-
wonAmount: z.number().optional(),
|
|
12909
|
-
});
|
|
12910
|
-
const campaignAnalyticsStatsSchema = z.object({
|
|
12911
|
-
totalStats: campaignAnalyticsSchema,
|
|
12912
|
-
statsByDate: z.array(z.object({
|
|
12913
|
-
label: z.string(),
|
|
12914
|
-
contacted: z.number(),
|
|
12915
|
-
viewed: z.number(),
|
|
12916
|
-
replied: z.number(),
|
|
12917
|
-
won: z.number(),
|
|
12918
|
-
leadsAnalyzed: z.number(),
|
|
12919
|
-
})),
|
|
12920
|
-
});
|
|
12921
|
-
const campaignAnalyticsResponseSchema = z.object({
|
|
12922
|
-
jobsAnalyzed: z.number(),
|
|
12923
|
-
contacted: z.number(),
|
|
12924
|
-
viewed: z.number(),
|
|
12925
|
-
replied: z.number(),
|
|
12926
|
-
won: z.number(),
|
|
12514
|
+
const proposalSchema = z.object({
|
|
12515
|
+
coverLetter: z.string(),
|
|
12516
|
+
questionAnswerPairs: questionAnswerPairSchema.array(),
|
|
12927
12517
|
});
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
"
|
|
12518
|
+
|
|
12519
|
+
const LogEventTypeEnum = z.enum([
|
|
12520
|
+
// Scraper Events
|
|
12521
|
+
"scraperStarted",
|
|
12522
|
+
"scraperCompleted",
|
|
12523
|
+
"jobScraped",
|
|
12524
|
+
"jobScrapeFailed",
|
|
12525
|
+
"jobsIndexed",
|
|
12526
|
+
"jobDuplicateSkipped",
|
|
12527
|
+
"scraperFailed",
|
|
12528
|
+
"jobActivityScraped",
|
|
12529
|
+
"jobActivityScrapeFailed",
|
|
12530
|
+
"leadStatusCheckFailed",
|
|
12531
|
+
"leadStatusUpdated",
|
|
12532
|
+
// Feed Scraper Events
|
|
12533
|
+
"feedScrapeStarted",
|
|
12534
|
+
"feedScrapeCompleted",
|
|
12535
|
+
"feedScrapeFailed",
|
|
12536
|
+
"jobListingScraped",
|
|
12537
|
+
// Job Sync & Campaign Matching
|
|
12538
|
+
"jobSyncPublished",
|
|
12539
|
+
"jobSyncReceived",
|
|
12540
|
+
"leadsCreatedAndSynced",
|
|
12541
|
+
// Suitability Events
|
|
12542
|
+
"suitabilityPending",
|
|
12543
|
+
"suitabilityProcessing",
|
|
12544
|
+
"suitabilityComplete",
|
|
12545
|
+
"suitabilityFailed",
|
|
12546
|
+
"manualSuitabilityAnalyzed",
|
|
12547
|
+
// Proposal Events
|
|
12548
|
+
"proposalProcessing",
|
|
12549
|
+
"proposalComplete",
|
|
12550
|
+
"proposalFailed",
|
|
12551
|
+
"manualProposalGenerated",
|
|
12552
|
+
// Bidding Events
|
|
12553
|
+
"biddingProcessing",
|
|
12554
|
+
"biddingComplete",
|
|
12555
|
+
"biddingFailed",
|
|
12556
|
+
"biddingSkipped",
|
|
12557
|
+
"biddingPending",
|
|
12558
|
+
"biddingRetry",
|
|
12559
|
+
"biddingInsufficientConnects",
|
|
12560
|
+
"biddingWarningAlert",
|
|
12561
|
+
// System/Generic Events
|
|
12562
|
+
"errorLogged",
|
|
12563
|
+
"cloudTaskRetry",
|
|
12564
|
+
"manualLeadEdited",
|
|
12565
|
+
"leadArchived",
|
|
12566
|
+
"auditTrailLogged",
|
|
12567
|
+
]);
|
|
12568
|
+
const logEventSchema = z.object({
|
|
12569
|
+
// The type of event (use a z.enum if possible)
|
|
12570
|
+
type: LogEventTypeEnum, // e.g. "suitability-failed", "proposal-generated"
|
|
12571
|
+
// The service that triggered the event
|
|
12572
|
+
source: z.string(), // e.g. "lancer-agents", "lancer-bidding"
|
|
12573
|
+
// Optional: Allow logging non-lead events in the future
|
|
12574
|
+
resourceType: z.string().default("lead"), // e.g. "lead", "campaign", "user"
|
|
12575
|
+
// ID of the resource (primary entity affected)
|
|
12576
|
+
resourceId: z.string().nullable(), // fallback if leadId is not applicable
|
|
12577
|
+
// Lead-level metadata
|
|
12578
|
+
organizationId: z.string().nullable(),
|
|
12579
|
+
userId: z.string().nullable(),
|
|
12580
|
+
campaignId: z.string().nullable(),
|
|
12581
|
+
leadId: z.string().nullable(),
|
|
12582
|
+
// Reason or message for the event
|
|
12583
|
+
reason: z.string().nullable(),
|
|
12584
|
+
// Generic metadata (stacktrace, score, raw request, etc.)
|
|
12585
|
+
metadata: z.record(z.unknown()).nullable(),
|
|
12586
|
+
// Optional timestamp override
|
|
12587
|
+
timestamp: z.number(),
|
|
12588
|
+
});
|
|
12589
|
+
const listingScrapedEventMetadata = objectType({
|
|
12590
|
+
listing: jobListingSchema,
|
|
12591
|
+
region: regionSchema,
|
|
12592
|
+
});
|
|
12593
|
+
const jobActivityScrapedEventMetadata = objectType({
|
|
12594
|
+
activity: jobActivitySchema,
|
|
12595
|
+
region: regionSchema,
|
|
12596
|
+
offsetHour: jobActivityOffsetHourSchema,
|
|
12597
|
+
scrapedAt: numberType(),
|
|
12598
|
+
});
|
|
12599
|
+
const jobActivityScrapeFailedEventMetadata = objectType({
|
|
12600
|
+
listing: jobListingSchema,
|
|
12601
|
+
region: regionSchema,
|
|
12602
|
+
offsetHour: jobActivityOffsetHourSchema,
|
|
12603
|
+
});
|
|
12604
|
+
const feedScrapeStartedEventMetadata = objectType({
|
|
12605
|
+
id: stringType(),
|
|
12606
|
+
startTime: numberType(),
|
|
12607
|
+
region: regionSchema,
|
|
12608
|
+
});
|
|
12609
|
+
const feedScrapeCompletedEventMetadata = objectType({
|
|
12610
|
+
id: stringType(),
|
|
12611
|
+
endTime: numberType(),
|
|
12612
|
+
region: regionSchema,
|
|
12613
|
+
accountUsername: stringType(),
|
|
12614
|
+
listings: arrayType(jobListingSchema),
|
|
12615
|
+
});
|
|
12616
|
+
const biddingCompletedEventMetadata = objectType({
|
|
12617
|
+
biddingAmount: numberType(),
|
|
12618
|
+
boosted: booleanType(),
|
|
12619
|
+
boostingAmount: numberType(),
|
|
12620
|
+
});
|
|
12621
|
+
const biddingFailedEventMetadata = objectType({
|
|
12622
|
+
error: z.any(),
|
|
12623
|
+
});
|
|
12624
|
+
const userAccountBiddingExceptionEventMetadata = objectType({
|
|
12625
|
+
errorType: z.enum(["insufficientConnects", "proposalFormWarningAlert"]),
|
|
12626
|
+
context: z.string().optional(),
|
|
12627
|
+
});
|
|
12628
|
+
const lancerBiddingExceptionEventMetadata = objectType({
|
|
12629
|
+
errorType: z.string(),
|
|
12630
|
+
errorMessage: z.string(),
|
|
12631
|
+
context: z.string().optional(),
|
|
12632
|
+
});
|
|
12633
|
+
const leadStatusEventMetadata = objectType({
|
|
12634
|
+
campaignId: stringType(),
|
|
12635
|
+
organizationId: stringType(),
|
|
12636
|
+
leadId: stringType(),
|
|
12637
|
+
userId: stringType(),
|
|
12638
|
+
metadata: z
|
|
12639
|
+
.object({
|
|
12640
|
+
status: leadStatusSchema,
|
|
12641
|
+
proposalId: stringType().nullable(),
|
|
12642
|
+
})
|
|
12643
|
+
.optional(),
|
|
12644
|
+
reason: z.string().optional(),
|
|
12645
|
+
});
|
|
12646
|
+
const suitabilityCompleteEventMetadataSchema = objectType({
|
|
12647
|
+
suitabilityRating: z.number(),
|
|
12648
|
+
suitabilityReason: z.string(),
|
|
12649
|
+
agentStatus: z.string(),
|
|
12650
|
+
model: z.string(),
|
|
12651
|
+
provider: z.string(),
|
|
12652
|
+
promptTokens: z.number(),
|
|
12653
|
+
completionTokens: z.number(),
|
|
12654
|
+
messages: z.array(objectType({
|
|
12655
|
+
role: z.string(),
|
|
12656
|
+
content: z.string(),
|
|
12657
|
+
})),
|
|
12658
|
+
});
|
|
12659
|
+
const suitabilityFailedEventMetadataSchema = objectType({
|
|
12660
|
+
agentStatus: z.string(),
|
|
12661
|
+
reason: z.string(),
|
|
12662
|
+
});
|
|
12663
|
+
const proposalCompleteEventMetadataSchema = objectType({
|
|
12664
|
+
agentStatus: z.string(),
|
|
12665
|
+
proposal: proposalSchema,
|
|
12666
|
+
model: z.string(),
|
|
12667
|
+
provider: z.string(),
|
|
12668
|
+
promptTokens: z.number(),
|
|
12669
|
+
completionTokens: z.number(),
|
|
12670
|
+
messages: z.array(objectType({
|
|
12671
|
+
role: z.string(),
|
|
12672
|
+
content: z.string(),
|
|
12673
|
+
})),
|
|
12674
|
+
});
|
|
12675
|
+
const eventLoggerPayloadSchema = unionType([
|
|
12676
|
+
logEventSchema,
|
|
12677
|
+
arrayType(logEventSchema),
|
|
12678
|
+
]);
|
|
12679
|
+
|
|
12680
|
+
const usageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12681
|
+
"suitabilityComplete",
|
|
12682
|
+
"proposalComplete",
|
|
12683
|
+
"biddingComplete",
|
|
12684
|
+
]);
|
|
12685
|
+
const usageEventMetadataSchema = objectType({
|
|
12686
|
+
campaignId: stringType().nullable(),
|
|
12687
|
+
userId: stringType().nullable(),
|
|
12688
|
+
stripeSubscriptionId: stringType().nullable(),
|
|
12689
|
+
planId: stringType().nullable(),
|
|
12690
|
+
});
|
|
12691
|
+
const usageEventSchema = objectType({
|
|
12692
|
+
organizationId: stringType(),
|
|
12693
|
+
typeId: usageEventTypeEnum,
|
|
12694
|
+
timestamp: numberType(),
|
|
12695
|
+
metadata: usageEventMetadataSchema,
|
|
12696
|
+
});
|
|
12697
|
+
|
|
12698
|
+
const billingStripeMetadataSchema = objectType({
|
|
12699
|
+
customer: objectType({ id: stringType().nullable() }),
|
|
12700
|
+
});
|
|
12701
|
+
const billingSchema = objectType({
|
|
12702
|
+
savedCard: booleanType(),
|
|
12703
|
+
stripe: billingStripeMetadataSchema,
|
|
12704
|
+
});
|
|
12705
|
+
|
|
12706
|
+
const subscriptionStatusEnum = z.enum([
|
|
12707
|
+
"active",
|
|
12708
|
+
"trialing",
|
|
12709
|
+
"cancelled",
|
|
12710
|
+
"paused",
|
|
12711
|
+
"payment_processing",
|
|
12712
|
+
"payment_pending",
|
|
12713
|
+
"payment_failed",
|
|
12714
|
+
]);
|
|
12715
|
+
const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
|
|
12716
|
+
const subscriptionStripeMetadataItemSchema = objectType({
|
|
12717
|
+
id: stringType(),
|
|
12718
|
+
price: objectType({
|
|
12719
|
+
id: stringType(),
|
|
12720
|
+
}),
|
|
12721
|
+
});
|
|
12722
|
+
const subscriptionStripeMetadataSchema = objectType({
|
|
12723
|
+
id: stringType(),
|
|
12724
|
+
items: arrayType(subscriptionStripeMetadataItemSchema),
|
|
12725
|
+
invoice: objectType({
|
|
12726
|
+
id: stringType(),
|
|
12727
|
+
hosted_invoice_url: stringType().nullable(),
|
|
12728
|
+
}),
|
|
12729
|
+
});
|
|
12730
|
+
const subscriptionSchema = objectType({
|
|
12731
|
+
planId: stringType(),
|
|
12732
|
+
pendingPlanId: stringType().nullable(),
|
|
12733
|
+
status: subscriptionStatusEnum,
|
|
12734
|
+
startedAt: numberType(),
|
|
12735
|
+
currentPeriodEnd: numberType(),
|
|
12736
|
+
stripe: subscriptionStripeMetadataSchema,
|
|
12737
|
+
source: subscriptionSourceEnum,
|
|
12738
|
+
usage: recordType(usageEventTypeEnum, numberType()),
|
|
12739
|
+
});
|
|
12740
|
+
|
|
12741
|
+
const coverLetterTemplateSchema = z.object({
|
|
12742
|
+
id: z.string(),
|
|
12743
|
+
name: z.string(),
|
|
12744
|
+
description: z.string().nullable(),
|
|
12745
|
+
template: z.string(),
|
|
12746
|
+
instructions: z.string(),
|
|
12747
|
+
});
|
|
12748
|
+
const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
|
|
12749
|
+
name: true,
|
|
12750
|
+
template: true,
|
|
12751
|
+
instructions: true,
|
|
12752
|
+
});
|
|
12753
|
+
|
|
12754
|
+
const organizationMemberRoleEnum = z.enum(["admin", "member"]);
|
|
12755
|
+
const organizationMemberSchema = objectType({
|
|
12756
|
+
role: organizationMemberRoleEnum,
|
|
12757
|
+
joinedAt: numberType(),
|
|
12758
|
+
invitedBy: stringType(),
|
|
12759
|
+
});
|
|
12760
|
+
|
|
12761
|
+
const onboardingProgressSchema = z.object({
|
|
12762
|
+
profileSetup: z.boolean(),
|
|
12763
|
+
campaignCreated: z.boolean(),
|
|
12764
|
+
filtersAdded: z.boolean(),
|
|
12765
|
+
automationEnabled: z.boolean(),
|
|
12766
|
+
startCampaign: z.boolean(),
|
|
12767
|
+
});
|
|
12768
|
+
|
|
12769
|
+
const organizationTypeSchema = z.enum(["agency", "freelancer"]);
|
|
12770
|
+
const organizationTierEnum = z.enum(["free", "premium"]);
|
|
12771
|
+
const limitsSchema = objectType({
|
|
12772
|
+
monthlyCredits: numberType(),
|
|
12773
|
+
usedCredits: numberType(),
|
|
12774
|
+
extraCredits: numberType(),
|
|
12775
|
+
});
|
|
12776
|
+
const organizationSchema = objectType({
|
|
12777
|
+
id: stringType(),
|
|
12778
|
+
name: stringType(),
|
|
12779
|
+
type: organizationTypeSchema,
|
|
12780
|
+
associatedBidders: z.array(stringType()).nullable(),
|
|
12781
|
+
subscription: subscriptionSchema.nullable(),
|
|
12782
|
+
active: booleanType(),
|
|
12783
|
+
limits: limitsSchema,
|
|
12784
|
+
billing: billingSchema.nullable(),
|
|
12785
|
+
lastBidTime: numberType().nullable(),
|
|
12786
|
+
createdAt: numberType(),
|
|
12787
|
+
updatedAt: numberType(),
|
|
12788
|
+
openRouterApiKey: stringType().nullable(),
|
|
12789
|
+
});
|
|
12790
|
+
const caseStudySchema = objectType({
|
|
12791
|
+
title: stringType(),
|
|
12792
|
+
description: stringType(),
|
|
12793
|
+
});
|
|
12794
|
+
z.object({
|
|
12795
|
+
type: z.enum(["freelancer", "agency"]),
|
|
12796
|
+
name: z.string(),
|
|
12797
|
+
summary: z.string(),
|
|
12798
|
+
coreServices: z.string(),
|
|
12799
|
+
toolsSkillsTechnologies: z.string(),
|
|
12800
|
+
approach: z.string(),
|
|
12801
|
+
icp: z.string(),
|
|
12802
|
+
projectsTheyAvoid: z.string(),
|
|
12803
|
+
spokenLanguages: z.string(),
|
|
12804
|
+
agencyInfo: z.object({
|
|
12805
|
+
location: z.array(z.string()),
|
|
12806
|
+
website: z.string().url(),
|
|
12807
|
+
teamSize: z.number(),
|
|
12808
|
+
}),
|
|
12809
|
+
caseStudies: z.array(caseStudySchema),
|
|
12810
|
+
});
|
|
12811
|
+
const createOrganizationSchema = organizationSchema.pick({
|
|
12812
|
+
name: true,
|
|
12813
|
+
type: true,
|
|
12814
|
+
});
|
|
12815
|
+
const trackUsageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12816
|
+
"suitabilityComplete",
|
|
12817
|
+
"proposalComplete",
|
|
12818
|
+
"biddingComplete",
|
|
12819
|
+
]);
|
|
12820
|
+
const trackUsagePayloadSchema = objectType({
|
|
12821
|
+
event: usageEventTypeEnum,
|
|
12822
|
+
campaignId: stringType().nullish(),
|
|
12823
|
+
});
|
|
12824
|
+
const questionRulesSchema = objectType({
|
|
12825
|
+
question: stringType(),
|
|
12826
|
+
answer: stringType(),
|
|
12827
|
+
category: stringType(),
|
|
12828
|
+
});
|
|
12829
|
+
const aiConfigSchema = objectType({
|
|
12830
|
+
// suitabilityRules: string().nullable(),
|
|
12831
|
+
// coverLetterRules: string().nullable(),
|
|
12832
|
+
// coverLetterTemplate: string().nullable(),
|
|
12833
|
+
questionRules: arrayType(questionRulesSchema).nullable(),
|
|
12834
|
+
// approvedSuitabilityJobs: number().nullable(),
|
|
12835
|
+
// approvedProposalJobs: number().nullable(),
|
|
12836
|
+
});
|
|
12837
|
+
const notificationConfigSchema = objectType({
|
|
12838
|
+
emailEnabled: booleanType(),
|
|
12839
|
+
discordWebhookUrl: stringType().nullable(),
|
|
12840
|
+
slackWebhookUrl: stringType().nullable(),
|
|
12841
|
+
});
|
|
12842
|
+
const organizationSettingsSchema = objectType({
|
|
12843
|
+
aiConfig: aiConfigSchema,
|
|
12844
|
+
});
|
|
12845
|
+
const subscribePayloadSchema = objectType({
|
|
12846
|
+
planId: stringType().min(1, "Plan id is required."),
|
|
12847
|
+
paymentMethodId: stringType().min(1, "Payment method is required."),
|
|
12848
|
+
toltReferral: stringType().optional(),
|
|
12849
|
+
couponCode: stringType().nullish(),
|
|
12850
|
+
});
|
|
12851
|
+
|
|
12852
|
+
const campaignAnalyticsSchema = z.object({
|
|
12853
|
+
contacted: z.number().optional(),
|
|
12854
|
+
viewed: z.number().optional(),
|
|
12855
|
+
replied: z.number().optional(),
|
|
12856
|
+
won: z.number().optional(),
|
|
12857
|
+
proposalsGenerated: z.number().optional(),
|
|
12858
|
+
leadsAnalyzed: z.number().optional(),
|
|
12859
|
+
leadsFailed: z.number().optional(),
|
|
12860
|
+
suitableJobs: z.number().optional(),
|
|
12861
|
+
unsuitableJobs: z.number().optional(),
|
|
12862
|
+
wonAmount: z.number().optional(),
|
|
12863
|
+
});
|
|
12864
|
+
const campaignAnalyticsStatsSchema = z.object({
|
|
12865
|
+
totalStats: campaignAnalyticsSchema,
|
|
12866
|
+
statsByDate: z.array(z.object({
|
|
12867
|
+
label: z.string(),
|
|
12868
|
+
contacted: z.number(),
|
|
12869
|
+
viewed: z.number(),
|
|
12870
|
+
replied: z.number(),
|
|
12871
|
+
won: z.number(),
|
|
12872
|
+
leadsAnalyzed: z.number(),
|
|
12873
|
+
})),
|
|
12874
|
+
});
|
|
12875
|
+
const campaignAnalyticsResponseSchema = z.object({
|
|
12876
|
+
jobsAnalyzed: z.number(),
|
|
12877
|
+
contacted: z.number(),
|
|
12878
|
+
viewed: z.number(),
|
|
12879
|
+
replied: z.number(),
|
|
12880
|
+
won: z.number(),
|
|
12881
|
+
});
|
|
12882
|
+
const campaignActivityTypeSchema = z.enum([
|
|
12883
|
+
"campaign_status",
|
|
12884
|
+
"lead_analysis",
|
|
12885
|
+
"lead_status",
|
|
12932
12886
|
"proposal_sent",
|
|
12933
12887
|
]);
|
|
12934
12888
|
const baseActivitySchema = z.object({
|
|
@@ -13085,6 +13039,57 @@ const invoiceSchema = objectType({
|
|
|
13085
13039
|
updatedAt: numberType(),
|
|
13086
13040
|
});
|
|
13087
13041
|
|
|
13042
|
+
const systemPromptSchema = objectType({
|
|
13043
|
+
suitability: stringType(),
|
|
13044
|
+
proposal: stringType(),
|
|
13045
|
+
questionHandlingGuidelines: stringType(),
|
|
13046
|
+
});
|
|
13047
|
+
const systemSchema = objectType({
|
|
13048
|
+
prompts: systemPromptSchema,
|
|
13049
|
+
});
|
|
13050
|
+
|
|
13051
|
+
const agentTaskRequestSchema = z.object({
|
|
13052
|
+
userId: z.string().nullable(),
|
|
13053
|
+
organizationId: z.string(),
|
|
13054
|
+
campaignId: z.string(),
|
|
13055
|
+
lead: leadSchema,
|
|
13056
|
+
});
|
|
13057
|
+
const testSystemPromptsRequestSchema = z.object({
|
|
13058
|
+
organizationId: z.string(),
|
|
13059
|
+
modelSuitability: z.string(),
|
|
13060
|
+
modelProposal: z.string(),
|
|
13061
|
+
systemPrompt: systemPromptSchema,
|
|
13062
|
+
aiConfig: aiConfigSchema,
|
|
13063
|
+
lead: leadSchema,
|
|
13064
|
+
});
|
|
13065
|
+
const suitabilityRatingSchema = z.object({
|
|
13066
|
+
rating: z.number(),
|
|
13067
|
+
reason: z.string(),
|
|
13068
|
+
});
|
|
13069
|
+
const agentTaskResponseSchema = z.object({
|
|
13070
|
+
result: z.union([suitabilityRatingSchema, proposalSchema]),
|
|
13071
|
+
model: z.string(),
|
|
13072
|
+
provider: z.string(),
|
|
13073
|
+
promptTokens: z.number(),
|
|
13074
|
+
completionTokens: z.number(),
|
|
13075
|
+
});
|
|
13076
|
+
const testSystemPromptsResponseSchema = z.object({
|
|
13077
|
+
proposal: z.object({
|
|
13078
|
+
result: proposalSchema,
|
|
13079
|
+
model: z.string(),
|
|
13080
|
+
provider: z.string(),
|
|
13081
|
+
promptTokens: z.number(),
|
|
13082
|
+
completionTokens: z.number(),
|
|
13083
|
+
}),
|
|
13084
|
+
suitability: z.object({
|
|
13085
|
+
result: suitabilityRatingSchema,
|
|
13086
|
+
model: z.string(),
|
|
13087
|
+
provider: z.string(),
|
|
13088
|
+
promptTokens: z.number(),
|
|
13089
|
+
completionTokens: z.number(),
|
|
13090
|
+
}),
|
|
13091
|
+
});
|
|
13092
|
+
|
|
13088
13093
|
const planStripeMetadataSchema = objectType({
|
|
13089
13094
|
id: stringType().regex(/^prod_[a-zA-Z0-9]+$/),
|
|
13090
13095
|
name: stringType(),
|
|
@@ -83,6 +83,11 @@ export declare const ROUTES: {
|
|
|
83
83
|
readonly BASE: "admin/alerts";
|
|
84
84
|
readonly SEND_ALERT: "admin/alerts/send";
|
|
85
85
|
};
|
|
86
|
+
readonly AGENT: {
|
|
87
|
+
readonly BASE: "admin/agent";
|
|
88
|
+
readonly TEST_SUITABILITY: "admin/agent/test-suitability";
|
|
89
|
+
readonly TEST_PROPOSAL: "admin/agent/test-proposal";
|
|
90
|
+
};
|
|
86
91
|
};
|
|
87
92
|
readonly BID: {
|
|
88
93
|
readonly BASE: "bid";
|
|
@@ -303,6 +303,7 @@ export declare const agentTaskRequestSchema: z.ZodObject<{
|
|
|
303
303
|
}>>>;
|
|
304
304
|
}, {
|
|
305
305
|
jobId: z.ZodString;
|
|
306
|
+
scrapedAt: z.ZodNullable<z.ZodNumber>;
|
|
306
307
|
updatedAt: z.ZodNullable<z.ZodNumber>;
|
|
307
308
|
suitabilityRating: z.ZodNullable<z.ZodNumber>;
|
|
308
309
|
suitabilityReason: z.ZodNullable<z.ZodString>;
|
|
@@ -418,6 +419,7 @@ export declare const agentTaskRequestSchema: z.ZodObject<{
|
|
|
418
419
|
} | null;
|
|
419
420
|
activityUpdates: 1 | 2 | 3 | null;
|
|
420
421
|
jobId: string;
|
|
422
|
+
scrapedAt: number | null;
|
|
421
423
|
suitabilityRating: number | null;
|
|
422
424
|
suitabilityReason: string | null;
|
|
423
425
|
proposal: string | null;
|
|
@@ -546,6 +548,7 @@ export declare const agentTaskRequestSchema: z.ZodObject<{
|
|
|
546
548
|
} | null;
|
|
547
549
|
activityUpdates: 1 | 2 | 3 | null;
|
|
548
550
|
jobId: string;
|
|
551
|
+
scrapedAt: number | null;
|
|
549
552
|
suitabilityRating: number | null;
|
|
550
553
|
suitabilityReason: string | null;
|
|
551
554
|
proposal: string | null;
|
|
@@ -679,6 +682,7 @@ export declare const agentTaskRequestSchema: z.ZodObject<{
|
|
|
679
682
|
} | null;
|
|
680
683
|
activityUpdates: 1 | 2 | 3 | null;
|
|
681
684
|
jobId: string;
|
|
685
|
+
scrapedAt: number | null;
|
|
682
686
|
suitabilityRating: number | null;
|
|
683
687
|
suitabilityReason: string | null;
|
|
684
688
|
proposal: string | null;
|
|
@@ -812,6 +816,7 @@ export declare const agentTaskRequestSchema: z.ZodObject<{
|
|
|
812
816
|
} | null;
|
|
813
817
|
activityUpdates: 1 | 2 | 3 | null;
|
|
814
818
|
jobId: string;
|
|
819
|
+
scrapedAt: number | null;
|
|
815
820
|
suitabilityRating: number | null;
|
|
816
821
|
suitabilityReason: string | null;
|
|
817
822
|
proposal: string | null;
|
|
@@ -1194,6 +1199,7 @@ export declare const testSystemPromptsRequestSchema: z.ZodObject<{
|
|
|
1194
1199
|
}>>>;
|
|
1195
1200
|
}, {
|
|
1196
1201
|
jobId: z.ZodString;
|
|
1202
|
+
scrapedAt: z.ZodNullable<z.ZodNumber>;
|
|
1197
1203
|
updatedAt: z.ZodNullable<z.ZodNumber>;
|
|
1198
1204
|
suitabilityRating: z.ZodNullable<z.ZodNumber>;
|
|
1199
1205
|
suitabilityReason: z.ZodNullable<z.ZodString>;
|
|
@@ -1309,6 +1315,7 @@ export declare const testSystemPromptsRequestSchema: z.ZodObject<{
|
|
|
1309
1315
|
} | null;
|
|
1310
1316
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1311
1317
|
jobId: string;
|
|
1318
|
+
scrapedAt: number | null;
|
|
1312
1319
|
suitabilityRating: number | null;
|
|
1313
1320
|
suitabilityReason: string | null;
|
|
1314
1321
|
proposal: string | null;
|
|
@@ -1437,6 +1444,7 @@ export declare const testSystemPromptsRequestSchema: z.ZodObject<{
|
|
|
1437
1444
|
} | null;
|
|
1438
1445
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1439
1446
|
jobId: string;
|
|
1447
|
+
scrapedAt: number | null;
|
|
1440
1448
|
suitabilityRating: number | null;
|
|
1441
1449
|
suitabilityReason: string | null;
|
|
1442
1450
|
proposal: string | null;
|
|
@@ -1568,6 +1576,7 @@ export declare const testSystemPromptsRequestSchema: z.ZodObject<{
|
|
|
1568
1576
|
} | null;
|
|
1569
1577
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1570
1578
|
jobId: string;
|
|
1579
|
+
scrapedAt: number | null;
|
|
1571
1580
|
suitabilityRating: number | null;
|
|
1572
1581
|
suitabilityReason: string | null;
|
|
1573
1582
|
proposal: string | null;
|
|
@@ -1713,6 +1722,7 @@ export declare const testSystemPromptsRequestSchema: z.ZodObject<{
|
|
|
1713
1722
|
} | null;
|
|
1714
1723
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1715
1724
|
jobId: string;
|
|
1725
|
+
scrapedAt: number | null;
|
|
1716
1726
|
suitabilityRating: number | null;
|
|
1717
1727
|
suitabilityReason: string | null;
|
|
1718
1728
|
proposal: string | null;
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from "./account";
|
|
2
|
-
export * from "./agent";
|
|
3
2
|
export * from "./bid";
|
|
4
3
|
export * from "./campaign";
|
|
5
4
|
export * from "./invoice";
|
|
6
5
|
export * from "./job";
|
|
7
6
|
export * from "./lead";
|
|
7
|
+
export * from "./agent";
|
|
8
8
|
export * from "./logger";
|
|
9
9
|
export * from "./organization";
|
|
10
10
|
export * from "./plan";
|