lancer-shared 1.2.76 → 1.2.78
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 +445 -444
- package/dist/schemas/agent/index.d.ts +10 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/lead/index.d.ts +13 -0
- package/package.json +1 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -12052,6 +12052,7 @@ const questionAnswerPairSchema = z.object({
|
|
|
12052
12052
|
const leadSchema = upworkJobSchema
|
|
12053
12053
|
.extend({
|
|
12054
12054
|
jobId: stringType(),
|
|
12055
|
+
scrapedAt: numberType().nullable(),
|
|
12055
12056
|
updatedAt: numberType().nullable(),
|
|
12056
12057
|
suitabilityRating: numberType().nullable(),
|
|
12057
12058
|
suitabilityReason: stringType().nullable(),
|
|
@@ -12096,395 +12097,6 @@ const generateLeadCountsRequestSchema = z.object({
|
|
|
12096
12097
|
campaignId: z.string().optional(),
|
|
12097
12098
|
});
|
|
12098
12099
|
|
|
12099
|
-
const proposalSchema = z.object({
|
|
12100
|
-
coverLetter: z.string(),
|
|
12101
|
-
questionAnswerPairs: questionAnswerPairSchema.array(),
|
|
12102
|
-
});
|
|
12103
|
-
|
|
12104
|
-
const LogEventTypeEnum = z.enum([
|
|
12105
|
-
// Scraper Events
|
|
12106
|
-
"scraperStarted",
|
|
12107
|
-
"scraperCompleted",
|
|
12108
|
-
"jobScraped",
|
|
12109
|
-
"jobScrapeFailed",
|
|
12110
|
-
"jobsIndexed",
|
|
12111
|
-
"jobDuplicateSkipped",
|
|
12112
|
-
"scraperFailed",
|
|
12113
|
-
"jobActivityScraped",
|
|
12114
|
-
"jobActivityScrapeFailed",
|
|
12115
|
-
"leadStatusCheckFailed",
|
|
12116
|
-
"leadStatusUpdated",
|
|
12117
|
-
// Feed Scraper Events
|
|
12118
|
-
"feedScrapeStarted",
|
|
12119
|
-
"feedScrapeCompleted",
|
|
12120
|
-
"feedScrapeFailed",
|
|
12121
|
-
"jobListingScraped",
|
|
12122
|
-
// Job Sync & Campaign Matching
|
|
12123
|
-
"jobSyncPublished",
|
|
12124
|
-
"jobSyncReceived",
|
|
12125
|
-
"leadsCreatedAndSynced",
|
|
12126
|
-
// Suitability Events
|
|
12127
|
-
"suitabilityPending",
|
|
12128
|
-
"suitabilityProcessing",
|
|
12129
|
-
"suitabilityComplete",
|
|
12130
|
-
"suitabilityFailed",
|
|
12131
|
-
"manualSuitabilityAnalyzed",
|
|
12132
|
-
// Proposal Events
|
|
12133
|
-
"proposalProcessing",
|
|
12134
|
-
"proposalComplete",
|
|
12135
|
-
"proposalFailed",
|
|
12136
|
-
"manualProposalGenerated",
|
|
12137
|
-
// Bidding Events
|
|
12138
|
-
"biddingProcessing",
|
|
12139
|
-
"biddingComplete",
|
|
12140
|
-
"biddingFailed",
|
|
12141
|
-
"biddingSkipped",
|
|
12142
|
-
"biddingPending",
|
|
12143
|
-
"biddingRetry",
|
|
12144
|
-
"biddingInsufficientConnects",
|
|
12145
|
-
"biddingWarningAlert",
|
|
12146
|
-
// System/Generic Events
|
|
12147
|
-
"errorLogged",
|
|
12148
|
-
"cloudTaskRetry",
|
|
12149
|
-
"manualLeadEdited",
|
|
12150
|
-
"leadArchived",
|
|
12151
|
-
"auditTrailLogged",
|
|
12152
|
-
]);
|
|
12153
|
-
const logEventSchema = z.object({
|
|
12154
|
-
// The type of event (use a z.enum if possible)
|
|
12155
|
-
type: LogEventTypeEnum, // e.g. "suitability-failed", "proposal-generated"
|
|
12156
|
-
// The service that triggered the event
|
|
12157
|
-
source: z.string(), // e.g. "lancer-agents", "lancer-bidding"
|
|
12158
|
-
// Optional: Allow logging non-lead events in the future
|
|
12159
|
-
resourceType: z.string().default("lead"), // e.g. "lead", "campaign", "user"
|
|
12160
|
-
// ID of the resource (primary entity affected)
|
|
12161
|
-
resourceId: z.string().nullable(), // fallback if leadId is not applicable
|
|
12162
|
-
// Lead-level metadata
|
|
12163
|
-
organizationId: z.string().nullable(),
|
|
12164
|
-
userId: z.string().nullable(),
|
|
12165
|
-
campaignId: z.string().nullable(),
|
|
12166
|
-
leadId: z.string().nullable(),
|
|
12167
|
-
// Reason or message for the event
|
|
12168
|
-
reason: z.string().nullable(),
|
|
12169
|
-
// Generic metadata (stacktrace, score, raw request, etc.)
|
|
12170
|
-
metadata: z.record(z.unknown()).nullable(),
|
|
12171
|
-
// Optional timestamp override
|
|
12172
|
-
timestamp: z.number(),
|
|
12173
|
-
});
|
|
12174
|
-
const listingScrapedEventMetadata = objectType({
|
|
12175
|
-
listing: jobListingSchema,
|
|
12176
|
-
region: regionSchema,
|
|
12177
|
-
});
|
|
12178
|
-
const jobActivityScrapedEventMetadata = objectType({
|
|
12179
|
-
activity: jobActivitySchema,
|
|
12180
|
-
region: regionSchema,
|
|
12181
|
-
offsetHour: jobActivityOffsetHourSchema,
|
|
12182
|
-
scrapedAt: numberType(),
|
|
12183
|
-
});
|
|
12184
|
-
const jobActivityScrapeFailedEventMetadata = objectType({
|
|
12185
|
-
listing: jobListingSchema,
|
|
12186
|
-
region: regionSchema,
|
|
12187
|
-
offsetHour: jobActivityOffsetHourSchema,
|
|
12188
|
-
});
|
|
12189
|
-
const feedScrapeStartedEventMetadata = objectType({
|
|
12190
|
-
id: stringType(),
|
|
12191
|
-
startTime: numberType(),
|
|
12192
|
-
region: regionSchema,
|
|
12193
|
-
});
|
|
12194
|
-
const feedScrapeCompletedEventMetadata = objectType({
|
|
12195
|
-
id: stringType(),
|
|
12196
|
-
endTime: numberType(),
|
|
12197
|
-
region: regionSchema,
|
|
12198
|
-
accountUsername: stringType(),
|
|
12199
|
-
listings: arrayType(jobListingSchema),
|
|
12200
|
-
});
|
|
12201
|
-
const biddingCompletedEventMetadata = objectType({
|
|
12202
|
-
biddingAmount: numberType(),
|
|
12203
|
-
boosted: booleanType(),
|
|
12204
|
-
boostingAmount: numberType(),
|
|
12205
|
-
});
|
|
12206
|
-
const biddingFailedEventMetadata = objectType({
|
|
12207
|
-
error: z.any(),
|
|
12208
|
-
});
|
|
12209
|
-
const userAccountBiddingExceptionEventMetadata = objectType({
|
|
12210
|
-
errorType: z.enum(["insufficientConnects", "proposalFormWarningAlert"]),
|
|
12211
|
-
context: z.string().optional(),
|
|
12212
|
-
});
|
|
12213
|
-
const lancerBiddingExceptionEventMetadata = objectType({
|
|
12214
|
-
errorType: z.string(),
|
|
12215
|
-
errorMessage: z.string(),
|
|
12216
|
-
context: z.string().optional(),
|
|
12217
|
-
});
|
|
12218
|
-
const leadStatusEventMetadata = objectType({
|
|
12219
|
-
campaignId: stringType(),
|
|
12220
|
-
organizationId: stringType(),
|
|
12221
|
-
leadId: stringType(),
|
|
12222
|
-
userId: stringType(),
|
|
12223
|
-
metadata: z
|
|
12224
|
-
.object({
|
|
12225
|
-
status: leadStatusSchema,
|
|
12226
|
-
proposalId: stringType().nullable(),
|
|
12227
|
-
})
|
|
12228
|
-
.optional(),
|
|
12229
|
-
reason: z.string().optional(),
|
|
12230
|
-
});
|
|
12231
|
-
const suitabilityCompleteEventMetadataSchema = objectType({
|
|
12232
|
-
suitabilityRating: z.number(),
|
|
12233
|
-
suitabilityReason: z.string(),
|
|
12234
|
-
agentStatus: z.string(),
|
|
12235
|
-
model: z.string(),
|
|
12236
|
-
provider: z.string(),
|
|
12237
|
-
promptTokens: z.number(),
|
|
12238
|
-
completionTokens: z.number(),
|
|
12239
|
-
messages: z.array(objectType({
|
|
12240
|
-
role: z.string(),
|
|
12241
|
-
content: z.string(),
|
|
12242
|
-
})),
|
|
12243
|
-
});
|
|
12244
|
-
const suitabilityFailedEventMetadataSchema = objectType({
|
|
12245
|
-
agentStatus: z.string(),
|
|
12246
|
-
reason: z.string(),
|
|
12247
|
-
});
|
|
12248
|
-
const proposalCompleteEventMetadataSchema = objectType({
|
|
12249
|
-
agentStatus: z.string(),
|
|
12250
|
-
proposal: proposalSchema,
|
|
12251
|
-
model: z.string(),
|
|
12252
|
-
provider: z.string(),
|
|
12253
|
-
promptTokens: z.number(),
|
|
12254
|
-
completionTokens: z.number(),
|
|
12255
|
-
messages: z.array(objectType({
|
|
12256
|
-
role: z.string(),
|
|
12257
|
-
content: z.string(),
|
|
12258
|
-
})),
|
|
12259
|
-
});
|
|
12260
|
-
const eventLoggerPayloadSchema = unionType([
|
|
12261
|
-
logEventSchema,
|
|
12262
|
-
arrayType(logEventSchema),
|
|
12263
|
-
]);
|
|
12264
|
-
|
|
12265
|
-
const usageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12266
|
-
"suitabilityComplete",
|
|
12267
|
-
"proposalComplete",
|
|
12268
|
-
"biddingComplete",
|
|
12269
|
-
]);
|
|
12270
|
-
const usageEventMetadataSchema = objectType({
|
|
12271
|
-
campaignId: stringType().nullable(),
|
|
12272
|
-
userId: stringType().nullable(),
|
|
12273
|
-
stripeSubscriptionId: stringType().nullable(),
|
|
12274
|
-
planId: stringType().nullable(),
|
|
12275
|
-
});
|
|
12276
|
-
const usageEventSchema = objectType({
|
|
12277
|
-
organizationId: stringType(),
|
|
12278
|
-
typeId: usageEventTypeEnum,
|
|
12279
|
-
timestamp: numberType(),
|
|
12280
|
-
metadata: usageEventMetadataSchema,
|
|
12281
|
-
});
|
|
12282
|
-
|
|
12283
|
-
const billingStripeMetadataSchema = objectType({
|
|
12284
|
-
customer: objectType({ id: stringType().nullable() }),
|
|
12285
|
-
});
|
|
12286
|
-
const billingSchema = objectType({
|
|
12287
|
-
savedCard: booleanType(),
|
|
12288
|
-
stripe: billingStripeMetadataSchema,
|
|
12289
|
-
});
|
|
12290
|
-
|
|
12291
|
-
const subscriptionStatusEnum = z.enum([
|
|
12292
|
-
"active",
|
|
12293
|
-
"trialing",
|
|
12294
|
-
"cancelled",
|
|
12295
|
-
"paused",
|
|
12296
|
-
"payment_processing",
|
|
12297
|
-
"payment_pending",
|
|
12298
|
-
"payment_failed",
|
|
12299
|
-
]);
|
|
12300
|
-
const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
|
|
12301
|
-
const subscriptionStripeMetadataItemSchema = objectType({
|
|
12302
|
-
id: stringType(),
|
|
12303
|
-
price: objectType({
|
|
12304
|
-
id: stringType(),
|
|
12305
|
-
}),
|
|
12306
|
-
});
|
|
12307
|
-
const subscriptionStripeMetadataSchema = objectType({
|
|
12308
|
-
id: stringType(),
|
|
12309
|
-
items: arrayType(subscriptionStripeMetadataItemSchema),
|
|
12310
|
-
invoice: objectType({
|
|
12311
|
-
id: stringType(),
|
|
12312
|
-
hosted_invoice_url: stringType().nullable(),
|
|
12313
|
-
}),
|
|
12314
|
-
});
|
|
12315
|
-
const subscriptionSchema = objectType({
|
|
12316
|
-
planId: stringType(),
|
|
12317
|
-
pendingPlanId: stringType().nullable(),
|
|
12318
|
-
status: subscriptionStatusEnum,
|
|
12319
|
-
startedAt: numberType(),
|
|
12320
|
-
currentPeriodEnd: numberType(),
|
|
12321
|
-
stripe: subscriptionStripeMetadataSchema,
|
|
12322
|
-
source: subscriptionSourceEnum,
|
|
12323
|
-
usage: recordType(usageEventTypeEnum, numberType()),
|
|
12324
|
-
});
|
|
12325
|
-
|
|
12326
|
-
const coverLetterTemplateSchema = z.object({
|
|
12327
|
-
id: z.string(),
|
|
12328
|
-
name: z.string(),
|
|
12329
|
-
description: z.string().nullable(),
|
|
12330
|
-
template: z.string(),
|
|
12331
|
-
instructions: z.string(),
|
|
12332
|
-
});
|
|
12333
|
-
const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
|
|
12334
|
-
name: true,
|
|
12335
|
-
template: true,
|
|
12336
|
-
instructions: true,
|
|
12337
|
-
});
|
|
12338
|
-
|
|
12339
|
-
const organizationMemberRoleEnum = z.enum(["admin", "member"]);
|
|
12340
|
-
const organizationMemberSchema = objectType({
|
|
12341
|
-
role: organizationMemberRoleEnum,
|
|
12342
|
-
joinedAt: numberType(),
|
|
12343
|
-
invitedBy: stringType(),
|
|
12344
|
-
});
|
|
12345
|
-
|
|
12346
|
-
const onboardingProgressSchema = z.object({
|
|
12347
|
-
profileSetup: z.boolean(),
|
|
12348
|
-
campaignCreated: z.boolean(),
|
|
12349
|
-
filtersAdded: z.boolean(),
|
|
12350
|
-
automationEnabled: z.boolean(),
|
|
12351
|
-
startCampaign: z.boolean(),
|
|
12352
|
-
});
|
|
12353
|
-
|
|
12354
|
-
const organizationTypeSchema = z.enum(["agency", "freelancer"]);
|
|
12355
|
-
const organizationTierEnum = z.enum(["free", "premium"]);
|
|
12356
|
-
const limitsSchema = objectType({
|
|
12357
|
-
monthlyCredits: numberType(),
|
|
12358
|
-
usedCredits: numberType(),
|
|
12359
|
-
extraCredits: numberType(),
|
|
12360
|
-
});
|
|
12361
|
-
const organizationSchema = objectType({
|
|
12362
|
-
id: stringType(),
|
|
12363
|
-
name: stringType(),
|
|
12364
|
-
type: organizationTypeSchema,
|
|
12365
|
-
associatedBidders: z.array(stringType()).nullable(),
|
|
12366
|
-
subscription: subscriptionSchema.nullable(),
|
|
12367
|
-
active: booleanType(),
|
|
12368
|
-
limits: limitsSchema,
|
|
12369
|
-
billing: billingSchema.nullable(),
|
|
12370
|
-
lastBidTime: numberType().nullable(),
|
|
12371
|
-
createdAt: numberType(),
|
|
12372
|
-
updatedAt: numberType(),
|
|
12373
|
-
openRouterApiKey: stringType().nullable(),
|
|
12374
|
-
});
|
|
12375
|
-
const caseStudySchema = objectType({
|
|
12376
|
-
title: stringType(),
|
|
12377
|
-
description: stringType(),
|
|
12378
|
-
});
|
|
12379
|
-
z.object({
|
|
12380
|
-
type: z.enum(["freelancer", "agency"]),
|
|
12381
|
-
name: z.string(),
|
|
12382
|
-
summary: z.string(),
|
|
12383
|
-
coreServices: z.string(),
|
|
12384
|
-
toolsSkillsTechnologies: z.string(),
|
|
12385
|
-
approach: z.string(),
|
|
12386
|
-
icp: z.string(),
|
|
12387
|
-
projectsTheyAvoid: z.string(),
|
|
12388
|
-
spokenLanguages: z.string(),
|
|
12389
|
-
agencyInfo: z.object({
|
|
12390
|
-
location: z.array(z.string()),
|
|
12391
|
-
website: z.string().url(),
|
|
12392
|
-
teamSize: z.number(),
|
|
12393
|
-
}),
|
|
12394
|
-
caseStudies: z.array(caseStudySchema),
|
|
12395
|
-
});
|
|
12396
|
-
const createOrganizationSchema = organizationSchema.pick({
|
|
12397
|
-
name: true,
|
|
12398
|
-
type: true,
|
|
12399
|
-
});
|
|
12400
|
-
const trackUsageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12401
|
-
"suitabilityComplete",
|
|
12402
|
-
"proposalComplete",
|
|
12403
|
-
"biddingComplete",
|
|
12404
|
-
]);
|
|
12405
|
-
const trackUsagePayloadSchema = objectType({
|
|
12406
|
-
event: usageEventTypeEnum,
|
|
12407
|
-
campaignId: stringType().nullish(),
|
|
12408
|
-
});
|
|
12409
|
-
const questionRulesSchema = objectType({
|
|
12410
|
-
question: stringType(),
|
|
12411
|
-
answer: stringType(),
|
|
12412
|
-
category: stringType(),
|
|
12413
|
-
});
|
|
12414
|
-
const aiConfigSchema = objectType({
|
|
12415
|
-
// suitabilityRules: string().nullable(),
|
|
12416
|
-
// coverLetterRules: string().nullable(),
|
|
12417
|
-
// coverLetterTemplate: string().nullable(),
|
|
12418
|
-
questionRules: arrayType(questionRulesSchema).nullable(),
|
|
12419
|
-
// approvedSuitabilityJobs: number().nullable(),
|
|
12420
|
-
// approvedProposalJobs: number().nullable(),
|
|
12421
|
-
});
|
|
12422
|
-
const notificationConfigSchema = objectType({
|
|
12423
|
-
emailEnabled: booleanType(),
|
|
12424
|
-
discordWebhookUrl: stringType().nullable(),
|
|
12425
|
-
slackWebhookUrl: stringType().nullable(),
|
|
12426
|
-
});
|
|
12427
|
-
const organizationSettingsSchema = objectType({
|
|
12428
|
-
aiConfig: aiConfigSchema,
|
|
12429
|
-
});
|
|
12430
|
-
const subscribePayloadSchema = objectType({
|
|
12431
|
-
planId: stringType().min(1, "Plan id is required."),
|
|
12432
|
-
paymentMethodId: stringType().min(1, "Payment method is required."),
|
|
12433
|
-
toltReferral: stringType().optional(),
|
|
12434
|
-
couponCode: stringType().nullish(),
|
|
12435
|
-
});
|
|
12436
|
-
|
|
12437
|
-
const systemPromptSchema = objectType({
|
|
12438
|
-
suitability: stringType(),
|
|
12439
|
-
proposal: stringType(),
|
|
12440
|
-
questionHandlingGuidelines: stringType(),
|
|
12441
|
-
});
|
|
12442
|
-
const systemSchema = objectType({
|
|
12443
|
-
prompts: systemPromptSchema,
|
|
12444
|
-
});
|
|
12445
|
-
|
|
12446
|
-
const agentTaskRequestSchema = z.object({
|
|
12447
|
-
userId: z.string().nullable(),
|
|
12448
|
-
organizationId: z.string(),
|
|
12449
|
-
campaignId: z.string(),
|
|
12450
|
-
lead: leadSchema,
|
|
12451
|
-
});
|
|
12452
|
-
const testSystemPromptsRequestSchema = z.object({
|
|
12453
|
-
organizationId: z.string(),
|
|
12454
|
-
modelSuitability: z.string(),
|
|
12455
|
-
modelProposal: z.string(),
|
|
12456
|
-
systemPrompt: systemPromptSchema,
|
|
12457
|
-
aiConfig: aiConfigSchema,
|
|
12458
|
-
lead: leadSchema,
|
|
12459
|
-
});
|
|
12460
|
-
const suitabilityRatingSchema = z.object({
|
|
12461
|
-
rating: z.number(),
|
|
12462
|
-
reason: z.string(),
|
|
12463
|
-
});
|
|
12464
|
-
const agentTaskResponseSchema = z.object({
|
|
12465
|
-
result: z.union([suitabilityRatingSchema, proposalSchema]),
|
|
12466
|
-
model: z.string(),
|
|
12467
|
-
provider: z.string(),
|
|
12468
|
-
promptTokens: z.number(),
|
|
12469
|
-
completionTokens: z.number(),
|
|
12470
|
-
});
|
|
12471
|
-
const testSystemPromptsResponseSchema = z.object({
|
|
12472
|
-
proposal: z.object({
|
|
12473
|
-
result: proposalSchema,
|
|
12474
|
-
model: z.string(),
|
|
12475
|
-
provider: z.string(),
|
|
12476
|
-
promptTokens: z.number(),
|
|
12477
|
-
completionTokens: z.number(),
|
|
12478
|
-
}),
|
|
12479
|
-
suitability: z.object({
|
|
12480
|
-
result: suitabilityRatingSchema,
|
|
12481
|
-
model: z.string(),
|
|
12482
|
-
provider: z.string(),
|
|
12483
|
-
promptTokens: z.number(),
|
|
12484
|
-
completionTokens: z.number(),
|
|
12485
|
-
}),
|
|
12486
|
-
});
|
|
12487
|
-
|
|
12488
12100
|
const bidPayloadProposalDataSchema = z.object({
|
|
12489
12101
|
coverLetter: z.string(),
|
|
12490
12102
|
questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
|
|
@@ -12825,73 +12437,411 @@ const campaignWebhookSchema = z.object({
|
|
|
12825
12437
|
url: z.string().url(),
|
|
12826
12438
|
notificationSettings: campaignWebhookSettingsSchema,
|
|
12827
12439
|
});
|
|
12828
|
-
const sendNotificationRequestSchema = z.object({
|
|
12829
|
-
organizationId: z.string(),
|
|
12830
|
-
campaignId: z.string(),
|
|
12831
|
-
leadId: z.string(),
|
|
12832
|
-
type: campaignNotificationType,
|
|
12440
|
+
const sendNotificationRequestSchema = z.object({
|
|
12441
|
+
organizationId: z.string(),
|
|
12442
|
+
campaignId: z.string(),
|
|
12443
|
+
leadId: z.string(),
|
|
12444
|
+
type: campaignNotificationType,
|
|
12445
|
+
});
|
|
12446
|
+
|
|
12447
|
+
const bidConfigSchema = z.object({
|
|
12448
|
+
agencyName: z.string().nullable(),
|
|
12449
|
+
bidderId: z.string().nullable(),
|
|
12450
|
+
contractorName: z.string().nullable(),
|
|
12451
|
+
specialisedProfile: z.string().nullable(),
|
|
12452
|
+
});
|
|
12453
|
+
const campaignStatusSchema = z.union([
|
|
12454
|
+
z.literal("active"),
|
|
12455
|
+
z.literal("draft"),
|
|
12456
|
+
z.literal("paused"),
|
|
12457
|
+
z.literal("error"),
|
|
12458
|
+
]);
|
|
12459
|
+
const campaignSchema = z.object({
|
|
12460
|
+
id: z.string(),
|
|
12461
|
+
name: z.string(),
|
|
12462
|
+
filters: jobFiltersSchema,
|
|
12463
|
+
createdAt: numberType(),
|
|
12464
|
+
updatedAt: numberType(),
|
|
12465
|
+
confirmedBillingAt: numberType().nullable(),
|
|
12466
|
+
// automatedSuitability: z.boolean().nullable(),
|
|
12467
|
+
boostingEnabled: z.boolean().nullable().default(false),
|
|
12468
|
+
maximumBoost: z.number().nullable().default(30),
|
|
12469
|
+
// minimumBoost: z.number().nullable().default(0),
|
|
12470
|
+
monthlyBudget: z.number().nullable(),
|
|
12471
|
+
// suitabilityThreshold: z.number().min(0).max(100).nullable().default(0),
|
|
12472
|
+
boostingThreshold: z.number().min(0).max(100).nullable().default(0),
|
|
12473
|
+
leadCounts: z.record(leadStatusSchema, z.number()).nullable(),
|
|
12474
|
+
expenses: campaignExpensesSchema,
|
|
12475
|
+
notificationsEnabled: z.boolean().nullable(),
|
|
12476
|
+
webhooks: z.array(campaignWebhookSchema),
|
|
12477
|
+
status: campaignStatusSchema.optional(),
|
|
12478
|
+
bidConfig: bidConfigSchema.nullable(),
|
|
12479
|
+
coverLetterTemplateId: z.string().nullable(),
|
|
12480
|
+
});
|
|
12481
|
+
const upworkAccountConnectStatusSchema = z.union([
|
|
12482
|
+
z.literal("processing"),
|
|
12483
|
+
z.literal("connected"),
|
|
12484
|
+
z.literal("failed"),
|
|
12485
|
+
]);
|
|
12486
|
+
const upworkAccountConnectSchema = z.object({
|
|
12487
|
+
status: upworkAccountConnectStatusSchema.nullable(),
|
|
12488
|
+
error: z.string().nullable(),
|
|
12489
|
+
});
|
|
12490
|
+
const createCampaignSchema = campaignSchema.omit({
|
|
12491
|
+
id: true,
|
|
12492
|
+
createdAt: true,
|
|
12493
|
+
updatedAt: true,
|
|
12494
|
+
bidConfig: true,
|
|
12495
|
+
});
|
|
12496
|
+
const updateCampaignSchema = campaignSchema
|
|
12497
|
+
.omit({
|
|
12498
|
+
createdAt: true,
|
|
12499
|
+
updatedAt: true,
|
|
12500
|
+
})
|
|
12501
|
+
.partial();
|
|
12502
|
+
|
|
12503
|
+
const campaignAIMetricsSchema = z.object({
|
|
12504
|
+
leadsAnalyzed: z.number(),
|
|
12505
|
+
leadsBidded: z.number(),
|
|
12506
|
+
connectsSaved: z.number(),
|
|
12507
|
+
});
|
|
12508
|
+
|
|
12509
|
+
const proposalSchema = z.object({
|
|
12510
|
+
coverLetter: z.string(),
|
|
12511
|
+
questionAnswerPairs: questionAnswerPairSchema.array(),
|
|
12512
|
+
});
|
|
12513
|
+
|
|
12514
|
+
const LogEventTypeEnum = z.enum([
|
|
12515
|
+
// Scraper Events
|
|
12516
|
+
"scraperStarted",
|
|
12517
|
+
"scraperCompleted",
|
|
12518
|
+
"jobScraped",
|
|
12519
|
+
"jobScrapeFailed",
|
|
12520
|
+
"jobsIndexed",
|
|
12521
|
+
"jobDuplicateSkipped",
|
|
12522
|
+
"scraperFailed",
|
|
12523
|
+
"jobActivityScraped",
|
|
12524
|
+
"jobActivityScrapeFailed",
|
|
12525
|
+
"leadStatusCheckFailed",
|
|
12526
|
+
"leadStatusUpdated",
|
|
12527
|
+
// Feed Scraper Events
|
|
12528
|
+
"feedScrapeStarted",
|
|
12529
|
+
"feedScrapeCompleted",
|
|
12530
|
+
"feedScrapeFailed",
|
|
12531
|
+
"jobListingScraped",
|
|
12532
|
+
// Job Sync & Campaign Matching
|
|
12533
|
+
"jobSyncPublished",
|
|
12534
|
+
"jobSyncReceived",
|
|
12535
|
+
"leadsCreatedAndSynced",
|
|
12536
|
+
// Suitability Events
|
|
12537
|
+
"suitabilityPending",
|
|
12538
|
+
"suitabilityProcessing",
|
|
12539
|
+
"suitabilityComplete",
|
|
12540
|
+
"suitabilityFailed",
|
|
12541
|
+
"manualSuitabilityAnalyzed",
|
|
12542
|
+
// Proposal Events
|
|
12543
|
+
"proposalProcessing",
|
|
12544
|
+
"proposalComplete",
|
|
12545
|
+
"proposalFailed",
|
|
12546
|
+
"manualProposalGenerated",
|
|
12547
|
+
// Bidding Events
|
|
12548
|
+
"biddingProcessing",
|
|
12549
|
+
"biddingComplete",
|
|
12550
|
+
"biddingFailed",
|
|
12551
|
+
"biddingSkipped",
|
|
12552
|
+
"biddingPending",
|
|
12553
|
+
"biddingRetry",
|
|
12554
|
+
"biddingInsufficientConnects",
|
|
12555
|
+
"biddingWarningAlert",
|
|
12556
|
+
// System/Generic Events
|
|
12557
|
+
"errorLogged",
|
|
12558
|
+
"cloudTaskRetry",
|
|
12559
|
+
"manualLeadEdited",
|
|
12560
|
+
"leadArchived",
|
|
12561
|
+
"auditTrailLogged",
|
|
12562
|
+
]);
|
|
12563
|
+
const logEventSchema = z.object({
|
|
12564
|
+
// The type of event (use a z.enum if possible)
|
|
12565
|
+
type: LogEventTypeEnum, // e.g. "suitability-failed", "proposal-generated"
|
|
12566
|
+
// The service that triggered the event
|
|
12567
|
+
source: z.string(), // e.g. "lancer-agents", "lancer-bidding"
|
|
12568
|
+
// Optional: Allow logging non-lead events in the future
|
|
12569
|
+
resourceType: z.string().default("lead"), // e.g. "lead", "campaign", "user"
|
|
12570
|
+
// ID of the resource (primary entity affected)
|
|
12571
|
+
resourceId: z.string().nullable(), // fallback if leadId is not applicable
|
|
12572
|
+
// Lead-level metadata
|
|
12573
|
+
organizationId: z.string().nullable(),
|
|
12574
|
+
userId: z.string().nullable(),
|
|
12575
|
+
campaignId: z.string().nullable(),
|
|
12576
|
+
leadId: z.string().nullable(),
|
|
12577
|
+
// Reason or message for the event
|
|
12578
|
+
reason: z.string().nullable(),
|
|
12579
|
+
// Generic metadata (stacktrace, score, raw request, etc.)
|
|
12580
|
+
metadata: z.record(z.unknown()).nullable(),
|
|
12581
|
+
// Optional timestamp override
|
|
12582
|
+
timestamp: z.number(),
|
|
12583
|
+
});
|
|
12584
|
+
const listingScrapedEventMetadata = objectType({
|
|
12585
|
+
listing: jobListingSchema,
|
|
12586
|
+
region: regionSchema,
|
|
12587
|
+
});
|
|
12588
|
+
const jobActivityScrapedEventMetadata = objectType({
|
|
12589
|
+
activity: jobActivitySchema,
|
|
12590
|
+
region: regionSchema,
|
|
12591
|
+
offsetHour: jobActivityOffsetHourSchema,
|
|
12592
|
+
scrapedAt: numberType(),
|
|
12593
|
+
});
|
|
12594
|
+
const jobActivityScrapeFailedEventMetadata = objectType({
|
|
12595
|
+
listing: jobListingSchema,
|
|
12596
|
+
region: regionSchema,
|
|
12597
|
+
offsetHour: jobActivityOffsetHourSchema,
|
|
12598
|
+
});
|
|
12599
|
+
const feedScrapeStartedEventMetadata = objectType({
|
|
12600
|
+
id: stringType(),
|
|
12601
|
+
startTime: numberType(),
|
|
12602
|
+
region: regionSchema,
|
|
12603
|
+
});
|
|
12604
|
+
const feedScrapeCompletedEventMetadata = objectType({
|
|
12605
|
+
id: stringType(),
|
|
12606
|
+
endTime: numberType(),
|
|
12607
|
+
region: regionSchema,
|
|
12608
|
+
accountUsername: stringType(),
|
|
12609
|
+
listings: arrayType(jobListingSchema),
|
|
12610
|
+
});
|
|
12611
|
+
const biddingCompletedEventMetadata = objectType({
|
|
12612
|
+
biddingAmount: numberType(),
|
|
12613
|
+
boosted: booleanType(),
|
|
12614
|
+
boostingAmount: numberType(),
|
|
12615
|
+
});
|
|
12616
|
+
const biddingFailedEventMetadata = objectType({
|
|
12617
|
+
error: z.any(),
|
|
12618
|
+
});
|
|
12619
|
+
const userAccountBiddingExceptionEventMetadata = objectType({
|
|
12620
|
+
errorType: z.enum(["insufficientConnects", "proposalFormWarningAlert"]),
|
|
12621
|
+
context: z.string().optional(),
|
|
12622
|
+
});
|
|
12623
|
+
const lancerBiddingExceptionEventMetadata = objectType({
|
|
12624
|
+
errorType: z.string(),
|
|
12625
|
+
errorMessage: z.string(),
|
|
12626
|
+
context: z.string().optional(),
|
|
12627
|
+
});
|
|
12628
|
+
const leadStatusEventMetadata = objectType({
|
|
12629
|
+
campaignId: stringType(),
|
|
12630
|
+
organizationId: stringType(),
|
|
12631
|
+
leadId: stringType(),
|
|
12632
|
+
userId: stringType(),
|
|
12633
|
+
metadata: z
|
|
12634
|
+
.object({
|
|
12635
|
+
status: leadStatusSchema,
|
|
12636
|
+
proposalId: stringType().nullable(),
|
|
12637
|
+
})
|
|
12638
|
+
.optional(),
|
|
12639
|
+
reason: z.string().optional(),
|
|
12640
|
+
});
|
|
12641
|
+
const suitabilityCompleteEventMetadataSchema = objectType({
|
|
12642
|
+
suitabilityRating: z.number(),
|
|
12643
|
+
suitabilityReason: z.string(),
|
|
12644
|
+
agentStatus: z.string(),
|
|
12645
|
+
model: z.string(),
|
|
12646
|
+
provider: z.string(),
|
|
12647
|
+
promptTokens: z.number(),
|
|
12648
|
+
completionTokens: z.number(),
|
|
12649
|
+
messages: z.array(objectType({
|
|
12650
|
+
role: z.string(),
|
|
12651
|
+
content: z.string(),
|
|
12652
|
+
})),
|
|
12653
|
+
});
|
|
12654
|
+
const suitabilityFailedEventMetadataSchema = objectType({
|
|
12655
|
+
agentStatus: z.string(),
|
|
12656
|
+
reason: z.string(),
|
|
12657
|
+
});
|
|
12658
|
+
const proposalCompleteEventMetadataSchema = objectType({
|
|
12659
|
+
agentStatus: z.string(),
|
|
12660
|
+
proposal: proposalSchema,
|
|
12661
|
+
model: z.string(),
|
|
12662
|
+
provider: z.string(),
|
|
12663
|
+
promptTokens: z.number(),
|
|
12664
|
+
completionTokens: z.number(),
|
|
12665
|
+
messages: z.array(objectType({
|
|
12666
|
+
role: z.string(),
|
|
12667
|
+
content: z.string(),
|
|
12668
|
+
})),
|
|
12669
|
+
});
|
|
12670
|
+
const eventLoggerPayloadSchema = unionType([
|
|
12671
|
+
logEventSchema,
|
|
12672
|
+
arrayType(logEventSchema),
|
|
12673
|
+
]);
|
|
12674
|
+
|
|
12675
|
+
const usageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12676
|
+
"suitabilityComplete",
|
|
12677
|
+
"proposalComplete",
|
|
12678
|
+
"biddingComplete",
|
|
12679
|
+
]);
|
|
12680
|
+
const usageEventMetadataSchema = objectType({
|
|
12681
|
+
campaignId: stringType().nullable(),
|
|
12682
|
+
userId: stringType().nullable(),
|
|
12683
|
+
stripeSubscriptionId: stringType().nullable(),
|
|
12684
|
+
planId: stringType().nullable(),
|
|
12685
|
+
});
|
|
12686
|
+
const usageEventSchema = objectType({
|
|
12687
|
+
organizationId: stringType(),
|
|
12688
|
+
typeId: usageEventTypeEnum,
|
|
12689
|
+
timestamp: numberType(),
|
|
12690
|
+
metadata: usageEventMetadataSchema,
|
|
12833
12691
|
});
|
|
12834
12692
|
|
|
12835
|
-
const
|
|
12836
|
-
|
|
12837
|
-
bidderId: z.string().nullable(),
|
|
12838
|
-
contractorName: z.string().nullable(),
|
|
12839
|
-
specialisedProfile: z.string().nullable(),
|
|
12693
|
+
const billingStripeMetadataSchema = objectType({
|
|
12694
|
+
customer: objectType({ id: stringType().nullable() }),
|
|
12840
12695
|
});
|
|
12841
|
-
const
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12696
|
+
const billingSchema = objectType({
|
|
12697
|
+
savedCard: booleanType(),
|
|
12698
|
+
stripe: billingStripeMetadataSchema,
|
|
12699
|
+
});
|
|
12700
|
+
|
|
12701
|
+
const subscriptionStatusEnum = z.enum([
|
|
12702
|
+
"active",
|
|
12703
|
+
"trialing",
|
|
12704
|
+
"cancelled",
|
|
12705
|
+
"paused",
|
|
12706
|
+
"payment_processing",
|
|
12707
|
+
"payment_pending",
|
|
12708
|
+
"payment_failed",
|
|
12846
12709
|
]);
|
|
12847
|
-
const
|
|
12710
|
+
const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
|
|
12711
|
+
const subscriptionStripeMetadataItemSchema = objectType({
|
|
12712
|
+
id: stringType(),
|
|
12713
|
+
price: objectType({
|
|
12714
|
+
id: stringType(),
|
|
12715
|
+
}),
|
|
12716
|
+
});
|
|
12717
|
+
const subscriptionStripeMetadataSchema = objectType({
|
|
12718
|
+
id: stringType(),
|
|
12719
|
+
items: arrayType(subscriptionStripeMetadataItemSchema),
|
|
12720
|
+
invoice: objectType({
|
|
12721
|
+
id: stringType(),
|
|
12722
|
+
hosted_invoice_url: stringType().nullable(),
|
|
12723
|
+
}),
|
|
12724
|
+
});
|
|
12725
|
+
const subscriptionSchema = objectType({
|
|
12726
|
+
planId: stringType(),
|
|
12727
|
+
pendingPlanId: stringType().nullable(),
|
|
12728
|
+
status: subscriptionStatusEnum,
|
|
12729
|
+
startedAt: numberType(),
|
|
12730
|
+
currentPeriodEnd: numberType(),
|
|
12731
|
+
stripe: subscriptionStripeMetadataSchema,
|
|
12732
|
+
source: subscriptionSourceEnum,
|
|
12733
|
+
usage: recordType(usageEventTypeEnum, numberType()),
|
|
12734
|
+
});
|
|
12735
|
+
|
|
12736
|
+
const coverLetterTemplateSchema = z.object({
|
|
12848
12737
|
id: z.string(),
|
|
12849
12738
|
name: z.string(),
|
|
12850
|
-
|
|
12739
|
+
description: z.string().nullable(),
|
|
12740
|
+
template: z.string(),
|
|
12741
|
+
instructions: z.string(),
|
|
12742
|
+
});
|
|
12743
|
+
const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
|
|
12744
|
+
name: true,
|
|
12745
|
+
template: true,
|
|
12746
|
+
instructions: true,
|
|
12747
|
+
});
|
|
12748
|
+
|
|
12749
|
+
const organizationMemberRoleEnum = z.enum(["admin", "member"]);
|
|
12750
|
+
const organizationMemberSchema = objectType({
|
|
12751
|
+
role: organizationMemberRoleEnum,
|
|
12752
|
+
joinedAt: numberType(),
|
|
12753
|
+
invitedBy: stringType(),
|
|
12754
|
+
});
|
|
12755
|
+
|
|
12756
|
+
const onboardingProgressSchema = z.object({
|
|
12757
|
+
profileSetup: z.boolean(),
|
|
12758
|
+
campaignCreated: z.boolean(),
|
|
12759
|
+
filtersAdded: z.boolean(),
|
|
12760
|
+
automationEnabled: z.boolean(),
|
|
12761
|
+
startCampaign: z.boolean(),
|
|
12762
|
+
});
|
|
12763
|
+
|
|
12764
|
+
const organizationTypeSchema = z.enum(["agency", "freelancer"]);
|
|
12765
|
+
const organizationTierEnum = z.enum(["free", "premium"]);
|
|
12766
|
+
const limitsSchema = objectType({
|
|
12767
|
+
monthlyCredits: numberType(),
|
|
12768
|
+
usedCredits: numberType(),
|
|
12769
|
+
extraCredits: numberType(),
|
|
12770
|
+
});
|
|
12771
|
+
const organizationSchema = objectType({
|
|
12772
|
+
id: stringType(),
|
|
12773
|
+
name: stringType(),
|
|
12774
|
+
type: organizationTypeSchema,
|
|
12775
|
+
associatedBidders: z.array(stringType()).nullable(),
|
|
12776
|
+
subscription: subscriptionSchema.nullable(),
|
|
12777
|
+
active: booleanType(),
|
|
12778
|
+
limits: limitsSchema,
|
|
12779
|
+
billing: billingSchema.nullable(),
|
|
12780
|
+
lastBidTime: numberType().nullable(),
|
|
12851
12781
|
createdAt: numberType(),
|
|
12852
12782
|
updatedAt: numberType(),
|
|
12853
|
-
|
|
12854
|
-
// automatedSuitability: z.boolean().nullable(),
|
|
12855
|
-
boostingEnabled: z.boolean().nullable().default(false),
|
|
12856
|
-
maximumBoost: z.number().nullable().default(30),
|
|
12857
|
-
// minimumBoost: z.number().nullable().default(0),
|
|
12858
|
-
monthlyBudget: z.number().nullable(),
|
|
12859
|
-
// suitabilityThreshold: z.number().min(0).max(100).nullable().default(0),
|
|
12860
|
-
boostingThreshold: z.number().min(0).max(100).nullable().default(0),
|
|
12861
|
-
leadCounts: z.record(leadStatusSchema, z.number()).nullable(),
|
|
12862
|
-
expenses: campaignExpensesSchema,
|
|
12863
|
-
notificationsEnabled: z.boolean().nullable(),
|
|
12864
|
-
webhooks: z.array(campaignWebhookSchema),
|
|
12865
|
-
status: campaignStatusSchema.optional(),
|
|
12866
|
-
bidConfig: bidConfigSchema.nullable(),
|
|
12867
|
-
coverLetterTemplateId: z.string().nullable(),
|
|
12783
|
+
openRouterApiKey: stringType().nullable(),
|
|
12868
12784
|
});
|
|
12869
|
-
const
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12785
|
+
const caseStudySchema = objectType({
|
|
12786
|
+
title: stringType(),
|
|
12787
|
+
description: stringType(),
|
|
12788
|
+
});
|
|
12789
|
+
z.object({
|
|
12790
|
+
type: z.enum(["freelancer", "agency"]),
|
|
12791
|
+
name: z.string(),
|
|
12792
|
+
summary: z.string(),
|
|
12793
|
+
coreServices: z.string(),
|
|
12794
|
+
toolsSkillsTechnologies: z.string(),
|
|
12795
|
+
approach: z.string(),
|
|
12796
|
+
icp: z.string(),
|
|
12797
|
+
projectsTheyAvoid: z.string(),
|
|
12798
|
+
spokenLanguages: z.string(),
|
|
12799
|
+
agencyInfo: z.object({
|
|
12800
|
+
location: z.array(z.string()),
|
|
12801
|
+
website: z.string().url(),
|
|
12802
|
+
teamSize: z.number(),
|
|
12803
|
+
}),
|
|
12804
|
+
caseStudies: z.array(caseStudySchema),
|
|
12805
|
+
});
|
|
12806
|
+
const createOrganizationSchema = organizationSchema.pick({
|
|
12807
|
+
name: true,
|
|
12808
|
+
type: true,
|
|
12809
|
+
});
|
|
12810
|
+
const trackUsageEventTypeEnum = LogEventTypeEnum.extract([
|
|
12811
|
+
"suitabilityComplete",
|
|
12812
|
+
"proposalComplete",
|
|
12813
|
+
"biddingComplete",
|
|
12873
12814
|
]);
|
|
12874
|
-
const
|
|
12875
|
-
|
|
12876
|
-
|
|
12815
|
+
const trackUsagePayloadSchema = objectType({
|
|
12816
|
+
event: usageEventTypeEnum,
|
|
12817
|
+
campaignId: stringType().nullish(),
|
|
12877
12818
|
});
|
|
12878
|
-
const
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
bidConfig: true,
|
|
12819
|
+
const questionRulesSchema = objectType({
|
|
12820
|
+
question: stringType(),
|
|
12821
|
+
answer: stringType(),
|
|
12822
|
+
category: stringType(),
|
|
12883
12823
|
});
|
|
12884
|
-
const
|
|
12885
|
-
.
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
.
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12824
|
+
const aiConfigSchema = objectType({
|
|
12825
|
+
// suitabilityRules: string().nullable(),
|
|
12826
|
+
// coverLetterRules: string().nullable(),
|
|
12827
|
+
// coverLetterTemplate: string().nullable(),
|
|
12828
|
+
questionRules: arrayType(questionRulesSchema).nullable(),
|
|
12829
|
+
// approvedSuitabilityJobs: number().nullable(),
|
|
12830
|
+
// approvedProposalJobs: number().nullable(),
|
|
12831
|
+
});
|
|
12832
|
+
const notificationConfigSchema = objectType({
|
|
12833
|
+
emailEnabled: booleanType(),
|
|
12834
|
+
discordWebhookUrl: stringType().nullable(),
|
|
12835
|
+
slackWebhookUrl: stringType().nullable(),
|
|
12836
|
+
});
|
|
12837
|
+
const organizationSettingsSchema = objectType({
|
|
12838
|
+
aiConfig: aiConfigSchema,
|
|
12839
|
+
});
|
|
12840
|
+
const subscribePayloadSchema = objectType({
|
|
12841
|
+
planId: stringType().min(1, "Plan id is required."),
|
|
12842
|
+
paymentMethodId: stringType().min(1, "Payment method is required."),
|
|
12843
|
+
toltReferral: stringType().optional(),
|
|
12844
|
+
couponCode: stringType().nullish(),
|
|
12895
12845
|
});
|
|
12896
12846
|
|
|
12897
12847
|
const campaignAnalyticsSchema = z.object({
|
|
@@ -13084,6 +13034,57 @@ const invoiceSchema = objectType({
|
|
|
13084
13034
|
updatedAt: numberType(),
|
|
13085
13035
|
});
|
|
13086
13036
|
|
|
13037
|
+
const systemPromptSchema = objectType({
|
|
13038
|
+
suitability: stringType(),
|
|
13039
|
+
proposal: stringType(),
|
|
13040
|
+
questionHandlingGuidelines: stringType(),
|
|
13041
|
+
});
|
|
13042
|
+
const systemSchema = objectType({
|
|
13043
|
+
prompts: systemPromptSchema,
|
|
13044
|
+
});
|
|
13045
|
+
|
|
13046
|
+
const agentTaskRequestSchema = z.object({
|
|
13047
|
+
userId: z.string().nullable(),
|
|
13048
|
+
organizationId: z.string(),
|
|
13049
|
+
campaignId: z.string(),
|
|
13050
|
+
lead: leadSchema,
|
|
13051
|
+
});
|
|
13052
|
+
const testSystemPromptsRequestSchema = z.object({
|
|
13053
|
+
organizationId: z.string(),
|
|
13054
|
+
modelSuitability: z.string(),
|
|
13055
|
+
modelProposal: z.string(),
|
|
13056
|
+
systemPrompt: systemPromptSchema,
|
|
13057
|
+
aiConfig: aiConfigSchema,
|
|
13058
|
+
lead: leadSchema,
|
|
13059
|
+
});
|
|
13060
|
+
const suitabilityRatingSchema = z.object({
|
|
13061
|
+
rating: z.number(),
|
|
13062
|
+
reason: z.string(),
|
|
13063
|
+
});
|
|
13064
|
+
const agentTaskResponseSchema = z.object({
|
|
13065
|
+
result: z.union([suitabilityRatingSchema, proposalSchema]),
|
|
13066
|
+
model: z.string(),
|
|
13067
|
+
provider: z.string(),
|
|
13068
|
+
promptTokens: z.number(),
|
|
13069
|
+
completionTokens: z.number(),
|
|
13070
|
+
});
|
|
13071
|
+
const testSystemPromptsResponseSchema = z.object({
|
|
13072
|
+
proposal: z.object({
|
|
13073
|
+
result: proposalSchema,
|
|
13074
|
+
model: z.string(),
|
|
13075
|
+
provider: z.string(),
|
|
13076
|
+
promptTokens: z.number(),
|
|
13077
|
+
completionTokens: z.number(),
|
|
13078
|
+
}),
|
|
13079
|
+
suitability: z.object({
|
|
13080
|
+
result: suitabilityRatingSchema,
|
|
13081
|
+
model: z.string(),
|
|
13082
|
+
provider: z.string(),
|
|
13083
|
+
promptTokens: z.number(),
|
|
13084
|
+
completionTokens: z.number(),
|
|
13085
|
+
}),
|
|
13086
|
+
});
|
|
13087
|
+
|
|
13087
13088
|
const planStripeMetadataSchema = objectType({
|
|
13088
13089
|
id: stringType().regex(/^prod_[a-zA-Z0-9]+$/),
|
|
13089
13090
|
name: stringType(),
|
|
@@ -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";
|
|
@@ -310,6 +310,7 @@ export declare const leadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<{
|
|
|
310
310
|
}>>>;
|
|
311
311
|
}, {
|
|
312
312
|
jobId: z.ZodString;
|
|
313
|
+
scrapedAt: z.ZodNullable<z.ZodNumber>;
|
|
313
314
|
updatedAt: z.ZodNullable<z.ZodNumber>;
|
|
314
315
|
suitabilityRating: z.ZodNullable<z.ZodNumber>;
|
|
315
316
|
suitabilityReason: z.ZodNullable<z.ZodString>;
|
|
@@ -425,6 +426,7 @@ export declare const leadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<{
|
|
|
425
426
|
} | null;
|
|
426
427
|
activityUpdates: 1 | 2 | 3 | null;
|
|
427
428
|
jobId: string;
|
|
429
|
+
scrapedAt: number | null;
|
|
428
430
|
suitabilityRating: number | null;
|
|
429
431
|
suitabilityReason: string | null;
|
|
430
432
|
proposal: string | null;
|
|
@@ -553,6 +555,7 @@ export declare const leadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<{
|
|
|
553
555
|
} | null;
|
|
554
556
|
activityUpdates: 1 | 2 | 3 | null;
|
|
555
557
|
jobId: string;
|
|
558
|
+
scrapedAt: number | null;
|
|
556
559
|
suitabilityRating: number | null;
|
|
557
560
|
suitabilityReason: string | null;
|
|
558
561
|
proposal: string | null;
|
|
@@ -890,6 +893,7 @@ export declare const leadResponseSchema: z.ZodObject<{
|
|
|
890
893
|
}>>>;
|
|
891
894
|
}, {
|
|
892
895
|
jobId: z.ZodString;
|
|
896
|
+
scrapedAt: z.ZodNullable<z.ZodNumber>;
|
|
893
897
|
updatedAt: z.ZodNullable<z.ZodNumber>;
|
|
894
898
|
suitabilityRating: z.ZodNullable<z.ZodNumber>;
|
|
895
899
|
suitabilityReason: z.ZodNullable<z.ZodString>;
|
|
@@ -1005,6 +1009,7 @@ export declare const leadResponseSchema: z.ZodObject<{
|
|
|
1005
1009
|
} | null;
|
|
1006
1010
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1007
1011
|
jobId: string;
|
|
1012
|
+
scrapedAt: number | null;
|
|
1008
1013
|
suitabilityRating: number | null;
|
|
1009
1014
|
suitabilityReason: string | null;
|
|
1010
1015
|
proposal: string | null;
|
|
@@ -1133,6 +1138,7 @@ export declare const leadResponseSchema: z.ZodObject<{
|
|
|
1133
1138
|
} | null;
|
|
1134
1139
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1135
1140
|
jobId: string;
|
|
1141
|
+
scrapedAt: number | null;
|
|
1136
1142
|
suitabilityRating: number | null;
|
|
1137
1143
|
suitabilityReason: string | null;
|
|
1138
1144
|
proposal: string | null;
|
|
@@ -1266,6 +1272,7 @@ export declare const leadResponseSchema: z.ZodObject<{
|
|
|
1266
1272
|
} | null;
|
|
1267
1273
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1268
1274
|
jobId: string;
|
|
1275
|
+
scrapedAt: number | null;
|
|
1269
1276
|
suitabilityRating: number | null;
|
|
1270
1277
|
suitabilityReason: string | null;
|
|
1271
1278
|
proposal: string | null;
|
|
@@ -1399,6 +1406,7 @@ export declare const leadResponseSchema: z.ZodObject<{
|
|
|
1399
1406
|
} | null;
|
|
1400
1407
|
activityUpdates: 1 | 2 | 3 | null;
|
|
1401
1408
|
jobId: string;
|
|
1409
|
+
scrapedAt: number | null;
|
|
1402
1410
|
suitabilityRating: number | null;
|
|
1403
1411
|
suitabilityReason: string | null;
|
|
1404
1412
|
proposal: string | null;
|
|
@@ -2276,6 +2284,7 @@ export declare const findLeadsResponseSchema: z.ZodObject<{
|
|
|
2276
2284
|
}>>>;
|
|
2277
2285
|
}, {
|
|
2278
2286
|
jobId: z.ZodString;
|
|
2287
|
+
scrapedAt: z.ZodNullable<z.ZodNumber>;
|
|
2279
2288
|
updatedAt: z.ZodNullable<z.ZodNumber>;
|
|
2280
2289
|
suitabilityRating: z.ZodNullable<z.ZodNumber>;
|
|
2281
2290
|
suitabilityReason: z.ZodNullable<z.ZodString>;
|
|
@@ -2391,6 +2400,7 @@ export declare const findLeadsResponseSchema: z.ZodObject<{
|
|
|
2391
2400
|
} | null;
|
|
2392
2401
|
activityUpdates: 1 | 2 | 3 | null;
|
|
2393
2402
|
jobId: string;
|
|
2403
|
+
scrapedAt: number | null;
|
|
2394
2404
|
suitabilityRating: number | null;
|
|
2395
2405
|
suitabilityReason: string | null;
|
|
2396
2406
|
proposal: string | null;
|
|
@@ -2519,6 +2529,7 @@ export declare const findLeadsResponseSchema: z.ZodObject<{
|
|
|
2519
2529
|
} | null;
|
|
2520
2530
|
activityUpdates: 1 | 2 | 3 | null;
|
|
2521
2531
|
jobId: string;
|
|
2532
|
+
scrapedAt: number | null;
|
|
2522
2533
|
suitabilityRating: number | null;
|
|
2523
2534
|
suitabilityReason: string | null;
|
|
2524
2535
|
proposal: string | null;
|
|
@@ -2763,6 +2774,7 @@ export declare const findLeadsResponseSchema: z.ZodObject<{
|
|
|
2763
2774
|
} | null;
|
|
2764
2775
|
activityUpdates: 1 | 2 | 3 | null;
|
|
2765
2776
|
jobId: string;
|
|
2777
|
+
scrapedAt: number | null;
|
|
2766
2778
|
suitabilityRating: number | null;
|
|
2767
2779
|
suitabilityReason: string | null;
|
|
2768
2780
|
proposal: string | null;
|
|
@@ -3007,6 +3019,7 @@ export declare const findLeadsResponseSchema: z.ZodObject<{
|
|
|
3007
3019
|
} | null;
|
|
3008
3020
|
activityUpdates: 1 | 2 | 3 | null;
|
|
3009
3021
|
jobId: string;
|
|
3022
|
+
scrapedAt: number | null;
|
|
3010
3023
|
suitabilityRating: number | null;
|
|
3011
3024
|
suitabilityReason: string | null;
|
|
3012
3025
|
proposal: string | null;
|