@profullstack/agenticjobs 0.10.0 → 0.12.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/README.md +69 -1
- package/dist/cli/args.js +31 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/index.js +396 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/jobfile.js +38 -2
- package/dist/cli/jobfile.js.map +1 -1
- package/dist/client/client.d.ts +149 -0
- package/dist/client/client.js +79 -12
- package/dist/client/client.js.map +1 -1
- package/dist/client/fanout.js +7 -1
- package/dist/client/fanout.js.map +1 -1
- package/dist/config.d.ts +35 -1
- package/dist/config.js +33 -1
- package/dist/config.js.map +1 -1
- package/dist/core/candidates.js +33 -6
- package/dist/core/candidates.js.map +1 -1
- package/dist/core/capacity-alert.d.ts +84 -0
- package/dist/core/capacity-alert.js +144 -0
- package/dist/core/capacity-alert.js.map +1 -0
- package/dist/core/capacity.d.ts +96 -0
- package/dist/core/capacity.js +174 -0
- package/dist/core/capacity.js.map +1 -0
- package/dist/core/coinpay.d.ts +143 -0
- package/dist/core/coinpay.js +417 -0
- package/dist/core/coinpay.js.map +1 -0
- package/dist/core/import-job.js +18 -7
- package/dist/core/import-job.js.map +1 -1
- package/dist/core/import.js +18 -15
- package/dist/core/import.js.map +1 -1
- package/dist/core/inbox.d.ts +155 -0
- package/dist/core/inbox.js +353 -0
- package/dist/core/inbox.js.map +1 -0
- package/dist/core/invoices.d.ts +111 -0
- package/dist/core/invoices.js +292 -0
- package/dist/core/invoices.js.map +1 -0
- package/dist/core/jobs.js +12 -2
- package/dist/core/jobs.js.map +1 -1
- package/dist/core/mail.d.ts +16 -0
- package/dist/core/mail.js +22 -0
- package/dist/core/mail.js.map +1 -1
- package/dist/core/orgs.d.ts +39 -0
- package/dist/core/orgs.js +69 -0
- package/dist/core/orgs.js.map +1 -1
- package/dist/directory/federate.js +2 -4
- package/dist/directory/federate.js.map +1 -1
- package/dist/directory/fetch.d.ts +1 -1
- package/dist/markup/markdown.js +4 -1
- package/dist/markup/markdown.js.map +1 -1
- package/dist/markup/resume.js +66 -1
- package/dist/markup/resume.js.map +1 -1
- package/dist/mcp/server.js +5 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stdio.js +3 -2
- package/dist/mcp/stdio.js.map +1 -1
- package/dist/mcp/tools.js +151 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/schema/jsonld.js +1 -8
- package/dist/schema/jsonld.js.map +1 -1
- package/dist/schema/salary.d.ts +5 -0
- package/dist/schema/salary.js +15 -0
- package/dist/schema/salary.js.map +1 -0
- package/dist/schema/text.js +7 -3
- package/dist/schema/text.js.map +1 -1
- package/dist/server/app.d.ts +4 -3
- package/dist/server/app.js +7 -4
- package/dist/server/app.js.map +1 -1
- package/dist/server/deps.d.ts +5 -0
- package/dist/server/middleware.js +9 -1
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/routes/api.js +347 -1
- package/dist/server/routes/api.js.map +1 -1
- package/dist/server/routes/discovery.js +75 -0
- package/dist/server/routes/discovery.js.map +1 -1
- package/dist/server/routes/inbox.d.ts +9 -0
- package/dist/server/routes/inbox.js +223 -0
- package/dist/server/routes/inbox.js.map +1 -0
- package/dist/server/routes/openapi.js +141 -1
- package/dist/server/routes/openapi.js.map +1 -1
- package/dist/server/routes/pages.d.ts +22 -0
- package/dist/server/routes/pages.js +91 -7
- package/dist/server/routes/pages.js.map +1 -1
- package/dist/views/candidates.d.ts +8 -0
- package/dist/views/candidates.js +2 -1
- package/dist/views/candidates.js.map +1 -1
- package/dist/views/docs.js +48 -4
- package/dist/views/docs.js.map +1 -1
- package/dist/views/inbox.d.ts +90 -0
- package/dist/views/inbox.js +73 -0
- package/dist/views/inbox.js.map +1 -0
- package/dist/views/jobs.d.ts +9 -0
- package/dist/views/jobs.js +3 -2
- package/dist/views/jobs.js.map +1 -1
- package/dist/views/layout.d.ts +2 -0
- package/dist/views/layout.js +2 -2
- package/dist/views/layout.js.map +1 -1
- package/dist/views/me.d.ts +3 -3
- package/dist/views/me.js +2 -2
- package/dist/views/me.js.map +1 -1
- package/dist/views/updates.d.ts +13 -0
- package/dist/views/updates.js +2 -1
- package/dist/views/updates.js.map +1 -1
- package/docs/openjob.md +5 -0
- package/docs/openresume.md +36 -0
- package/migrations/0014_inbox_and_billing.sql +138 -0
- package/package.json +15 -17
- package/web/public/app.css +146 -3
- package/web/public/sw.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fanout.js","sourceRoot":"","sources":["../../src/client/fanout.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAyB3D,MAAM,UAAU,gBAAgB;IAC9B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAqB,EACrB,KAAwB,EACxB,UAAkC,EAAE;IAEpC,MAAM,OAAO,GAAmB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrD,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QACxC,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;IACJ,MAAM,IAAI,GAAgB,EAAE,CAAC;IAE7B,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAChC,MAAM,MAAM,GA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AAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7F,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO;QACP,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,MAAM,CAAC,MAAc;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -34,8 +34,33 @@ export interface Config {
|
|
|
34
34
|
openaiApiKey: string | null;
|
|
35
35
|
/** Overrides the per-provider default model. */
|
|
36
36
|
writerModel: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* CoinPay, for invoices sent through the inbox. Null leaves billing off and
|
|
39
|
+
* absent from every page rather than present and broken.
|
|
40
|
+
*/
|
|
41
|
+
coinpay: CoinPayConfig | null;
|
|
37
42
|
version: string;
|
|
38
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Everything the board needs to settle an invoice on CoinPay.
|
|
46
|
+
*
|
|
47
|
+
* Two credentials for two jobs. The OAuth client is how a *person* connects
|
|
48
|
+
* their own CoinPay account so the board can read which wallets they can be
|
|
49
|
+
* paid to. The business key is the *board's*, and is what mints a payment
|
|
50
|
+
* whose payee is that person's wallet: an OAuth token cannot create payments,
|
|
51
|
+
* and a board that held its users' merchant keys would be a worse design than
|
|
52
|
+
* one that holds its own.
|
|
53
|
+
*/
|
|
54
|
+
export interface CoinPayConfig {
|
|
55
|
+
/** The portal's origin, no trailing slash. The API is under `/api`. */
|
|
56
|
+
url: string;
|
|
57
|
+
clientId: string;
|
|
58
|
+
clientSecret: string;
|
|
59
|
+
apiKey: string;
|
|
60
|
+
businessId: string;
|
|
61
|
+
/** Verifies webhooks. Null means status is learned by polling only. */
|
|
62
|
+
webhookSecret: string | null;
|
|
63
|
+
}
|
|
39
64
|
/**
|
|
40
65
|
* Are these two URLs the same board?
|
|
41
66
|
*
|
|
@@ -45,9 +70,18 @@ export interface Config {
|
|
|
45
70
|
* in DIRECTORY_URL and would otherwise announce its way into its own listing.
|
|
46
71
|
*/
|
|
47
72
|
export declare function sameOrigin(a: string | null, b: string | null): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The CoinPay block, or null.
|
|
75
|
+
*
|
|
76
|
+
* All four credentials or none: a board with a client id and no business key
|
|
77
|
+
* could let people connect wallets nobody can ever pay, which is a feature
|
|
78
|
+
* that looks finished and is not. A partial set is logged so the operator
|
|
79
|
+
* finds out at boot rather than from a confused user.
|
|
80
|
+
*/
|
|
81
|
+
export declare function coinpayConfig(env: NodeJS.ProcessEnv, log?: (message: string) => void): CoinPayConfig | null;
|
|
48
82
|
export declare function loadConfig(env?: NodeJS.ProcessEnv): Config;
|
|
49
83
|
/** Kept in step with package.json by the release script. */
|
|
50
|
-
export declare const VERSION = "0.
|
|
84
|
+
export declare const VERSION = "0.12.0";
|
|
51
85
|
export declare const SOFTWARE_NAME = "agenticjobs";
|
|
52
86
|
/**
|
|
53
87
|
* Tokens are stored as a hash of what was handed out, so this is the only
|
package/dist/config.js
CHANGED
|
@@ -47,6 +47,37 @@ export function sameOrigin(a, b) {
|
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The CoinPay block, or null.
|
|
52
|
+
*
|
|
53
|
+
* All four credentials or none: a board with a client id and no business key
|
|
54
|
+
* could let people connect wallets nobody can ever pay, which is a feature
|
|
55
|
+
* that looks finished and is not. A partial set is logged so the operator
|
|
56
|
+
* finds out at boot rather than from a confused user.
|
|
57
|
+
*/
|
|
58
|
+
export function coinpayConfig(env, log = (message) => console.error(message)) {
|
|
59
|
+
const read = (name) => env[name]?.trim() ?? '';
|
|
60
|
+
const clientId = read('COINPAY_CLIENT_ID');
|
|
61
|
+
const clientSecret = read('COINPAY_CLIENT_SECRET');
|
|
62
|
+
const apiKey = read('COINPAY_API_KEY');
|
|
63
|
+
const businessId = read('COINPAY_BUSINESS_ID');
|
|
64
|
+
const present = [clientId, clientSecret, apiKey, businessId].filter((v) => v !== '').length;
|
|
65
|
+
if (present === 0)
|
|
66
|
+
return null;
|
|
67
|
+
if (present < 4) {
|
|
68
|
+
log('coinpay: set all of COINPAY_CLIENT_ID, COINPAY_CLIENT_SECRET, COINPAY_API_KEY and COINPAY_BUSINESS_ID, or none. Billing is off.');
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const webhookSecret = read('COINPAY_WEBHOOK_SECRET');
|
|
72
|
+
return {
|
|
73
|
+
url: trimSlash(read('COINPAY_URL') || 'https://coinpayportal.com'),
|
|
74
|
+
clientId,
|
|
75
|
+
clientSecret,
|
|
76
|
+
apiKey,
|
|
77
|
+
businessId,
|
|
78
|
+
webhookSecret: webhookSecret === '' ? null : webhookSecret,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
50
81
|
function flag(value, fallback = false) {
|
|
51
82
|
if (value === undefined || value.trim() === '')
|
|
52
83
|
return fallback;
|
|
@@ -78,11 +109,12 @@ export function loadConfig(env = process.env) {
|
|
|
78
109
|
anthropicApiKey: env['ANTHROPIC_API_KEY']?.trim() || null,
|
|
79
110
|
openaiApiKey: env['OPENAI_API_KEY']?.trim() || null,
|
|
80
111
|
writerModel: env['WRITER_MODEL']?.trim() || null,
|
|
112
|
+
coinpay: coinpayConfig(env),
|
|
81
113
|
version: env['npm_package_version']?.trim() || VERSION,
|
|
82
114
|
};
|
|
83
115
|
}
|
|
84
116
|
/** Kept in step with package.json by the release script. */
|
|
85
|
-
export const VERSION = '0.
|
|
117
|
+
export const VERSION = '0.12.0';
|
|
86
118
|
export const SOFTWARE_NAME = 'agenticjobs';
|
|
87
119
|
/**
|
|
88
120
|
* Tokens are stored as a hash of what was handed out, so this is the only
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA6DtD,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,SAAiB,EAAE,SAAiB;IAC3D,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CA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,IAAI,IAAI;QACnD,WAAW,EAAE,GAAG,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI;QAChD,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC;QAC3B,OAAO,EAAE,GAAG,CAAC,qBAAqB,CAAC,EAAE,IAAI,EAAE,IAAI,OAAO;KACvD,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/core/candidates.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* document they already wrote, and a second copy of the same facts is a second
|
|
7
7
|
* copy to keep in step.
|
|
8
8
|
*/
|
|
9
|
+
import { parseCapacity } from "./capacity.js";
|
|
9
10
|
import { parseResume, redactContactChannels } from "../markup/resume.js";
|
|
10
11
|
/** Contact keys that read as a place rather than an address. */
|
|
11
12
|
const LOCATION_KEYS = /^(location|based|city|where|region)$/i;
|
|
@@ -13,10 +14,10 @@ const LOCATION_KEYS = /^(location|based|city|where|region)$/i;
|
|
|
13
14
|
* Skills, from the section a resume marks as skills.
|
|
14
15
|
*
|
|
15
16
|
* Takes the bullets under the heading, and splits a comma-separated line,
|
|
16
|
-
* because both are how people write that section.
|
|
17
|
-
*
|
|
17
|
+
* because both are how people write that section. Keep all skills for filters
|
|
18
|
+
* and the index; a directory card applies its own display limit.
|
|
18
19
|
*/
|
|
19
|
-
function skillsOf(resume
|
|
20
|
+
function skillsOf(resume) {
|
|
20
21
|
const section = resume.parsed?.sections.find((item) => item.kind === 'skills');
|
|
21
22
|
if (section === undefined)
|
|
22
23
|
return [];
|
|
@@ -42,8 +43,6 @@ function skillsOf(resume, limit = 8) {
|
|
|
42
43
|
continue;
|
|
43
44
|
seen.add(key);
|
|
44
45
|
out.push(cleaned);
|
|
45
|
-
if (out.length >= limit)
|
|
46
|
-
break;
|
|
47
46
|
}
|
|
48
47
|
return out;
|
|
49
48
|
}
|
|
@@ -100,13 +99,41 @@ export function resumeForViewer(resume, signedIn) {
|
|
|
100
99
|
return { markdown: resume.markdown, parsed: resume.parsed, redacted: false };
|
|
101
100
|
return { markdown, parsed: parseResume(markdown), redacted: true };
|
|
102
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* The headline, re-checked at render time rather than trusted.
|
|
104
|
+
*
|
|
105
|
+
* `parsed` is a cache written on save, so fixing the parser does not fix the
|
|
106
|
+
* rows already in the table. Cleaning the headline at parse time left the live
|
|
107
|
+
* directory still captioned `Operated by:** DevilX (<address>)` — correct code
|
|
108
|
+
* serving a stale value, which is the shape of every derived-cache bug.
|
|
109
|
+
*
|
|
110
|
+
* A backfill would repair those rows, but it would not stop the next one: any
|
|
111
|
+
* resume saved by an older build, restored from a backup, or written straight
|
|
112
|
+
* into the column arrives here the same way. This is a public directory page
|
|
113
|
+
* and the field is one line of text, so it is checked on the way out. Cheap,
|
|
114
|
+
* and it cannot go stale.
|
|
115
|
+
*/
|
|
116
|
+
function headlineOf(resume) {
|
|
117
|
+
const headline = resume.parsed?.headline;
|
|
118
|
+
if (headline === null || headline === undefined)
|
|
119
|
+
return null;
|
|
120
|
+
const cleaned = headline.replace(/\*\*|__/g, '').trim();
|
|
121
|
+
if (cleaned === '')
|
|
122
|
+
return null;
|
|
123
|
+
return /[^\s@]+@[^\s@]+\.[^\s@]+/.test(cleaned) ? null : cleaned;
|
|
124
|
+
}
|
|
103
125
|
export function toCandidateSummary(resume) {
|
|
104
126
|
return {
|
|
105
127
|
slug: resume.publicSlug ?? '',
|
|
106
128
|
name: nameOf(resume),
|
|
107
|
-
headline: resume
|
|
129
|
+
headline: headlineOf(resume),
|
|
108
130
|
location: locationOf(resume),
|
|
109
131
|
skills: skillsOf(resume),
|
|
132
|
+
// Capacity is a summary field for the same reason location is: it is what
|
|
133
|
+
// an employer filters on before opening anything. It is also the one thing
|
|
134
|
+
// here that is null for most resumes today, since the convention is new —
|
|
135
|
+
// the card says so rather than hiding the row.
|
|
136
|
+
capacity: parseCapacity(resume.parsed?.contact ?? []),
|
|
110
137
|
updatedAt: resume.updatedAt,
|
|
111
138
|
};
|
|
112
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidates.js","sourceRoot":"","sources":["../../src/core/candidates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAmB,WAAW,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE1F,gEAAgE;AAChE,MAAM,aAAa,GAAG,uCAAuC,CAAC;AAE9D;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,MAAc
|
|
1
|
+
{"version":3,"file":"candidates.js","sourceRoot":"","sources":["../../src/core/candidates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAmB,WAAW,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE1F,gEAAgE;AAChE,MAAM,aAAa,GAAG,uCAAuC,CAAC;AAE9D;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,MAAc;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IAC/E,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,WAAW,GAAG,OAAO,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G,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,OAAO,CAAC,UAA8B;IACpD,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0C,CAAC;IACjE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,IAAI,KAAK,SAAS;gBAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;;gBAC7D,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAC1D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asking listed candidates to state their swarm capacity.
|
|
3
|
+
*
|
|
4
|
+
* The convention in `capacity.ts` is new, so every resume published before it
|
|
5
|
+
* has nothing to show and the directory says "capacity not stated" on almost
|
|
6
|
+
* every card. Backfilling was the alternative and it is the wrong one: nobody
|
|
7
|
+
* here knows whether a given candidate is one agent or ten, and inventing an
|
|
8
|
+
* answer would put a made-up price on a real person's profile. So we ask.
|
|
9
|
+
*
|
|
10
|
+
* Two rules this module exists to enforce, both of which are easy to get wrong
|
|
11
|
+
* when a send is one function call away:
|
|
12
|
+
*
|
|
13
|
+
* - **It only ever writes to people who are actually missing it.** The set
|
|
14
|
+
* is computed from the same parser the directory renders with, so "who
|
|
15
|
+
* needs asking" and "whose card looks empty" can never drift apart.
|
|
16
|
+
* - **It does not send unless asked to.** `plan` is the default and returns
|
|
17
|
+
* the recipients without contacting anybody, because the cost of a bug in
|
|
18
|
+
* an outbound loop is paid by other people's inboxes and cannot be undone.
|
|
19
|
+
*/
|
|
20
|
+
import type pg from 'pg';
|
|
21
|
+
import type { Mailer, Message } from './mail.ts';
|
|
22
|
+
export interface CapacityAlertTarget {
|
|
23
|
+
userId: string;
|
|
24
|
+
email: string;
|
|
25
|
+
/** The name on the resume, for the greeting. */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Board-wide slug, so the mail can link the profile being talked about. */
|
|
28
|
+
publicSlug: string;
|
|
29
|
+
/** The owner's own slug, which is what /me/resumes/<slug> wants. */
|
|
30
|
+
slug: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Listed candidates whose resume states no capacity.
|
|
34
|
+
*
|
|
35
|
+
* Only `public` resumes: a private resume is not in the directory, so nothing
|
|
36
|
+
* about it is missing and its owner has not asked to be in this conversation.
|
|
37
|
+
*
|
|
38
|
+
* One row per person, not per resume. A candidate with three public resumes
|
|
39
|
+
* has one inbox, and three emails saying the same thing is how a useful
|
|
40
|
+
* request becomes spam. The most recently touched resume is the one named,
|
|
41
|
+
* because it is the one they are most likely to still be editing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function candidatesMissingCapacity(pool: pg.Pool): Promise<CapacityAlertTarget[]>;
|
|
44
|
+
/**
|
|
45
|
+
* The ask.
|
|
46
|
+
*
|
|
47
|
+
* It shows the two lines to paste rather than describing them, because the
|
|
48
|
+
* whole convention *is* two lines and a person who has to go and read a spec
|
|
49
|
+
* to answer a one-question email mostly does not answer it. Both shapes are
|
|
50
|
+
* given — a single agent and a swarm — since "I am one agent" is a real answer
|
|
51
|
+
* and an email that only demonstrates the swarm case reads as though it is not.
|
|
52
|
+
*/
|
|
53
|
+
export declare function capacityAlertMessage(options: {
|
|
54
|
+
to: string;
|
|
55
|
+
name: string;
|
|
56
|
+
boardName: string;
|
|
57
|
+
profileUrl: string;
|
|
58
|
+
editUrl: string;
|
|
59
|
+
specUrl: string;
|
|
60
|
+
}): Message;
|
|
61
|
+
export interface CapacityAlertResult {
|
|
62
|
+
target: CapacityAlertTarget;
|
|
63
|
+
/** False when the provider refused, null when this was a plan-only run. */
|
|
64
|
+
sent: boolean | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Work the list.
|
|
68
|
+
*
|
|
69
|
+
* `send` has to be passed explicitly. A default of "yes, mail everyone" is the
|
|
70
|
+
* kind of default that turns a typo in a WHERE clause into an apology, and
|
|
71
|
+
* this is the one function in the module that can do that.
|
|
72
|
+
*
|
|
73
|
+
* Sends are sequential. The list is small by construction — it is the people
|
|
74
|
+
* listed on one board who have not filled in one field — and a provider that
|
|
75
|
+
* rate-limits a burst would report failures that mean nothing about the
|
|
76
|
+
* recipient.
|
|
77
|
+
*/
|
|
78
|
+
export declare function runCapacityAlerts(options: {
|
|
79
|
+
pool: pg.Pool;
|
|
80
|
+
mailer: Mailer | null;
|
|
81
|
+
boardName: string;
|
|
82
|
+
publicUrl: string;
|
|
83
|
+
send: boolean;
|
|
84
|
+
}): Promise<CapacityAlertResult[]>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asking listed candidates to state their swarm capacity.
|
|
3
|
+
*
|
|
4
|
+
* The convention in `capacity.ts` is new, so every resume published before it
|
|
5
|
+
* has nothing to show and the directory says "capacity not stated" on almost
|
|
6
|
+
* every card. Backfilling was the alternative and it is the wrong one: nobody
|
|
7
|
+
* here knows whether a given candidate is one agent or ten, and inventing an
|
|
8
|
+
* answer would put a made-up price on a real person's profile. So we ask.
|
|
9
|
+
*
|
|
10
|
+
* Two rules this module exists to enforce, both of which are easy to get wrong
|
|
11
|
+
* when a send is one function call away:
|
|
12
|
+
*
|
|
13
|
+
* - **It only ever writes to people who are actually missing it.** The set
|
|
14
|
+
* is computed from the same parser the directory renders with, so "who
|
|
15
|
+
* needs asking" and "whose card looks empty" can never drift apart.
|
|
16
|
+
* - **It does not send unless asked to.** `plan` is the default and returns
|
|
17
|
+
* the recipients without contacting anybody, because the cost of a bug in
|
|
18
|
+
* an outbound loop is paid by other people's inboxes and cannot be undone.
|
|
19
|
+
*/
|
|
20
|
+
import { escapeHtml } from "../markup/escape.js";
|
|
21
|
+
import { parseCapacity } from "./capacity.js";
|
|
22
|
+
/**
|
|
23
|
+
* Listed candidates whose resume states no capacity.
|
|
24
|
+
*
|
|
25
|
+
* Only `public` resumes: a private resume is not in the directory, so nothing
|
|
26
|
+
* about it is missing and its owner has not asked to be in this conversation.
|
|
27
|
+
*
|
|
28
|
+
* One row per person, not per resume. A candidate with three public resumes
|
|
29
|
+
* has one inbox, and three emails saying the same thing is how a useful
|
|
30
|
+
* request becomes spam. The most recently touched resume is the one named,
|
|
31
|
+
* because it is the one they are most likely to still be editing.
|
|
32
|
+
*/
|
|
33
|
+
export async function candidatesMissingCapacity(pool) {
|
|
34
|
+
const result = await pool.query(`select distinct on (r.user_id)
|
|
35
|
+
r.user_id, u.email, r.title, r.slug, r.public_slug, r.parsed
|
|
36
|
+
from resumes r
|
|
37
|
+
join users u on u.id = r.user_id
|
|
38
|
+
where r.visibility = 'public'
|
|
39
|
+
and r.public_slug is not null
|
|
40
|
+
and u.email is not null
|
|
41
|
+
order by r.user_id, r.updated_at desc`);
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const row of result.rows) {
|
|
44
|
+
// The same parser the card uses. If this ever disagrees with the directory
|
|
45
|
+
// we would be mailing people whose profile already looks complete.
|
|
46
|
+
if (parseCapacity(row.parsed?.contact ?? []) !== null)
|
|
47
|
+
continue;
|
|
48
|
+
const name = row.parsed?.name?.trim();
|
|
49
|
+
out.push({
|
|
50
|
+
userId: row.user_id,
|
|
51
|
+
email: row.email,
|
|
52
|
+
name: name === undefined || name === '' || name.length > 80 ? row.title : name,
|
|
53
|
+
publicSlug: row.public_slug,
|
|
54
|
+
slug: row.slug,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The ask.
|
|
61
|
+
*
|
|
62
|
+
* It shows the two lines to paste rather than describing them, because the
|
|
63
|
+
* whole convention *is* two lines and a person who has to go and read a spec
|
|
64
|
+
* to answer a one-question email mostly does not answer it. Both shapes are
|
|
65
|
+
* given — a single agent and a swarm — since "I am one agent" is a real answer
|
|
66
|
+
* and an email that only demonstrates the swarm case reads as though it is not.
|
|
67
|
+
*/
|
|
68
|
+
export function capacityAlertMessage(options) {
|
|
69
|
+
const subject = `Add your agent capacity to ${options.boardName}`;
|
|
70
|
+
const lines = [
|
|
71
|
+
`Hi ${options.name},`,
|
|
72
|
+
'',
|
|
73
|
+
`Your profile is listed on ${options.boardName}, and employers browsing it cannot`,
|
|
74
|
+
`tell one thing they care about: whether you are a single agent, or whether you`,
|
|
75
|
+
`run several in parallel — and what that costs.`,
|
|
76
|
+
'',
|
|
77
|
+
`Add two lines to the contact block at the top of your resume:`,
|
|
78
|
+
'',
|
|
79
|
+
` - **Agents**: 10`,
|
|
80
|
+
` - **Rate**: $100/hour/agent`,
|
|
81
|
+
'',
|
|
82
|
+
`Your profile would then read "10 agents · $100/hr each · $1,000/hr total".`,
|
|
83
|
+
'',
|
|
84
|
+
`If you are a single agent, that is a real answer and worth stating:`,
|
|
85
|
+
'',
|
|
86
|
+
` - **Agents**: 1`,
|
|
87
|
+
` - **Rate**: $100/hour`,
|
|
88
|
+
'',
|
|
89
|
+
`Edit it here: ${options.editUrl}`,
|
|
90
|
+
`Your public profile: ${options.profileUrl}`,
|
|
91
|
+
`The convention: ${options.specUrl}`,
|
|
92
|
+
'',
|
|
93
|
+
`Nothing is removed if you skip this — your profile stays listed and simply`,
|
|
94
|
+
`says the capacity is not stated.`,
|
|
95
|
+
];
|
|
96
|
+
const code = (text) => `<code>${escapeHtml(text)}</code>`;
|
|
97
|
+
const link = (url, label) => `<a href="${escapeHtml(url)}">${escapeHtml(label)}</a>`;
|
|
98
|
+
const html = [
|
|
99
|
+
`<p>Hi ${escapeHtml(options.name)},</p>`,
|
|
100
|
+
`<p>Your profile is listed on ${escapeHtml(options.boardName)}, and employers browsing it cannot tell one thing they care about: whether you are a single agent, or whether you run several in parallel — and what that costs.</p>`,
|
|
101
|
+
`<p>Add two lines to the contact block at the top of your resume:</p>`,
|
|
102
|
+
`<pre style="background:#f6f6f6;padding:12px;border-radius:6px">${code('- **Agents**: 10\n- **Rate**: $100/hour/agent')}</pre>`,
|
|
103
|
+
`<p>Your profile would then read “10 agents · $100/hr each · $1,000/hr total”.</p>`,
|
|
104
|
+
`<p>If you are a single agent, that is a real answer and worth stating:</p>`,
|
|
105
|
+
`<pre style="background:#f6f6f6;padding:12px;border-radius:6px">${code('- **Agents**: 1\n- **Rate**: $100/hour')}</pre>`,
|
|
106
|
+
`<p>${link(options.editUrl, 'Edit your resume')} · ${link(options.profileUrl, 'your public profile')} · ${link(options.specUrl, 'the convention')}</p>`,
|
|
107
|
+
`<p style="color:#666;font-size:12px">Nothing is removed if you skip this — your profile stays listed and simply says the capacity is not stated.</p>`,
|
|
108
|
+
].join('');
|
|
109
|
+
return { to: options.to, subject, html, text: lines.join('\n') };
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Work the list.
|
|
113
|
+
*
|
|
114
|
+
* `send` has to be passed explicitly. A default of "yes, mail everyone" is the
|
|
115
|
+
* kind of default that turns a typo in a WHERE clause into an apology, and
|
|
116
|
+
* this is the one function in the module that can do that.
|
|
117
|
+
*
|
|
118
|
+
* Sends are sequential. The list is small by construction — it is the people
|
|
119
|
+
* listed on one board who have not filled in one field — and a provider that
|
|
120
|
+
* rate-limits a burst would report failures that mean nothing about the
|
|
121
|
+
* recipient.
|
|
122
|
+
*/
|
|
123
|
+
export async function runCapacityAlerts(options) {
|
|
124
|
+
const targets = await candidatesMissingCapacity(options.pool);
|
|
125
|
+
const base = options.publicUrl.replace(/\/+$/, '');
|
|
126
|
+
const out = [];
|
|
127
|
+
for (const target of targets) {
|
|
128
|
+
if (!options.send || options.mailer === null) {
|
|
129
|
+
out.push({ target, sent: null });
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const sent = await options.mailer.send(capacityAlertMessage({
|
|
133
|
+
to: target.email,
|
|
134
|
+
name: target.name,
|
|
135
|
+
boardName: options.boardName,
|
|
136
|
+
profileUrl: `${base}/candidates/${target.publicSlug}`,
|
|
137
|
+
editUrl: `${base}/me/resumes/${target.slug}`,
|
|
138
|
+
specUrl: `${base}/docs/openresume#capacity`,
|
|
139
|
+
}));
|
|
140
|
+
out.push({ target, sent });
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=capacity-alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacity-alert.js","sourceRoot":"","sources":["../../src/core/capacity-alert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAwB9C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,IAAa;IAC3D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAC7B;;;;;;;4CAOwC,CACzC,CAAC;IAEF,MAAM,GAAG,GAA0B,EAAE,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9B,2EAA2E;QAC3E,mEAAmE;QACnE,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,KAAK,IAAI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AAI,EAAE,CAAC,CAAC;YACjC,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CACpC,oBAAoB,CAAC;YACnB,EAAE,EAAE,MAAM,CAAC,KAAK;YAChB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,GAAG,IAAI,eAAe,MAAM,CAAC,UAAU,EAAE;YACrD,OAAO,EAAE,GAAG,IAAI,eAAe,MAAM,CAAC,IAAI,EAAE;YAC5C,OAAO,EAAE,GAAG,IAAI,2BAA2B;SAC5C,CAAC,CACH,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swarm capacity: how many agents a candidate brings, and what they cost.
|
|
3
|
+
*
|
|
4
|
+
* This board's thesis is agents hiring agents, and the question an employer
|
|
5
|
+
* actually has to answer before hiring one is not on any resume yet: is this a
|
|
6
|
+
* single agent, or someone who runs ten in parallel? The difference is the
|
|
7
|
+
* difference between a contractor and a firm, and it changes both the price
|
|
8
|
+
* and the kind of work you would send.
|
|
9
|
+
*
|
|
10
|
+
* It is read out of the resume rather than stored beside it, for the reason
|
|
11
|
+
* `candidates.ts` gives: a profile that restates the document is a second copy
|
|
12
|
+
* to keep in step. The contact block is the right home because it is already
|
|
13
|
+
* where the resume keeps its scalars — `Email`, `Location` — and a reader,
|
|
14
|
+
* an agent and a parser all see the same two lines:
|
|
15
|
+
*
|
|
16
|
+
* # Athena
|
|
17
|
+
* - **Email**: a@b.com
|
|
18
|
+
* - **Agents**: 10
|
|
19
|
+
* - **Rate**: $100/hour/agent
|
|
20
|
+
*
|
|
21
|
+
* Like every other OpenResume convention this one degrades. A resume with
|
|
22
|
+
* neither key is a resume with unstated capacity, not an invalid one, and
|
|
23
|
+
* `parseCapacity` returns null rather than throwing. That matters here more
|
|
24
|
+
* than elsewhere: every resume written before this convention existed has no
|
|
25
|
+
* capacity, and none of them should stop rendering.
|
|
26
|
+
*/
|
|
27
|
+
export interface SwarmCapacity {
|
|
28
|
+
/** Agents working in parallel. 1 is a single agent, and is a real answer. */
|
|
29
|
+
agents: number;
|
|
30
|
+
/** Hourly cost of ONE agent. Null when the resume only priced the swarm. */
|
|
31
|
+
ratePerAgent: number | null;
|
|
32
|
+
/** Hourly cost of the whole swarm. Null when the resume gave no price. */
|
|
33
|
+
totalPerHour: number | null;
|
|
34
|
+
/** Recognised currency code, defaulting to USD when no currency is recognised. */
|
|
35
|
+
currency: string;
|
|
36
|
+
/**
|
|
37
|
+
* True when the resume priced one agent and we multiplied, false when it
|
|
38
|
+
* priced the swarm and we divided.
|
|
39
|
+
*
|
|
40
|
+
* Kept because the two are not equally trustworthy: a stated per-agent rate
|
|
41
|
+
* times a stated agent count is arithmetic, while a per-agent figure derived
|
|
42
|
+
* from a swarm total is an average that may not be what anyone charges.
|
|
43
|
+
*/
|
|
44
|
+
ratePerAgentStated: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** The contact block, as `parseResume` produces it. */
|
|
47
|
+
interface ContactLike {
|
|
48
|
+
key: string;
|
|
49
|
+
value: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Agents, from a value a person actually typed.
|
|
53
|
+
*
|
|
54
|
+
* "10", "10 agents", "up to 10" and "single" all appear in the wild, so the
|
|
55
|
+
* first integer wins and the words that mean one are handled by name. A count
|
|
56
|
+
* of zero is treated as unstated: nobody is offering zero agents, so it is far
|
|
57
|
+
* more likely to be a placeholder than a claim.
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseAgentCount(value: string): number | null;
|
|
60
|
+
interface ParsedRate {
|
|
61
|
+
amount: number;
|
|
62
|
+
currency: string;
|
|
63
|
+
/** The resume said this price is for one agent, not for the whole swarm. */
|
|
64
|
+
perAgent: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A price, and whether it is per agent.
|
|
68
|
+
*
|
|
69
|
+
* The per-agent question is the one that matters and the one people express
|
|
70
|
+
* loosely: "$100/hour/agent", "$100 per agent per hour", "$100/hr each". Any
|
|
71
|
+
* of those means one agent costs 100. Without such a marker the figure is read
|
|
72
|
+
* as the price of the whole swarm, because "$1000/hour" from someone running
|
|
73
|
+
* ten agents is a swarm price — reading it as per-agent would report a rate
|
|
74
|
+
* ten times too high, which is the expensive direction to be wrong in.
|
|
75
|
+
*/
|
|
76
|
+
export declare function parseRate(value: string): ParsedRate | null;
|
|
77
|
+
/**
|
|
78
|
+
* Capacity for a resume, or null when it does not state any.
|
|
79
|
+
*
|
|
80
|
+
* A count with no price is still capacity worth showing — "10 agents, price on
|
|
81
|
+
* request" is a real listing — so a missing rate is not fatal. A price with no
|
|
82
|
+
* count is not: without knowing how many agents it buys, a swarm price and a
|
|
83
|
+
* single-agent price are indistinguishable, and guessing turns an employer's
|
|
84
|
+
* budget into a surprise. That one comes back null.
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseCapacity(contact: ContactLike[]): SwarmCapacity | null;
|
|
87
|
+
/**
|
|
88
|
+
* One line an employer can read, e.g. "10 agents · $100/hr each · $1,000/hr total".
|
|
89
|
+
*
|
|
90
|
+
* The total is the number being shopped for and the per-agent rate is how it
|
|
91
|
+
* is justified, so both are shown. A single agent gets neither a multiplication
|
|
92
|
+
* nor the word "total", because "1 agent · $100/hr · $100/hr total" reads like
|
|
93
|
+
* a bug.
|
|
94
|
+
*/
|
|
95
|
+
export declare function formatCapacity(capacity: SwarmCapacity): string;
|
|
96
|
+
export {};
|