@tpmjs/official-offer-letter-draft 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +206 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2025 TPMJS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Offer Letter Draft Tool for TPMJS
|
|
5
|
+
* Generates offer letter content from compensation and role details
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Candidate information
|
|
9
|
+
*/
|
|
10
|
+
interface Candidate {
|
|
11
|
+
name: string;
|
|
12
|
+
address?: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Offer details
|
|
17
|
+
*/
|
|
18
|
+
interface Offer {
|
|
19
|
+
salary: number;
|
|
20
|
+
currency?: string;
|
|
21
|
+
salaryPeriod?: 'annual' | 'hourly';
|
|
22
|
+
equity?: {
|
|
23
|
+
shares?: number;
|
|
24
|
+
percentage?: number;
|
|
25
|
+
vestingYears?: number;
|
|
26
|
+
};
|
|
27
|
+
bonus?: {
|
|
28
|
+
target: number;
|
|
29
|
+
type?: 'annual' | 'signing';
|
|
30
|
+
};
|
|
31
|
+
benefits?: string[];
|
|
32
|
+
startDate: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Role information
|
|
36
|
+
*/
|
|
37
|
+
interface Role {
|
|
38
|
+
title: string;
|
|
39
|
+
department: string;
|
|
40
|
+
location: string;
|
|
41
|
+
manager?: string;
|
|
42
|
+
type?: 'full-time' | 'part-time' | 'contract';
|
|
43
|
+
isRemote?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Input interface for offer letter draft
|
|
47
|
+
*/
|
|
48
|
+
interface OfferLetterDraftInput {
|
|
49
|
+
candidate: Candidate;
|
|
50
|
+
offer: Offer;
|
|
51
|
+
role: Role;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Offer letter sections
|
|
55
|
+
*/
|
|
56
|
+
interface OfferLetter {
|
|
57
|
+
header: string;
|
|
58
|
+
greeting: string;
|
|
59
|
+
introduction: string;
|
|
60
|
+
positionDetails: string;
|
|
61
|
+
compensationDetails: string;
|
|
62
|
+
benefitsDetails: string;
|
|
63
|
+
startDateDetails: string;
|
|
64
|
+
contingencies: string;
|
|
65
|
+
atWillStatement: string;
|
|
66
|
+
closing: string;
|
|
67
|
+
fullLetter: string;
|
|
68
|
+
metadata: {
|
|
69
|
+
generatedDate: string;
|
|
70
|
+
candidateName: string;
|
|
71
|
+
roleTitle: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Offer Letter Draft Tool
|
|
76
|
+
* Generates offer letter content from compensation and role details
|
|
77
|
+
*/
|
|
78
|
+
declare const offerLetterDraftTool: ai.Tool<OfferLetterDraftInput, OfferLetter>;
|
|
79
|
+
|
|
80
|
+
export { type OfferLetter, offerLetterDraftTool as default, offerLetterDraftTool };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { tool, jsonSchema } from 'ai';
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
var offerLetterDraftTool = tool({
|
|
5
|
+
description: "Generates professional offer letter content from compensation and role details. Includes position, compensation, benefits, start date, at-will employment statement, and standard contingencies (background check, right to work verification).",
|
|
6
|
+
inputSchema: jsonSchema({
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
candidate: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
name: { type: "string", description: "Candidate full name" },
|
|
13
|
+
address: { type: "string", description: "Candidate mailing address" },
|
|
14
|
+
email: { type: "string", description: "Candidate email address" }
|
|
15
|
+
},
|
|
16
|
+
required: ["name"],
|
|
17
|
+
description: "Candidate information"
|
|
18
|
+
},
|
|
19
|
+
offer: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
salary: { type: "number", description: "Base salary amount" },
|
|
23
|
+
currency: { type: "string", description: "Currency (default: USD)" },
|
|
24
|
+
salaryPeriod: {
|
|
25
|
+
type: "string",
|
|
26
|
+
enum: ["annual", "hourly"],
|
|
27
|
+
description: "Salary period (default: annual)"
|
|
28
|
+
},
|
|
29
|
+
equity: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
shares: { type: "number", description: "Number of stock options" },
|
|
33
|
+
percentage: { type: "number", description: "Equity percentage" },
|
|
34
|
+
vestingYears: { type: "number", description: "Vesting period in years" }
|
|
35
|
+
},
|
|
36
|
+
description: "Equity compensation details"
|
|
37
|
+
},
|
|
38
|
+
bonus: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
target: { type: "number", description: "Bonus amount or percentage" },
|
|
42
|
+
type: {
|
|
43
|
+
type: "string",
|
|
44
|
+
enum: ["annual", "signing"],
|
|
45
|
+
description: "Bonus type"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
required: ["target"],
|
|
49
|
+
description: "Bonus details"
|
|
50
|
+
},
|
|
51
|
+
benefits: {
|
|
52
|
+
type: "array",
|
|
53
|
+
items: { type: "string" },
|
|
54
|
+
description: "List of benefits"
|
|
55
|
+
},
|
|
56
|
+
startDate: { type: "string", description: "Employment start date" }
|
|
57
|
+
},
|
|
58
|
+
required: ["salary", "startDate"],
|
|
59
|
+
description: "Offer details"
|
|
60
|
+
},
|
|
61
|
+
role: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
title: { type: "string", description: "Job title" },
|
|
65
|
+
department: { type: "string", description: "Department name" },
|
|
66
|
+
location: { type: "string", description: "Work location" },
|
|
67
|
+
manager: { type: "string", description: "Manager name" },
|
|
68
|
+
type: {
|
|
69
|
+
type: "string",
|
|
70
|
+
enum: ["full-time", "part-time", "contract"],
|
|
71
|
+
description: "Employment type (default: full-time)"
|
|
72
|
+
},
|
|
73
|
+
isRemote: { type: "boolean", description: "Whether position is remote" }
|
|
74
|
+
},
|
|
75
|
+
required: ["title", "department", "location"],
|
|
76
|
+
description: "Role details"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
required: ["candidate", "offer", "role"],
|
|
80
|
+
additionalProperties: false
|
|
81
|
+
}),
|
|
82
|
+
execute: async ({ candidate, offer, role }) => {
|
|
83
|
+
if (!candidate.name || typeof candidate.name !== "string") {
|
|
84
|
+
throw new Error("Candidate name is required");
|
|
85
|
+
}
|
|
86
|
+
if (typeof offer.salary !== "number" || offer.salary <= 0) {
|
|
87
|
+
throw new Error("Offer salary must be a positive number");
|
|
88
|
+
}
|
|
89
|
+
if (!offer.startDate || typeof offer.startDate !== "string") {
|
|
90
|
+
throw new Error("Offer start date is required");
|
|
91
|
+
}
|
|
92
|
+
if (!role.title || !role.department || !role.location) {
|
|
93
|
+
throw new Error("Role title, department, and location are required");
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const currency = offer.currency || "USD";
|
|
97
|
+
const salaryPeriod = offer.salaryPeriod || "annual";
|
|
98
|
+
const employmentType = role.type || "full-time";
|
|
99
|
+
const currentDate = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
100
|
+
year: "numeric",
|
|
101
|
+
month: "long",
|
|
102
|
+
day: "numeric"
|
|
103
|
+
});
|
|
104
|
+
const formattedSalary = new Intl.NumberFormat("en-US", {
|
|
105
|
+
style: "currency",
|
|
106
|
+
currency,
|
|
107
|
+
minimumFractionDigits: 0
|
|
108
|
+
}).format(offer.salary);
|
|
109
|
+
const header = `OFFER LETTER
|
|
110
|
+
${currentDate}`;
|
|
111
|
+
const greeting = `Dear ${candidate.name},`;
|
|
112
|
+
const introduction = `We are pleased to offer you the position of ${role.title} at our company. We believe your skills and experience will be a valuable addition to our ${role.department} team.`;
|
|
113
|
+
const positionDetails = `Position: ${role.title}
|
|
114
|
+
Department: ${role.department}
|
|
115
|
+
Reports to: ${role.manager || "TBD"}
|
|
116
|
+
Location: ${role.location}${role.isRemote ? " (Remote)" : ""}
|
|
117
|
+
Employment Type: ${employmentType.charAt(0).toUpperCase() + employmentType.slice(1)}`;
|
|
118
|
+
let compensationDetails = `Base Salary: ${formattedSalary} ${salaryPeriod}`;
|
|
119
|
+
if (offer.equity) {
|
|
120
|
+
if (offer.equity.shares) {
|
|
121
|
+
compensationDetails += `
|
|
122
|
+
Stock Options: ${offer.equity.shares.toLocaleString()} shares`;
|
|
123
|
+
}
|
|
124
|
+
if (offer.equity.percentage) {
|
|
125
|
+
compensationDetails += `
|
|
126
|
+
Equity: ${offer.equity.percentage}% of company`;
|
|
127
|
+
}
|
|
128
|
+
if (offer.equity.vestingYears) {
|
|
129
|
+
compensationDetails += ` (${offer.equity.vestingYears}-year vesting)`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (offer.bonus) {
|
|
133
|
+
const bonusAmount = offer.bonus.target < 1 ? `${(offer.bonus.target * 100).toFixed(0)}% of base salary` : new Intl.NumberFormat("en-US", {
|
|
134
|
+
style: "currency",
|
|
135
|
+
currency,
|
|
136
|
+
minimumFractionDigits: 0
|
|
137
|
+
}).format(offer.bonus.target);
|
|
138
|
+
compensationDetails += `
|
|
139
|
+
${offer.bonus.type === "signing" ? "Signing" : "Annual"} Bonus: ${bonusAmount}`;
|
|
140
|
+
}
|
|
141
|
+
const benefitsDetails = offer.benefits && offer.benefits.length > 0 ? `Benefits:
|
|
142
|
+
${offer.benefits.map((b) => `- ${b}`).join("\n")}` : "Benefits: Standard company benefits package (details to be provided separately)";
|
|
143
|
+
const startDateDetails = `Start Date: ${offer.startDate}`;
|
|
144
|
+
const contingencies = `This offer is contingent upon:
|
|
145
|
+
- Satisfactory completion of a background check
|
|
146
|
+
- Verification of your right to work in the applicable jurisdiction
|
|
147
|
+
- Signing of the company's standard employment agreement and any applicable confidentiality/IP agreements`;
|
|
148
|
+
const atWillStatement = `This position is at-will, meaning that either you or the company may terminate the employment relationship at any time, with or without cause or notice. This offer letter does not constitute a contract of employment for any specific duration.`;
|
|
149
|
+
const closing = `Please confirm your acceptance of this offer by signing and returning this letter by [date]. We look forward to welcoming you to our team!
|
|
150
|
+
|
|
151
|
+
Sincerely,
|
|
152
|
+
|
|
153
|
+
[Name]
|
|
154
|
+
[Title]`;
|
|
155
|
+
const fullLetter = [
|
|
156
|
+
header,
|
|
157
|
+
"",
|
|
158
|
+
greeting,
|
|
159
|
+
"",
|
|
160
|
+
introduction,
|
|
161
|
+
"",
|
|
162
|
+
positionDetails,
|
|
163
|
+
"",
|
|
164
|
+
"COMPENSATION",
|
|
165
|
+
compensationDetails,
|
|
166
|
+
"",
|
|
167
|
+
benefitsDetails,
|
|
168
|
+
"",
|
|
169
|
+
startDateDetails,
|
|
170
|
+
"",
|
|
171
|
+
"CONTINGENCIES",
|
|
172
|
+
contingencies,
|
|
173
|
+
"",
|
|
174
|
+
"EMPLOYMENT AT-WILL",
|
|
175
|
+
atWillStatement,
|
|
176
|
+
"",
|
|
177
|
+
closing
|
|
178
|
+
].join("\n");
|
|
179
|
+
return {
|
|
180
|
+
header,
|
|
181
|
+
greeting,
|
|
182
|
+
introduction,
|
|
183
|
+
positionDetails,
|
|
184
|
+
compensationDetails,
|
|
185
|
+
benefitsDetails,
|
|
186
|
+
startDateDetails,
|
|
187
|
+
contingencies,
|
|
188
|
+
atWillStatement,
|
|
189
|
+
closing,
|
|
190
|
+
fullLetter,
|
|
191
|
+
metadata: {
|
|
192
|
+
generatedDate: currentDate,
|
|
193
|
+
candidateName: candidate.name,
|
|
194
|
+
roleTitle: role.title
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
} catch (error) {
|
|
198
|
+
throw new Error(
|
|
199
|
+
`Failed to generate offer letter: ${error instanceof Error ? error.message : String(error)}`
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
var index_default = offerLetterDraftTool;
|
|
205
|
+
|
|
206
|
+
export { index_default as default, offerLetterDraftTool };
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tpmjs/official-offer-letter-draft",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generates offer letter content from compensation and role details",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"tpmjs",
|
|
8
|
+
"hr",
|
|
9
|
+
"offer-letter",
|
|
10
|
+
"hiring",
|
|
11
|
+
"compensation"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"tsup": "^8.3.5",
|
|
24
|
+
"typescript": "^5.9.3",
|
|
25
|
+
"@tpmjs/tsconfig": "0.0.0"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/anthropics/tpmjs.git",
|
|
33
|
+
"directory": "packages/tools/official/offer-letter-draft"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://tpmjs.com",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"tpmjs": {
|
|
38
|
+
"category": "hr",
|
|
39
|
+
"frameworks": [
|
|
40
|
+
"vercel-ai"
|
|
41
|
+
],
|
|
42
|
+
"tools": [
|
|
43
|
+
{
|
|
44
|
+
"name": "offerLetterDraftTool",
|
|
45
|
+
"description": "Generates offer letter content from compensation and role details",
|
|
46
|
+
"parameters": [
|
|
47
|
+
{
|
|
48
|
+
"name": "candidate",
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Candidate information (name, address)",
|
|
51
|
+
"required": true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "offer",
|
|
55
|
+
"type": "object",
|
|
56
|
+
"description": "Offer details (salary, equity, benefits)",
|
|
57
|
+
"required": true
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "role",
|
|
61
|
+
"type": "object",
|
|
62
|
+
"description": "Role details (title, department, manager)",
|
|
63
|
+
"required": true
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"returns": {
|
|
67
|
+
"type": "OfferLetter",
|
|
68
|
+
"description": "Formatted offer letter content"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"ai": "6.0.0-beta.124"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsup",
|
|
78
|
+
"dev": "tsup --watch",
|
|
79
|
+
"type-check": "tsc --noEmit",
|
|
80
|
+
"clean": "rm -rf dist .turbo"
|
|
81
|
+
}
|
|
82
|
+
}
|