@hadoku/resume-bot 3.15.107 → 3.15.109
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/{index-D_yx_ElR.js → index-D6Xd4aSy.js} +226 -47
- package/dist/{node.browser-DSzcmXp_.js → node.browser-Bk9bty0A.js} +2 -2
- package/dist/{node.browser-CdiOmtfD.js → node.browser-CP5wfAdg.js} +1 -1
- package/dist/worker/application-extras.d.ts +7 -0
- package/dist/worker/application-extras.d.ts.map +1 -1
- package/dist/worker/constants.d.ts +7 -0
- package/dist/worker/constants.d.ts.map +1 -1
- package/dist/worker/cover-letter.d.ts.map +1 -1
- package/dist/worker/form-answers.d.ts +38 -0
- package/dist/worker/form-answers.d.ts.map +1 -0
- package/dist/worker/index.d.ts.map +1 -1
- package/dist/worker/job-text.d.ts +21 -0
- package/dist/worker/job-text.d.ts.map +1 -0
- package/dist/worker/llm.d.ts +16 -1
- package/dist/worker/llm.d.ts.map +1 -1
- package/dist/worker/tailored-resume.d.ts.map +1 -1
- package/dist/worker.js +1 -1
- package/package.json +2 -2
|
@@ -15098,8 +15098,10 @@ const SELECTION_BUDGET = {
|
|
|
15098
15098
|
[0, 1e3]
|
|
15099
15099
|
]
|
|
15100
15100
|
};
|
|
15101
|
+
const FULL_JD_MAX_CHARS = 6e4;
|
|
15101
15102
|
const COVER_LETTER_TOKENS = 2048;
|
|
15102
15103
|
const APPLICATION_EXTRAS_TOKENS = 3500;
|
|
15104
|
+
const FORM_ANSWERS_TOKENS = 2500;
|
|
15103
15105
|
const OPERATION_BUDGET_MS = 1e5;
|
|
15104
15106
|
const MIN_ATTEMPT_MS = 3e3;
|
|
15105
15107
|
function kvKey(ip) {
|
|
@@ -29473,7 +29475,7 @@ var rotateRectangle = function(rectangle, borderWidth, degreeAngle) {
|
|
|
29473
29475
|
else
|
|
29474
29476
|
return { x: x - b, y: y - b, width: w, height: h };
|
|
29475
29477
|
};
|
|
29476
|
-
var clip = function() {
|
|
29478
|
+
var clip$1 = function() {
|
|
29477
29479
|
return PDFOperator.of(Ops.ClipNonZero);
|
|
29478
29480
|
};
|
|
29479
29481
|
var cos = Math.cos, sin = Math.sin, tan = Math.tan;
|
|
@@ -30370,7 +30372,7 @@ var drawTextField = function(options) {
|
|
|
30370
30372
|
lineTo(clipX + clipWidth, clipY + clipHeight),
|
|
30371
30373
|
lineTo(clipX + clipWidth, clipY),
|
|
30372
30374
|
closePath(),
|
|
30373
|
-
clip(),
|
|
30375
|
+
clip$1(),
|
|
30374
30376
|
endPath()
|
|
30375
30377
|
];
|
|
30376
30378
|
var background = drawRectangle({
|
|
@@ -30424,7 +30426,7 @@ var drawOptionList = function(options) {
|
|
|
30424
30426
|
lineTo(clipX + clipWidth, clipY + clipHeight),
|
|
30425
30427
|
lineTo(clipX + clipWidth, clipY),
|
|
30426
30428
|
closePath(),
|
|
30427
|
-
clip(),
|
|
30429
|
+
clip$1(),
|
|
30428
30430
|
endPath()
|
|
30429
30431
|
];
|
|
30430
30432
|
var background = drawRectangle({
|
|
@@ -48514,7 +48516,7 @@ var EnvironmentWorker = /* @__PURE__ */ (() => {
|
|
|
48514
48516
|
const ctrl = new AbortController();
|
|
48515
48517
|
const detachExternal = linkAbort(externalSignal, ctrl);
|
|
48516
48518
|
const lease = new Lease(ctrl);
|
|
48517
|
-
const agentToolset = await import("./node.browser-
|
|
48519
|
+
const agentToolset = await import("./node.browser-Bk9bty0A.js");
|
|
48518
48520
|
let leaseTtlMs;
|
|
48519
48521
|
let runner;
|
|
48520
48522
|
const heartbeatPromise = heartbeatLoop(sessionClient, work, lease, log, this.requestOptions, (ttlMs) => {
|
|
@@ -65143,7 +65145,7 @@ function redactSensitive(body) {
|
|
|
65143
65145
|
async function checkCredentialsFileSafety(path2, onWarn = (m) => console.warn(`anthropic-sdk: ${m}`)) {
|
|
65144
65146
|
if (typeof process === "undefined" || process.platform === "win32")
|
|
65145
65147
|
return;
|
|
65146
|
-
const { fs } = await import("./node.browser-
|
|
65148
|
+
const { fs } = await import("./node.browser-CP5wfAdg.js");
|
|
65147
65149
|
let resolved = path2;
|
|
65148
65150
|
let st;
|
|
65149
65151
|
try {
|
|
@@ -65164,7 +65166,7 @@ async function checkCredentialsFileSafety(path2, onWarn = (m) => console.warn(`a
|
|
|
65164
65166
|
}
|
|
65165
65167
|
}
|
|
65166
65168
|
async function writeCredentialsFileAtomic(targetPath, data) {
|
|
65167
|
-
const { fs, path: path2 } = await import("./node.browser-
|
|
65169
|
+
const { fs, path: path2 } = await import("./node.browser-CP5wfAdg.js");
|
|
65168
65170
|
const dir = path2.dirname(targetPath);
|
|
65169
65171
|
await fs.promises.mkdir(dir, { recursive: true, mode: 448 });
|
|
65170
65172
|
const tmpPath = `${targetPath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
@@ -65383,7 +65385,7 @@ const loadConfigWithSource = async (profile) => {
|
|
|
65383
65385
|
return null;
|
|
65384
65386
|
}
|
|
65385
65387
|
validateProfileName(profileName);
|
|
65386
|
-
const { fs, path: path2 } = await import("./node.browser-
|
|
65388
|
+
const { fs, path: path2 } = await import("./node.browser-CP5wfAdg.js");
|
|
65387
65389
|
const configPath = path2.join(rootConfigPath, "configs", `${profileName}.json`);
|
|
65388
65390
|
let configRaw;
|
|
65389
65391
|
try {
|
|
@@ -65444,14 +65446,14 @@ const getCredentialsPath = async (config2, profile) => {
|
|
|
65444
65446
|
return null;
|
|
65445
65447
|
}
|
|
65446
65448
|
validateProfileName(profileName);
|
|
65447
|
-
const { path: path2 } = await import("./node.browser-
|
|
65449
|
+
const { path: path2 } = await import("./node.browser-CP5wfAdg.js");
|
|
65448
65450
|
return path2.join(rootConfigPath, "credentials", `${profileName}.json`);
|
|
65449
65451
|
};
|
|
65450
65452
|
const getRootConfigPath = async () => {
|
|
65451
65453
|
if (!supportsLocalConfigFiles()) {
|
|
65452
65454
|
return null;
|
|
65453
65455
|
}
|
|
65454
|
-
const { path: path2 } = await import("./node.browser-
|
|
65456
|
+
const { path: path2 } = await import("./node.browser-CP5wfAdg.js");
|
|
65455
65457
|
const configDir = readEnv("ANTHROPIC_CONFIG_DIR");
|
|
65456
65458
|
if (configDir) {
|
|
65457
65459
|
return configDir;
|
|
@@ -65491,7 +65493,7 @@ const getActiveProfileName = async () => {
|
|
|
65491
65493
|
if (profileName) {
|
|
65492
65494
|
return profileName;
|
|
65493
65495
|
}
|
|
65494
|
-
const { fs, path: path2 } = await import("./node.browser-
|
|
65496
|
+
const { fs, path: path2 } = await import("./node.browser-CP5wfAdg.js");
|
|
65495
65497
|
const filePath = path2.join(rootConfigPath, "active_config");
|
|
65496
65498
|
try {
|
|
65497
65499
|
return (await fs.promises.readFile(filePath, "utf-8")).trim() || "default";
|
|
@@ -65507,7 +65509,7 @@ function identityTokenFromFile(path2) {
|
|
|
65507
65509
|
throw new AnthropicError("Identity token file path is empty");
|
|
65508
65510
|
}
|
|
65509
65511
|
return async () => {
|
|
65510
|
-
const { fs } = await import("./node.browser-
|
|
65512
|
+
const { fs } = await import("./node.browser-CP5wfAdg.js");
|
|
65511
65513
|
let content;
|
|
65512
65514
|
try {
|
|
65513
65515
|
content = await fs.promises.readFile(path2, "utf-8");
|
|
@@ -65586,7 +65588,7 @@ function oidcFederationProvider(config2) {
|
|
|
65586
65588
|
}
|
|
65587
65589
|
function userOAuthProvider(config2) {
|
|
65588
65590
|
return async (opts) => {
|
|
65589
|
-
const { fs } = await import("./node.browser-
|
|
65591
|
+
const { fs } = await import("./node.browser-CP5wfAdg.js");
|
|
65590
65592
|
await checkCredentialsFileSafety(config2.credentialsPath, config2.onSafetyWarning);
|
|
65591
65593
|
let raw;
|
|
65592
65594
|
try {
|
|
@@ -65753,7 +65755,7 @@ function resolveIdentityTokenProvider(auth) {
|
|
|
65753
65755
|
}
|
|
65754
65756
|
function cachedExchangeProvider(exchange, credentialsPath, onCacheWriteError, onSafetyWarning) {
|
|
65755
65757
|
return async (opts) => {
|
|
65756
|
-
const { fs } = await import("./node.browser-
|
|
65758
|
+
const { fs } = await import("./node.browser-CP5wfAdg.js");
|
|
65757
65759
|
await checkCredentialsFileSafety(credentialsPath, onSafetyWarning);
|
|
65758
65760
|
let existing;
|
|
65759
65761
|
try {
|
|
@@ -67178,6 +67180,9 @@ function openAIProvider(name, model, client) {
|
|
|
67178
67180
|
name,
|
|
67179
67181
|
model,
|
|
67180
67182
|
attemptTimeoutMs: REQUEST_TIMEOUT_MS,
|
|
67183
|
+
// Every free tier gets the strictest one's ceiling (Groq's), as every
|
|
67184
|
+
// prompt here was sized before providers carried their own.
|
|
67185
|
+
requestTokenLimit: SELECTION_BUDGET.MAX_REQUEST_TOKENS,
|
|
67181
67186
|
async complete(messages2, req) {
|
|
67182
67187
|
const response = await client.chat.completions.create(
|
|
67183
67188
|
{ model, messages: messages2, temperature: req.temperature, max_tokens: req.maxTokens },
|
|
@@ -67227,7 +67232,8 @@ async function callProvider(provider, messages2, options, retryOnRateLimit) {
|
|
|
67227
67232
|
);
|
|
67228
67233
|
}
|
|
67229
67234
|
try {
|
|
67230
|
-
|
|
67235
|
+
const built = typeof messages2 === "function" ? messages2(provider) : messages2;
|
|
67236
|
+
return await provider.complete(built, {
|
|
67231
67237
|
maxTokens: options?.maxTokens ?? LLM_CONFIG.MAX_TOKENS,
|
|
67232
67238
|
temperature: options?.temperature ?? LLM_CONFIG.TEMPERATURE,
|
|
67233
67239
|
timeoutMs: Math.min(provider.attemptTimeoutMs, left)
|
|
@@ -67274,7 +67280,50 @@ async function sendChatCompletion(chain, messages2, options) {
|
|
|
67274
67280
|
}
|
|
67275
67281
|
throw new Error(`All LLM providers failed: ${failures.join("; ")}`);
|
|
67276
67282
|
}
|
|
67277
|
-
const
|
|
67283
|
+
const ENTITIES = {
|
|
67284
|
+
amp: "&",
|
|
67285
|
+
lt: "<",
|
|
67286
|
+
gt: ">",
|
|
67287
|
+
quot: '"',
|
|
67288
|
+
apos: "'",
|
|
67289
|
+
nbsp: " ",
|
|
67290
|
+
rsquo: "'",
|
|
67291
|
+
lsquo: "'",
|
|
67292
|
+
rdquo: '"',
|
|
67293
|
+
ldquo: '"',
|
|
67294
|
+
hellip: "...",
|
|
67295
|
+
mdash: "-",
|
|
67296
|
+
ndash: "-",
|
|
67297
|
+
bull: "-",
|
|
67298
|
+
middot: "-",
|
|
67299
|
+
trade: "(TM)",
|
|
67300
|
+
reg: "(R)",
|
|
67301
|
+
copy: "(C)"
|
|
67302
|
+
};
|
|
67303
|
+
function decodeEntities(s) {
|
|
67304
|
+
return s.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (whole, name) => {
|
|
67305
|
+
if (name[0] === "#") {
|
|
67306
|
+
const code = name[1] === "x" || name[1] === "X" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
|
|
67307
|
+
return Number.isFinite(code) && code > 0 && code <= 1114111 ? String.fromCodePoint(code) : whole;
|
|
67308
|
+
}
|
|
67309
|
+
return ENTITIES[name.toLowerCase()] ?? whole;
|
|
67310
|
+
});
|
|
67311
|
+
}
|
|
67312
|
+
function jobText(description) {
|
|
67313
|
+
const html = /<\/?[a-z]/i.test(description) ? decodeEntities(description) : description;
|
|
67314
|
+
const text = html.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi, "").replace(/<li\b[^>]*>/gi, "\n- ").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|ul|ol|h[1-6]|tr|section|blockquote)>/gi, "\n").replace(/<[^>]+>/g, "");
|
|
67315
|
+
return decodeEntities(text).replace(/[ \t\f\v\u00a0]+/g, " ").replace(/ *\n */g, "\n").replace(/\n{3,}/g, "\n\n").replace(/\n\n(?=- )/g, "\n").trim();
|
|
67316
|
+
}
|
|
67317
|
+
function postingCharsFor(provider, promptChars, maxTokens) {
|
|
67318
|
+
if (provider.requestTokenLimit === void 0) return FULL_JD_MAX_CHARS;
|
|
67319
|
+
const left = (provider.requestTokenLimit - maxTokens) * SELECTION_BUDGET.CHARS_PER_TOKEN - promptChars;
|
|
67320
|
+
return Math.max(0, Math.min(FULL_JD_MAX_CHARS, Math.floor(left)));
|
|
67321
|
+
}
|
|
67322
|
+
function clip(posting, chars2) {
|
|
67323
|
+
return posting.length > chars2 ? `${posting.slice(0, chars2)}…` : posting;
|
|
67324
|
+
}
|
|
67325
|
+
const POSTING_INSTRUCTIONS_RULE = "If the posting asks applicants to do something specific in their application (mention a particular word or phrase, answer a question, follow a format), do it, naturally, in the cover letter and in the answers about why the candidate is applying.";
|
|
67326
|
+
const CACHE_TTL_SECONDS$3 = 2592e3;
|
|
67278
67327
|
function stripCodeFence(text) {
|
|
67279
67328
|
const trimmed = text.trim();
|
|
67280
67329
|
const match2 = /^```[^\n]*\n([\s\S]*)\n```$/.exec(trimmed);
|
|
@@ -67284,6 +67333,9 @@ async function generateTailoredResume(client, kv, req, deadline = Date.now() + O
|
|
|
67284
67333
|
const { job_title, company, description, profile_type, tailor = true } = req;
|
|
67285
67334
|
const key = await cacheKey(
|
|
67286
67335
|
"resume:tailored",
|
|
67336
|
+
// Résumés cached before the whole posting was read were tailored to a
|
|
67337
|
+
// 1-2.5k-character slice of its HTML; a new key retires them.
|
|
67338
|
+
"full-posting",
|
|
67287
67339
|
job_title,
|
|
67288
67340
|
company,
|
|
67289
67341
|
description,
|
|
@@ -67300,7 +67352,8 @@ async function generateTailoredResume(client, kv, req, deadline = Date.now() + O
|
|
|
67300
67352
|
throw new Error("No resume blocks found in KV storage");
|
|
67301
67353
|
}
|
|
67302
67354
|
const truncate = (s, max) => s.length > max ? `${s.slice(0, max)}…` : s;
|
|
67303
|
-
const
|
|
67355
|
+
const posting = jobText(description);
|
|
67356
|
+
const buildPrompt = (snippetChars, jdForSelection) => {
|
|
67304
67357
|
const blockSummaries = blocks.map(
|
|
67305
67358
|
(b) => `ID: ${b.id}
|
|
67306
67359
|
Type: ${b.type}
|
|
@@ -67309,7 +67362,6 @@ Title: ${b.title}` + (snippetChars > 0 ? `
|
|
|
67309
67362
|
---
|
|
67310
67363
|
${truncate(b.content, snippetChars)}` : "")
|
|
67311
67364
|
).join("\n\n");
|
|
67312
|
-
const jdForSelection = truncate(description, jdChars);
|
|
67313
67365
|
const profileHint = profile_type ? `
|
|
67314
67366
|
Profile preference: "${profile_type}" — prefer blocks tagged with this, but include cross-tag blocks where genuinely relevant (e.g. a Staff ML role will usually want a leadership block too).` : "";
|
|
67315
67367
|
return `You are assembling a tailored resume for a job application. Select the most relevant resume blocks and return their IDs in the order they should appear.${profileHint}
|
|
@@ -67333,22 +67385,24 @@ Rules:
|
|
|
67333
67385
|
- Never select a rollup block AND its constituent detail blocks together; their bullets would duplicate.
|
|
67334
67386
|
- Respond with ONLY a valid JSON array of block IDs, nothing else. Example: ["header", "exp_microsoft_se2", "skills_ml"]`;
|
|
67335
67387
|
};
|
|
67336
|
-
const {
|
|
67388
|
+
const { CHARS_PER_TOKEN, LADDER } = SELECTION_BUDGET;
|
|
67337
67389
|
const estimateTokens = (s) => Math.ceil(s.length / CHARS_PER_TOKEN);
|
|
67338
|
-
const
|
|
67339
|
-
|
|
67340
|
-
|
|
67341
|
-
|
|
67342
|
-
|
|
67343
|
-
|
|
67344
|
-
|
|
67390
|
+
const selectionFor = (provider) => {
|
|
67391
|
+
const limit2 = provider.requestTokenLimit;
|
|
67392
|
+
if (limit2 === void 0)
|
|
67393
|
+
return buildPrompt(LADDER[0][0], clip(posting, postingCharsFor(provider, 0, 0)));
|
|
67394
|
+
let prompt = "";
|
|
67395
|
+
for (const [snippetChars, jdChars] of LADDER) {
|
|
67396
|
+
prompt = buildPrompt(snippetChars, clip(posting, jdChars));
|
|
67397
|
+
if (estimateTokens(prompt) + TAILORED_RESUME_TOKENS.SELECTION <= limit2) return prompt;
|
|
67398
|
+
}
|
|
67345
67399
|
throw new Error(
|
|
67346
|
-
`
|
|
67400
|
+
`selection prompt cannot fit the ${limit2}-token request ceiling even without snippets (${estimateTokens(prompt)} est. tokens; the palette has ${blocks.length} blocks)`
|
|
67347
67401
|
);
|
|
67348
|
-
}
|
|
67402
|
+
};
|
|
67349
67403
|
const selectionResponse = await sendChatCompletion(
|
|
67350
67404
|
client,
|
|
67351
|
-
[{ role: "user", content:
|
|
67405
|
+
(provider) => [{ role: "user", content: selectionFor(provider) }],
|
|
67352
67406
|
{ maxTokens: TAILORED_RESUME_TOKENS.SELECTION, temperature: 0.1, deadline }
|
|
67353
67407
|
);
|
|
67354
67408
|
let selectedIds;
|
|
@@ -67432,15 +67486,20 @@ Resume to tailor:
|
|
|
67432
67486
|
${resumeMarkdown}
|
|
67433
67487
|
|
|
67434
67488
|
Return only the full rewritten resume markdown, no preamble or explanation.`;
|
|
67435
|
-
const
|
|
67436
|
-
const
|
|
67437
|
-
const jdChars = Math.
|
|
67489
|
+
const promptChars = buildTailoringPrompt("").length;
|
|
67490
|
+
const jdCharsFor = (provider) => postingCharsFor(provider, promptChars, TAILORED_RESUME_TOKENS.TAILORING);
|
|
67491
|
+
const jdChars = Math.max(0, ...client.map(jdCharsFor));
|
|
67438
67492
|
const timeLeft = deadline - Date.now();
|
|
67439
67493
|
if (jdChars >= 500 && timeLeft >= MIN_ATTEMPT_MS) {
|
|
67440
67494
|
try {
|
|
67441
67495
|
const tailoredResponse = await sendChatCompletion(
|
|
67442
67496
|
client,
|
|
67443
|
-
|
|
67497
|
+
(provider) => {
|
|
67498
|
+
const chars2 = jdCharsFor(provider);
|
|
67499
|
+
if (chars2 < 500)
|
|
67500
|
+
throw new Error(`the résumé leaves ${chars2} characters for the posting`);
|
|
67501
|
+
return [{ role: "user", content: buildTailoringPrompt(clip(posting, chars2)) }];
|
|
67502
|
+
},
|
|
67444
67503
|
{ maxTokens: TAILORED_RESUME_TOKENS.TAILORING, deadline }
|
|
67445
67504
|
);
|
|
67446
67505
|
const tailored = normalizeTypography(stripCodeFence(tailoredResponse.message));
|
|
@@ -67456,20 +67515,21 @@ Return only the full rewritten resume markdown, no preamble or explanation.`;
|
|
|
67456
67515
|
blocks_used: selectedIds,
|
|
67457
67516
|
cached: false
|
|
67458
67517
|
};
|
|
67459
|
-
await kv.put(key, JSON.stringify(result), { expirationTtl: CACHE_TTL_SECONDS$
|
|
67518
|
+
await kv.put(key, JSON.stringify(result), { expirationTtl: CACHE_TTL_SECONDS$3 });
|
|
67460
67519
|
return result;
|
|
67461
67520
|
}
|
|
67462
|
-
const CACHE_TTL_SECONDS$
|
|
67521
|
+
const CACHE_TTL_SECONDS$2 = 2592e3;
|
|
67463
67522
|
async function generateCoverLetter(client, kv, resumeContent, req, deadline = Date.now() + OPERATION_BUDGET_MS) {
|
|
67464
67523
|
const { job_title, company, description, tone = "conversational" } = req;
|
|
67465
|
-
const key = await cacheKey("resume:coverletter", job_title, company, description);
|
|
67524
|
+
const key = await cacheKey("resume:coverletter", "full-posting", job_title, company, description);
|
|
67466
67525
|
const hit = await kv.get(key);
|
|
67467
67526
|
if (hit) {
|
|
67468
67527
|
const result2 = JSON.parse(hit);
|
|
67469
67528
|
return { ...result2, cached: true };
|
|
67470
67529
|
}
|
|
67471
67530
|
const toneGuidance = tone === "formal" ? "Use formal, professional language throughout." : "Use a conversational but professional tone — confident, direct, and human. Avoid stiff corporate phrasing.";
|
|
67472
|
-
const
|
|
67531
|
+
const posting = jobText(description);
|
|
67532
|
+
const buildPrompt = (jd) => `Write a tailored cover letter for a job application. ${toneGuidance}
|
|
67473
67533
|
|
|
67474
67534
|
Structure: exactly 3 paragraphs:
|
|
67475
67535
|
1. Why this company specifically — reference something genuine about their work, mission, or the role itself
|
|
@@ -67478,15 +67538,26 @@ Structure: exactly 3 paragraphs:
|
|
|
67478
67538
|
|
|
67479
67539
|
Job: ${job_title} at ${company}
|
|
67480
67540
|
Job Description:
|
|
67481
|
-
${
|
|
67541
|
+
${jd}
|
|
67482
67542
|
|
|
67483
67543
|
My Resume:
|
|
67484
67544
|
${resumeContent}
|
|
67485
67545
|
|
|
67486
67546
|
Never use em dashes anywhere; use commas, colons, or hyphens instead.
|
|
67487
67547
|
|
|
67548
|
+
${POSTING_INSTRUCTIONS_RULE}
|
|
67549
|
+
|
|
67488
67550
|
Return only the cover letter in markdown, no preamble or explanation.`;
|
|
67489
|
-
const
|
|
67551
|
+
const promptChars = buildPrompt("").length;
|
|
67552
|
+
const messages2 = (provider) => [
|
|
67553
|
+
{
|
|
67554
|
+
role: "user",
|
|
67555
|
+
content: buildPrompt(
|
|
67556
|
+
clip(posting, postingCharsFor(provider, promptChars, COVER_LETTER_TOKENS))
|
|
67557
|
+
)
|
|
67558
|
+
}
|
|
67559
|
+
];
|
|
67560
|
+
const response = await sendChatCompletion(client, messages2, {
|
|
67490
67561
|
maxTokens: COVER_LETTER_TOKENS,
|
|
67491
67562
|
deadline
|
|
67492
67563
|
});
|
|
@@ -67494,7 +67565,7 @@ Return only the cover letter in markdown, no preamble or explanation.`;
|
|
|
67494
67565
|
cover_letter_markdown: normalizeTypography(stripCodeFence(response.message)),
|
|
67495
67566
|
cached: false
|
|
67496
67567
|
};
|
|
67497
|
-
await kv.put(key, JSON.stringify(result), { expirationTtl: CACHE_TTL_SECONDS$
|
|
67568
|
+
await kv.put(key, JSON.stringify(result), { expirationTtl: CACHE_TTL_SECONDS$2 });
|
|
67498
67569
|
return result;
|
|
67499
67570
|
}
|
|
67500
67571
|
const CONTACT_KEY = "resume:profile:contact";
|
|
@@ -67514,8 +67585,7 @@ function renderStandardFields(p) {
|
|
|
67514
67585
|
`Relocation: ${p.relocation}`
|
|
67515
67586
|
].join("\n");
|
|
67516
67587
|
}
|
|
67517
|
-
const CACHE_TTL_SECONDS = 2592e3;
|
|
67518
|
-
const JD_CHARS = 3e3;
|
|
67588
|
+
const CACHE_TTL_SECONDS$1 = 2592e3;
|
|
67519
67589
|
const RESUME_CHARS = 4e3;
|
|
67520
67590
|
function cap(s, n) {
|
|
67521
67591
|
return s.length > n ? `${s.slice(0, n)}…` : s;
|
|
@@ -67529,6 +67599,9 @@ async function generateApplicationExtras(client, kv, req) {
|
|
|
67529
67599
|
const standard_fields = renderStandardFields(contact);
|
|
67530
67600
|
const key = await cacheKey(
|
|
67531
67601
|
"resume:extras",
|
|
67602
|
+
// Kits cached before the whole posting was read were written from its first
|
|
67603
|
+
// 3,000 characters; a new key retires them rather than serving them 30 days.
|
|
67604
|
+
"full-posting",
|
|
67532
67605
|
job_title,
|
|
67533
67606
|
company,
|
|
67534
67607
|
description,
|
|
@@ -67541,7 +67614,8 @@ async function generateApplicationExtras(client, kv, req) {
|
|
|
67541
67614
|
const cachedExtras = JSON.parse(hit);
|
|
67542
67615
|
return { ...cachedExtras, standard_fields, contact, cached: true };
|
|
67543
67616
|
}
|
|
67544
|
-
const
|
|
67617
|
+
const posting = jobText(description);
|
|
67618
|
+
const buildPrompt = (jd) => `You are preparing everything a candidate needs to apply for a job, besides the résumé itself — including the cover letter. Produce it as one JSON object.
|
|
67545
67619
|
|
|
67546
67620
|
Candidate facts (use verbatim where relevant — never invent or contradict these):
|
|
67547
67621
|
- Name: ${contact.name}
|
|
@@ -67556,7 +67630,7 @@ Job location: ${job_location || "not stated in the posting"} (workplace type: ${
|
|
|
67556
67630
|
Location rule: every location-related statement in the kit — cover letter, screening answers, availability — must be consistent with THIS job's location/workplace type above and the candidate's relocation/remote stance. If the job is hybrid or onsite outside the candidate's area, address it honestly using the relocation fact (e.g. openness to relocation or the stated remote preference); never imply the candidate is local to the job's city unless their location fact says so, and never answer as if the job were remote when it isn't.
|
|
67557
67631
|
|
|
67558
67632
|
Job description:
|
|
67559
|
-
${
|
|
67633
|
+
${jd}
|
|
67560
67634
|
|
|
67561
67635
|
The candidate's tailored résumé for this role:
|
|
67562
67636
|
${cap(resume_markdown, RESUME_CHARS)}
|
|
@@ -67581,8 +67655,19 @@ Return ONLY a JSON object with exactly these keys, no preamble, no markdown fenc
|
|
|
67581
67655
|
"talking_points": ["3 to 5 short bullets for a recruiter phone screen — concrete, résumé-grounded strengths for THIS role."]
|
|
67582
67656
|
}
|
|
67583
67657
|
|
|
67584
|
-
Keep every answer truthful to the résumé and the candidate facts. Do not fabricate employers, dates, or metrics
|
|
67585
|
-
|
|
67658
|
+
Keep every answer truthful to the résumé and the candidate facts. Do not fabricate employers, dates, or metrics.
|
|
67659
|
+
|
|
67660
|
+
${POSTING_INSTRUCTIONS_RULE}`;
|
|
67661
|
+
const promptChars = buildPrompt("").length;
|
|
67662
|
+
const messages2 = (provider) => [
|
|
67663
|
+
{
|
|
67664
|
+
role: "user",
|
|
67665
|
+
content: buildPrompt(
|
|
67666
|
+
clip(posting, postingCharsFor(provider, promptChars, APPLICATION_EXTRAS_TOKENS))
|
|
67667
|
+
)
|
|
67668
|
+
}
|
|
67669
|
+
];
|
|
67670
|
+
const response = await sendChatCompletion(client, messages2, {
|
|
67586
67671
|
maxTokens: APPLICATION_EXTRAS_TOKENS,
|
|
67587
67672
|
temperature: 0.5,
|
|
67588
67673
|
// Without one, a wait for a rate limit has no ceiling but the edge's 120s.
|
|
@@ -67608,9 +67693,94 @@ Keep every answer truthful to the résumé and the candidate facts. Do not fabri
|
|
|
67608
67693
|
linkedin_note: typeof parsed.linkedin_note === "string" ? clean(parsed.linkedin_note).slice(0, 300) : "",
|
|
67609
67694
|
talking_points: Array.isArray(parsed.talking_points) ? parsed.talking_points.filter((x) => typeof x === "string").map(clean) : []
|
|
67610
67695
|
};
|
|
67611
|
-
await kv.put(key, JSON.stringify(extras), { expirationTtl: CACHE_TTL_SECONDS });
|
|
67696
|
+
await kv.put(key, JSON.stringify(extras), { expirationTtl: CACHE_TTL_SECONDS$1 });
|
|
67612
67697
|
return { ...extras, standard_fields, contact, cached: false };
|
|
67613
67698
|
}
|
|
67699
|
+
const MAX_FORM_QUESTIONS = 25;
|
|
67700
|
+
const MAX_QUESTION_CHARS = 500;
|
|
67701
|
+
const CACHE_TTL_SECONDS = 2592e3;
|
|
67702
|
+
async function generateFormAnswers(client, kv, input, deadline = Date.now() + OPERATION_BUDGET_MS) {
|
|
67703
|
+
const { job_title, company, description, resume_markdown, contact, questions } = input;
|
|
67704
|
+
const key = await cacheKey(
|
|
67705
|
+
"resume:form-answers",
|
|
67706
|
+
job_title,
|
|
67707
|
+
company,
|
|
67708
|
+
description,
|
|
67709
|
+
resume_markdown,
|
|
67710
|
+
JSON.stringify(contact),
|
|
67711
|
+
input.job_location ?? "",
|
|
67712
|
+
input.workplace_type ?? "",
|
|
67713
|
+
JSON.stringify(questions)
|
|
67714
|
+
);
|
|
67715
|
+
const hit = await kv.get(key);
|
|
67716
|
+
if (hit) return JSON.parse(hit);
|
|
67717
|
+
const posting = jobText(description);
|
|
67718
|
+
const numbered = questions.map((q, i) => `${i + 1}. ${q}`).join("\n");
|
|
67719
|
+
const buildPrompt = (jd) => `You are filling in the free-text questions on ${contact.name}'s application for a job. Answer as the candidate, in the first person.
|
|
67720
|
+
|
|
67721
|
+
Candidate facts (use verbatim where relevant; never invent or contradict these):
|
|
67722
|
+
- Name: ${contact.name}
|
|
67723
|
+
- Location: ${contact.location}
|
|
67724
|
+
- Work authorization: ${contact.work_auth}
|
|
67725
|
+
- Relocation / remote: ${contact.relocation}
|
|
67726
|
+
- Target compensation: ${contact.salary_line}
|
|
67727
|
+
|
|
67728
|
+
Job: ${job_title} at ${company}
|
|
67729
|
+
Job location: ${input.job_location || "not stated in the posting"} (workplace type: ${input.workplace_type || "not stated"})
|
|
67730
|
+
|
|
67731
|
+
The full job posting:
|
|
67732
|
+
${jd}
|
|
67733
|
+
|
|
67734
|
+
The candidate's tailored résumé for this role:
|
|
67735
|
+
${resume_markdown}
|
|
67736
|
+
|
|
67737
|
+
The application form's questions:
|
|
67738
|
+
${numbered}
|
|
67739
|
+
|
|
67740
|
+
Rules:
|
|
67741
|
+
- Answer each question directly. A question asking for detail gets 2-5 sentences grounded in the résumé; a short factual question gets a short answer.
|
|
67742
|
+
- Keep everything truthful to the résumé and the candidate facts. Never invent employers, dates, metrics, people or events.
|
|
67743
|
+
- Asked who referred the candidate, or anything about a person: there is no referral, so answer the way the question says to when there is none (for example "N/A"), or "No" if it gives no such instruction.
|
|
67744
|
+
- Asked how the candidate heard about the job: they found the posting while searching for roles. Never name a website, event or person.
|
|
67745
|
+
- Asked for a fact you do not have (an address, a date, a number not in the résumé, a link not given above): return an empty string for that answer. The candidate will answer it themselves.
|
|
67746
|
+
- ${POSTING_INSTRUCTIONS_RULE} When the posting asks applicants to mention something, put it in the answer about why they are applying, or the closest fit.
|
|
67747
|
+
- Never use em dashes; use commas, colons, or hyphens instead.
|
|
67748
|
+
|
|
67749
|
+
Return ONLY a JSON object, no preamble and no markdown fence, with one answer per question in the same order:
|
|
67750
|
+
{"answers": ["answer to question 1", "answer to question 2"]}`;
|
|
67751
|
+
const promptChars = buildPrompt("").length;
|
|
67752
|
+
const messages2 = (provider) => [
|
|
67753
|
+
{
|
|
67754
|
+
role: "user",
|
|
67755
|
+
content: buildPrompt(
|
|
67756
|
+
clip(posting, postingCharsFor(provider, promptChars, FORM_ANSWERS_TOKENS))
|
|
67757
|
+
)
|
|
67758
|
+
}
|
|
67759
|
+
];
|
|
67760
|
+
const response = await sendChatCompletion(client, messages2, {
|
|
67761
|
+
maxTokens: FORM_ANSWERS_TOKENS,
|
|
67762
|
+
temperature: 0.4,
|
|
67763
|
+
deadline
|
|
67764
|
+
});
|
|
67765
|
+
let parsed;
|
|
67766
|
+
try {
|
|
67767
|
+
parsed = JSON.parse(stripCodeFence(response.message));
|
|
67768
|
+
} catch {
|
|
67769
|
+
throw new Error(`Form answers returned unparseable response: ${response.message.slice(0, 300)}`);
|
|
67770
|
+
}
|
|
67771
|
+
const raw = Array.isArray(parsed.answers) ? parsed.answers : [];
|
|
67772
|
+
const answers = questions.map((q, i) => ({
|
|
67773
|
+
q,
|
|
67774
|
+
a: typeof raw[i] === "string" ? normalizeTypography(raw[i]).trim() : ""
|
|
67775
|
+
}));
|
|
67776
|
+
await kv.put(key, JSON.stringify(answers), { expirationTtl: CACHE_TTL_SECONDS });
|
|
67777
|
+
return answers;
|
|
67778
|
+
}
|
|
67779
|
+
function readQuestions(value) {
|
|
67780
|
+
if (!Array.isArray(value)) return void 0;
|
|
67781
|
+
const questions = value.filter((q) => typeof q === "string" && q.trim() !== "").map((q) => q.trim().slice(0, MAX_QUESTION_CHARS)).slice(0, MAX_FORM_QUESTIONS);
|
|
67782
|
+
return questions.length ? questions : void 0;
|
|
67783
|
+
}
|
|
67614
67784
|
const VARIANT_PREFIX = "resume:variant:";
|
|
67615
67785
|
function randomSlug() {
|
|
67616
67786
|
const bytes = new Uint8Array(9);
|
|
@@ -68151,8 +68321,17 @@ function createResumeHandler(basePath, options = {}) {
|
|
|
68151
68321
|
}
|
|
68152
68322
|
try {
|
|
68153
68323
|
const client = createLLMClient(c.env, deferTo(c));
|
|
68324
|
+
const deadline = Date.now() + OPERATION_BUDGET_MS;
|
|
68154
68325
|
const result = await generateApplicationExtras(client, c.env.CONTENT_KV, body);
|
|
68155
|
-
|
|
68326
|
+
const questions = readQuestions(body.questions);
|
|
68327
|
+
if (!questions) return c.json(result);
|
|
68328
|
+
const form_answers = await generateFormAnswers(
|
|
68329
|
+
client,
|
|
68330
|
+
c.env.CONTENT_KV,
|
|
68331
|
+
{ ...body, contact: result.contact, questions },
|
|
68332
|
+
deadline
|
|
68333
|
+
);
|
|
68334
|
+
return c.json({ ...result, form_answers });
|
|
68156
68335
|
} catch (error2) {
|
|
68157
68336
|
logger2.error("application-extras generation failed", {
|
|
68158
68337
|
error: error2.message,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnthropicError } from "./index-
|
|
2
|
-
import { D, M } from "./index-
|
|
1
|
+
import { A as AnthropicError } from "./index-D6Xd4aSy.js";
|
|
2
|
+
import { D, M } from "./index-D6Xd4aSy.js";
|
|
3
3
|
function nodeOnly(name) {
|
|
4
4
|
throw new AnthropicError(`${name} requires Node.js or a Node-compatible runtime`);
|
|
5
5
|
}
|
|
@@ -13,6 +13,11 @@ export interface ApplicationExtrasRequest {
|
|
|
13
13
|
job_location?: string;
|
|
14
14
|
/** The job's workplace type as posted: remote | hybrid | onsite | unknown. */
|
|
15
15
|
workplace_type?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The application form's own free-text questions, when the caller has read
|
|
18
|
+
* the form (the apply runner). Answered in `form_answers`; see form-answers.ts.
|
|
19
|
+
*/
|
|
20
|
+
questions?: unknown;
|
|
16
21
|
}
|
|
17
22
|
export interface ScreeningAnswer {
|
|
18
23
|
q: string;
|
|
@@ -40,6 +45,8 @@ export interface ApplicationExtras {
|
|
|
40
45
|
talking_points: string[];
|
|
41
46
|
}
|
|
42
47
|
export interface ApplicationExtrasResponse extends ApplicationExtras {
|
|
48
|
+
/** One answer per question in the request's `questions`, under its exact label. */
|
|
49
|
+
form_answers?: ScreeningAnswer[];
|
|
43
50
|
/** Deterministic copy-paste block for the boring repeated form fields. */
|
|
44
51
|
standard_fields: string;
|
|
45
52
|
/** Raw contact profile, so the UI can offer any single field on its own. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-extras.d.ts","sourceRoot":"","sources":["../../worker/src/application-extras.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAsB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"application-extras.d.ts","sourceRoot":"","sources":["../../worker/src/application-extras.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAsB,KAAK,QAAQ,EAAoB,MAAM,UAAU,CAAA;AAK9E,OAAO,EAA2C,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAK3F,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,uFAAuF;IACvF,eAAe,EAAE,MAAM,CAAA;IACvB;;+EAE2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,qBAAqB,EAAE,MAAM,CAAA;IAC7B,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAA;IACnB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,iBAAiB,EAAE,eAAe,EAAE,CAAA;IACpC,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAA;IACnB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAA;IACrB,kDAAkD;IAClD,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,mFAAmF;IACnF,YAAY,CAAC,EAAE,eAAe,EAAE,CAAA;IAChC,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAA;IACvB,4EAA4E;IAC5E,OAAO,EAAE,cAAc,CAAA;IACvB,MAAM,EAAE,OAAO,CAAA;CAChB;AAaD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,QAAQ,EAChB,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,wBAAwB,GAC5B,OAAO,CAAC,yBAAyB,CAAC,CAuIpC"}
|
|
@@ -63,8 +63,15 @@ export declare const SELECTION_BUDGET: {
|
|
|
63
63
|
readonly CHARS_PER_TOKEN: 3.4;
|
|
64
64
|
readonly LADDER: readonly [readonly [200, 2500], readonly [120, 2000], readonly [80, 1500], readonly [0, 1000]];
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* The most of a posting any prompt carries, for a provider with no per-request
|
|
68
|
+
* token ceiling (job-text.ts). A sanity bound, not a budget: real postings run
|
|
69
|
+
* 3-15k characters as text, and this is ~18k tokens.
|
|
70
|
+
*/
|
|
71
|
+
export declare const FULL_JD_MAX_CHARS = 60000;
|
|
66
72
|
export declare const COVER_LETTER_TOKENS = 2048;
|
|
67
73
|
export declare const APPLICATION_EXTRAS_TOKENS = 3500;
|
|
74
|
+
export declare const FORM_ANSWERS_TOKENS = 2500;
|
|
68
75
|
export declare const OPERATION_BUDGET_MS = 100000;
|
|
69
76
|
export declare const MIN_ATTEMPT_MS = 3000;
|
|
70
77
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../worker/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;CAGb,CAAA;AA0DV;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,CAAA;AAErB,eAAO,MAAM,aAAa,EAAE;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,EA4ES,CAAA;AAEV;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW;;;;;;;CAQd,CAAA;AAEV,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAA;AAEV,eAAO,MAAM,sBAAsB;;;CASzB,CAAA;AAUV,eAAO,MAAM,gBAAgB;;;;CAanB,CAAA;AAEV,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAMvC,eAAO,MAAM,yBAAyB,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../worker/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;CAGb,CAAA;AA0DV;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,CAAA;AAErB,eAAO,MAAM,aAAa,EAAE;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,EA4ES,CAAA;AAEV;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW;;;;;;;CAQd,CAAA;AAEV,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAA;AAEV,eAAO,MAAM,sBAAsB;;;CASzB,CAAA;AAUV,eAAO,MAAM,gBAAgB;;;;CAanB,CAAA;AAEV;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,CAAA;AAEvC,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAMvC,eAAO,MAAM,yBAAyB,OAAO,CAAA;AAI7C,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAwBvC,eAAO,MAAM,mBAAmB,SAAU,CAAA;AAM1C,eAAO,MAAM,cAAc,OAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cover-letter.d.ts","sourceRoot":"","sources":["../../worker/src/cover-letter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAsB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"cover-letter.d.ts","sourceRoot":"","sources":["../../worker/src/cover-letter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAsB,KAAK,QAAQ,EAAoB,MAAM,UAAU,CAAA;AAS9E,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAA;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,EAAE,MAAM,CAAA;IAC7B,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,QAAQ,EAChB,EAAE,EAAE,WAAW,EACf,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,kBAAkB;AACvB,2EAA2E;AAC3E,QAAQ,GAAE,MAAyC,GAClD,OAAO,CAAC,mBAAmB,CAAC,CA6D9B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { KVNamespace } from '@cloudflare/workers-types';
|
|
2
|
+
import { type ContactProfile } from './contact.js';
|
|
3
|
+
import { type LLMChain } from './llm.js';
|
|
4
|
+
import type { ScreeningAnswer } from './application-extras.js';
|
|
5
|
+
/**
|
|
6
|
+
* Answers to ONE form's own free-text questions.
|
|
7
|
+
*
|
|
8
|
+
* The kit drafts answers to six questions applications ask over and over, and
|
|
9
|
+
* the apply runner can only use one whose wording matches the form's. A
|
|
10
|
+
* question only this posting asks matched none: Fleetio's "How did you hear
|
|
11
|
+
* about Fleetio and what compelled you to apply?" went to the owner unanswered,
|
|
12
|
+
* while its posting asked applicants to mention "coffee" so it knows they read
|
|
13
|
+
* it (2026-11-23). The runner now sends the labels it could not answer, and
|
|
14
|
+
* they are drafted here with the whole posting in view.
|
|
15
|
+
*/
|
|
16
|
+
/** The most questions one call drafts; a form with more is not a normal form. */
|
|
17
|
+
export declare const MAX_FORM_QUESTIONS = 25;
|
|
18
|
+
/** The longest label kept; Greenhouse's longest real ones run ~300 characters. */
|
|
19
|
+
export declare const MAX_QUESTION_CHARS = 500;
|
|
20
|
+
export interface FormAnswersInput {
|
|
21
|
+
job_title: string;
|
|
22
|
+
company: string;
|
|
23
|
+
description: string;
|
|
24
|
+
resume_markdown: string;
|
|
25
|
+
job_location?: string;
|
|
26
|
+
workplace_type?: string;
|
|
27
|
+
contact: ContactProfile;
|
|
28
|
+
questions: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One answer per question, in the order asked and under the exact label asked,
|
|
32
|
+
* since the runner matches on that label. An empty answer means "the owner
|
|
33
|
+
* should answer this": the model is told to return one rather than guess.
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateFormAnswers(client: LLMChain, kv: KVNamespace, input: FormAnswersInput, deadline?: number): Promise<ScreeningAnswer[]>;
|
|
36
|
+
/** The `questions` a caller sent, kept only when well-formed, else undefined. */
|
|
37
|
+
export declare function readQuestions(value: unknown): string[] | undefined;
|
|
38
|
+
//# sourceMappingURL=form-answers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-answers.d.ts","sourceRoot":"","sources":["../../worker/src/form-answers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAGlD,OAAO,EAAsB,KAAK,QAAQ,EAAoB,MAAM,UAAU,CAAA;AAG9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,KAAK,CAAA;AACpC,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAKD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,QAAQ,EAChB,EAAE,EAAE,WAAW,EACf,KAAK,EAAE,gBAAgB,EACvB,QAAQ,GAAE,MAAyC,GAClD,OAAO,CAAC,eAAe,EAAE,CAAC,CAoF5B;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAOlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../worker/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../worker/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAgC5D,UAAU,SAAS;IACjB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qFAAqF;IACrF,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,KAAK,CAAA;KAAE,CAAA;IAC9B,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,8EAA8E;IAC9E,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,WAAW,CAAA;IAC1B,UAAU,EAAE,WAAW,CAAA;CACxB;AAkBD,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;cAUrD,SAAS;0CAka3C;AAED,YAAY,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LLMProvider } from './llm.js';
|
|
2
|
+
/** The posting's text: markup dropped, block structure kept as line breaks. */
|
|
3
|
+
export declare function jobText(description: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* How much of the posting `provider` can take in one request.
|
|
6
|
+
*
|
|
7
|
+
* `promptChars` is the rest of the prompt and `maxTokens` the output allowance;
|
|
8
|
+
* a provider's ceiling counts both. No ceiling means the whole posting, bounded
|
|
9
|
+
* only by FULL_JD_MAX_CHARS. Returns 0 when nothing fits, so the caller decides
|
|
10
|
+
* whether a posting-less prompt is still worth sending.
|
|
11
|
+
*/
|
|
12
|
+
export declare function postingCharsFor(provider: LLMProvider, promptChars: number, maxTokens: number): number;
|
|
13
|
+
/** The posting cut to `chars`, marked when anything was dropped. */
|
|
14
|
+
export declare function clip(posting: string, chars: number): string;
|
|
15
|
+
/**
|
|
16
|
+
* The instruction every generator that writes TO the employer carries. A
|
|
17
|
+
* posting that asks for something specific is testing whether the applicant
|
|
18
|
+
* read it, and missing it reads as a form letter.
|
|
19
|
+
*/
|
|
20
|
+
export declare const POSTING_INSTRUCTIONS_RULE = "If the posting asks applicants to do something specific in their application (mention a particular word or phrase, answer a question, follow a format), do it, naturally, in the cover letter and in the answers about why the candidate is applying.";
|
|
21
|
+
//# sourceMappingURL=job-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-text.d.ts","sourceRoot":"","sources":["../../worker/src/job-text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAuD3C,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAoBnD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,MAAM,CAKR;AAED,oEAAoE;AACpE,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0PACmN,CAAA"}
|
package/dist/worker/llm.d.ts
CHANGED
|
@@ -58,10 +58,25 @@ export interface LLMProvider {
|
|
|
58
58
|
model: string;
|
|
59
59
|
/** The longest one attempt may take before the chain gives up on it. */
|
|
60
60
|
attemptTimeoutMs: number;
|
|
61
|
+
/**
|
|
62
|
+
* The most one request may spend, prompt and max_tokens together, or
|
|
63
|
+
* undefined when only the context window bounds it. The free tiers are a
|
|
64
|
+
* RATE limit per request (Groq: 8k tokens a minute, and a bigger request is a
|
|
65
|
+
* deterministic 413); Claude has none worth sizing a prompt to. Prompts that
|
|
66
|
+
* carry a whole job posting cut it for this, per provider (job-text.ts).
|
|
67
|
+
*/
|
|
68
|
+
requestTokenLimit?: number;
|
|
61
69
|
complete(messages: ChatMessage[], req: CompletionRequest): Promise<ChatResponse>;
|
|
62
70
|
}
|
|
63
71
|
/** A prioritized chain of providers; calls fall over from one to the next. */
|
|
64
72
|
export type LLMChain = LLMProvider[];
|
|
73
|
+
/**
|
|
74
|
+
* A completion's messages, or how to build them for the provider about to be
|
|
75
|
+
* tried. The function form is for a prompt whose size depends on the provider:
|
|
76
|
+
* the whole posting for Claude, what fits for a free tier. A builder that
|
|
77
|
+
* throws counts as that provider failing, so the chain moves on.
|
|
78
|
+
*/
|
|
79
|
+
export type Messages = ChatMessage[] | ((provider: LLMProvider) => ChatMessage[]);
|
|
65
80
|
/** Just the key bindings the chain reads — a subset of the worker env. */
|
|
66
81
|
/**
|
|
67
82
|
* The bindings the chain reads. Derived from `ProviderEnvKey` so it cannot fall
|
|
@@ -104,5 +119,5 @@ export declare function createLLMClient(env: LLMEnv, defer?: Defer): LLMChain;
|
|
|
104
119
|
* etc.). Only the final provider retries a rate limit, since there's nothing left
|
|
105
120
|
* to fall back to.
|
|
106
121
|
*/
|
|
107
|
-
export declare function sendChatCompletion(chain: LLMChain, messages:
|
|
122
|
+
export declare function sendChatCompletion(chain: LLMChain, messages: Messages, options?: CompletionOptions): Promise<ChatResponse>;
|
|
108
123
|
//# sourceMappingURL=llm.d.ts.map
|
package/dist/worker/llm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../worker/src/llm.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACrF,OAAO,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../worker/src/llm.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACrF,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAA;AAEvB;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAOD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAA;QACrB,iBAAiB,EAAE,MAAM,CAAA;QACzB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF;AAED,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;CACjF;AAED,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,WAAW,EAAE,CAAC,CAAA;AAEjF,0EAA0E;AAC1E;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,GAC1D,aAAa,GAAG;IACd,4EAA4E;IAC5E,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAA;AA2BH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,IACjD,KAAK,WAAW,GAAG,GAAG,EAAE,OAAO,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC,CAU7E;AAED,0FAA0F;AAC1F,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuBzE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,CA2CpE;AA+HD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAiDvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailored-resume.d.ts","sourceRoot":"","sources":["../../worker/src/tailored-resume.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAU5D,OAAO,EAAsB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"tailored-resume.d.ts","sourceRoot":"","sources":["../../worker/src/tailored-resume.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAU5D,OAAO,EAAsB,KAAK,QAAQ,EAAoB,MAAM,UAAU,CAAA;AA4B9E;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,QAAQ,EAChB,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,qBAAqB;AAC1B;;;;;GAKG;AACH,QAAQ,GAAE,MAAyC,GAClD,OAAO,CAAC,sBAAsB,CAAC,CA6SjC"}
|
package/dist/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/resume-bot",
|
|
3
|
-
"version": "3.15.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "3.15.109",
|
|
4
|
+
"gitHead": "6f5a271b8986b0fa0c72e3b258d7ab66a780bbe8",
|
|
5
5
|
"description": "AI-powered conversational interface for interactive resume exploration",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|