job-application-agent 3.1.2 → 3.2.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 +4 -3
- package/job-application-agent/SKILL.md +5 -4
- package/job-application-agent/references/ANALYTICS.md +1 -1
- package/job-application-agent/references/SCHEMAS.md +1 -1
- package/job-application-agent/references/SOURCES.md +14 -7
- package/job-application-agent/scripts/job-application.mjs +92 -14
- package/job-application-agent/scripts/source-community-client.mjs +99 -15
- package/job-application-agent/scripts/source-community-schema.mjs +141 -1
- package/job-application-agent/scripts/telemetry-client.mjs +3 -1
- package/job-application-agent/scripts/version.mjs +1 -0
- package/job-application-agent/tests/job-application.test.mjs +1 -0
- package/job-application-agent/tests/privacy-audit.test.mjs +24 -1
- package/job-application-agent/tests/source-community-client.test.mjs +108 -2
- package/job-application-agent/tests/source-community-schema.test.mjs +105 -1
- package/job-application-agent/tests/version.test.mjs +12 -0
- package/job-application-agent/tests/workflow-state.test.mjs +114 -2
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { join } from 'node:path';
|
|
|
6
6
|
import test from 'node:test';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
|
|
9
|
-
import { sourcesSync } from '../scripts/job-application.mjs';
|
|
9
|
+
import { communityJobsPending, communityJobsSync, sourcesList, sourcesSync, validateLedgerEntry } from '../scripts/job-application.mjs';
|
|
10
10
|
|
|
11
11
|
const script = fileURLToPath(new URL('../scripts/job-application.mjs', import.meta.url));
|
|
12
12
|
|
|
@@ -180,7 +180,26 @@ test('ships a filterable global discovery source catalog and tracks source attri
|
|
|
180
180
|
answers: {},
|
|
181
181
|
});
|
|
182
182
|
assert.equal(invalidSource.status, 1);
|
|
183
|
-
assert.match(invalidSource.stderr, /packaged source
|
|
183
|
+
assert.match(invalidSource.stderr, /packaged or community source ID/i);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('community registry IDs remain usable as local discovery attribution', async () => {
|
|
187
|
+
const communitySource = {
|
|
188
|
+
sourceId: 'community-abcdef1234567890',
|
|
189
|
+
name: 'Example Engineering Board',
|
|
190
|
+
baseUrl: 'https://jobs.example.org/openings',
|
|
191
|
+
kind: 'job-board',
|
|
192
|
+
regions: ['global'],
|
|
193
|
+
roleFamilies: ['engineering'],
|
|
194
|
+
requiresSession: false,
|
|
195
|
+
registryStatus: 'community-reviewed',
|
|
196
|
+
contributionCount: 2,
|
|
197
|
+
};
|
|
198
|
+
const listed = await sourcesList({}, [communitySource]);
|
|
199
|
+
const source = listed.sources.find((entry) => entry.id === communitySource.sourceId);
|
|
200
|
+
assert.equal(source.communitySourceId, communitySource.sourceId);
|
|
201
|
+
const entry = validateLedgerEntry(submission(21, null, { discoverySourceId: source.id }));
|
|
202
|
+
assert.equal(entry.discoverySourceId, communitySource.sourceId);
|
|
184
203
|
});
|
|
185
204
|
|
|
186
205
|
test('queues sanitized repeatable source suggestions locally for public-registry review', async (t) => {
|
|
@@ -268,6 +287,99 @@ test('source sync counts only the contribution actually attempted before an unav
|
|
|
268
287
|
assert.deepEqual(result, { attempted: 1, shared: 0, remaining: 2 });
|
|
269
288
|
});
|
|
270
289
|
|
|
290
|
+
test('combined community sync preserves the existing top-level source result', async (t) => {
|
|
291
|
+
const { env } = await fixture(t, 'combined-community-sync-contract');
|
|
292
|
+
const result = cli(env, ['sources', 'sync']);
|
|
293
|
+
assert.equal(result.attempted, 0);
|
|
294
|
+
assert.equal(result.shared, 0);
|
|
295
|
+
assert.equal(result.remaining, 0);
|
|
296
|
+
assert.deepEqual(result.communityJobs, { attempted: 0, shared: 0, remaining: 0, unshareable: 0 });
|
|
297
|
+
assert.equal('sources' in result, false);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test('backfills confirmed ledger jobs with only public fields and durable receipts', async (t) => {
|
|
301
|
+
const { directory } = await fixture(t, 'community-job-backfill');
|
|
302
|
+
const previous = process.env.JOB_APPLICATION_AGENT_STATE_DIR;
|
|
303
|
+
process.env.JOB_APPLICATION_AGENT_STATE_DIR = directory;
|
|
304
|
+
t.after(() => {
|
|
305
|
+
if (previous == null) delete process.env.JOB_APPLICATION_AGENT_STATE_DIR;
|
|
306
|
+
else process.env.JOB_APPLICATION_AGENT_STATE_DIR = previous;
|
|
307
|
+
});
|
|
308
|
+
await writeFile(join(directory, 'applications.ndjson'), [
|
|
309
|
+
submission(201, null, { url: 'https://jobs.ashbyhq.com/example/12345678-1234-4123-8123-123456789abc?ref=candidate@example.com#apply' }),
|
|
310
|
+
submission(202, null, { url: 'https://job-boards.greenhouse.io/example/jobs/7654321?token=private' }),
|
|
311
|
+
submission(203, null, { url: 'https://linkedin.com/in/private-person' }),
|
|
312
|
+
].map(JSON.stringify).join('\n').concat('\n'));
|
|
313
|
+
const posted = [];
|
|
314
|
+
const community = {
|
|
315
|
+
contributeJob: async (job) => {
|
|
316
|
+
posted.push(job);
|
|
317
|
+
return { shared: true, jobId: `community-job-${String(posted.length).padStart(16, '0')}`, contributionCount: 1 };
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
assert.deepEqual(await communityJobsSync(community, { limit: 1 }), { attempted: 1, shared: 1, remaining: 1, unshareable: 1 });
|
|
322
|
+
assert.deepEqual(Object.keys(posted[0]).sort(), ['applicationChannel', 'company', 'discoverySource', 'providerUrl', 'role', 'url']);
|
|
323
|
+
assert.equal(posted[0].url.includes('candidate@example.com'), false);
|
|
324
|
+
assert.equal(JSON.stringify(posted[0]).includes('answers'), false);
|
|
325
|
+
assert.equal(JSON.stringify(posted[0]).includes('submittedAt'), false);
|
|
326
|
+
assert.equal(JSON.stringify(posted[0]).includes('score'), false);
|
|
327
|
+
assert.deepEqual(await communityJobsSync(community, { limit: 10 }), { attempted: 1, shared: 1, remaining: 0, unshareable: 1 });
|
|
328
|
+
assert.equal(posted.length, 2);
|
|
329
|
+
assert.deepEqual(await communityJobsPending(), { count: 0, unshareable: 1, applications: [] });
|
|
330
|
+
|
|
331
|
+
const receipts = (await readFile(join(directory, 'community-job-contribution-receipts.ndjson'), 'utf8')).trim().split('\n').map(JSON.parse);
|
|
332
|
+
assert.deepEqual(Object.keys(receipts[0]).sort(), ['applicationId', 'jobId', 'sharedAt']);
|
|
333
|
+
assert.equal(JSON.stringify(receipts).includes('candidate@example.com'), false);
|
|
334
|
+
if (process.platform !== 'win32') assert.equal((await stat(join(directory, 'community-job-contribution-receipts.ndjson'))).mode & 0o777, 0o600);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
test('community job retries stop on relay failure without marking the application shared', async (t) => {
|
|
338
|
+
const { directory } = await fixture(t, 'community-job-retry');
|
|
339
|
+
const previous = process.env.JOB_APPLICATION_AGENT_STATE_DIR;
|
|
340
|
+
process.env.JOB_APPLICATION_AGENT_STATE_DIR = directory;
|
|
341
|
+
t.after(() => {
|
|
342
|
+
if (previous == null) delete process.env.JOB_APPLICATION_AGENT_STATE_DIR;
|
|
343
|
+
else process.env.JOB_APPLICATION_AGENT_STATE_DIR = previous;
|
|
344
|
+
});
|
|
345
|
+
await writeFile(join(directory, 'applications.ndjson'), `${JSON.stringify(submission(204))}\n`);
|
|
346
|
+
let calls = 0;
|
|
347
|
+
const result = await communityJobsSync({ contributeJob: async () => { calls += 1; return { shared: false, reason: 'unavailable' }; } });
|
|
348
|
+
assert.deepEqual(result, { attempted: 1, shared: 0, remaining: 1, unshareable: 0 });
|
|
349
|
+
assert.equal(calls, 1);
|
|
350
|
+
assert.deepEqual((await communityJobsPending()).applications.map((entry) => entry.applicationId), ['round-role-204']);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test('community job backfill stops for the disclosure grace command', async (t) => {
|
|
354
|
+
const { directory } = await fixture(t, 'community-job-grace');
|
|
355
|
+
const previous = process.env.JOB_APPLICATION_AGENT_STATE_DIR;
|
|
356
|
+
process.env.JOB_APPLICATION_AGENT_STATE_DIR = directory;
|
|
357
|
+
t.after(() => {
|
|
358
|
+
if (previous == null) delete process.env.JOB_APPLICATION_AGENT_STATE_DIR;
|
|
359
|
+
else process.env.JOB_APPLICATION_AGENT_STATE_DIR = previous;
|
|
360
|
+
});
|
|
361
|
+
await writeFile(join(directory, 'applications.ndjson'), [submission(205), submission(206)].map(JSON.stringify).join('\n').concat('\n'));
|
|
362
|
+
let calls = 0;
|
|
363
|
+
const result = await communityJobsSync({ contributeJob: async () => {
|
|
364
|
+
calls += 1;
|
|
365
|
+
return { shared: false, reason: 'grace' };
|
|
366
|
+
} });
|
|
367
|
+
assert.deepEqual(result, { attempted: 1, shared: 0, remaining: 2, unshareable: 0 });
|
|
368
|
+
assert.equal(calls, 1);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
test('ledger add automatically attempts community sharing and reports durable pending work', async (t) => {
|
|
372
|
+
const { env } = await fixture(t, 'community-job-ledger-hook');
|
|
373
|
+
const result = cli(env, ['ledger', 'add', '--stdin'], submission(20, null, { id: 'community-ledger-hook' }));
|
|
374
|
+
assert.equal(result.recorded, 'community-ledger-hook');
|
|
375
|
+
assert.deepEqual(result.communityJob, { attempted: 1, shared: 0, remaining: 1, unshareable: 0 });
|
|
376
|
+
|
|
377
|
+
const pending = cli(env, ['sources', 'pending']);
|
|
378
|
+
assert.equal(pending.communityJobs.count, 1);
|
|
379
|
+
assert.equal(pending.communityJobs.applications[0].applicationId, 'community-ledger-hook');
|
|
380
|
+
assert.equal(JSON.stringify(pending.communityJobs).includes('answers'), false);
|
|
381
|
+
});
|
|
382
|
+
|
|
271
383
|
test('blocks a different role at the same company during the 15-day cooldown', async (t) => {
|
|
272
384
|
const { env } = await fixture(t, 'company-cooldown-enforced');
|
|
273
385
|
const recent = new Date(Date.now() - (5 * 86_400_000)).toISOString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "job-application-agent",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A privacy-first Agent Skill and CLI for evidence-based job discovery, application completion, and outcome tracking.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"check:native-artifacts": "node scripts/ci/validate-native-artifacts.mjs",
|
|
39
39
|
"privacy-audit": "node --test job-application-agent/tests/privacy-audit.test.mjs",
|
|
40
40
|
"smoke:package": "node scripts/smoke-package.mjs",
|
|
41
|
-
"check": "node --check job-application-agent/scripts/job-application.mjs && node --check job-application-agent/scripts/secret-store.mjs && node --check job-application-agent/scripts/source-community-client.mjs && node --check job-application-agent/scripts/source-community-schema.mjs && node --check job-application-agent/scripts/telemetry-client.mjs && node --check job-application-agent/scripts/telemetry-schema.mjs && node --check telemetry-worker/src/worker.mjs && node --check telemetry-worker/src/public-stats.mjs && node --check telemetry-worker/public/dashboard.js && node --check installer/src/cli.mjs && node --check installer/src/installer.mjs && node --check installer/src/runner.mjs && node --check installer/src/scheduler.mjs && node --check scripts/ci/classify-paths.mjs && node --check scripts/ci/validate-native-artifacts.mjs && node --check bin/job-application-agent.mjs",
|
|
41
|
+
"check": "node --check job-application-agent/scripts/job-application.mjs && node --check job-application-agent/scripts/secret-store.mjs && node --check job-application-agent/scripts/source-community-client.mjs && node --check job-application-agent/scripts/source-community-schema.mjs && node --check job-application-agent/scripts/telemetry-client.mjs && node --check job-application-agent/scripts/telemetry-schema.mjs && node --check job-application-agent/scripts/version.mjs && node --check telemetry-worker/src/worker.mjs && node --check telemetry-worker/src/public-stats.mjs && node --check telemetry-worker/public/dashboard.js && node --check installer/src/cli.mjs && node --check installer/src/installer.mjs && node --check installer/src/runner.mjs && node --check installer/src/scheduler.mjs && node --check scripts/ci/classify-paths.mjs && node --check scripts/ci/validate-native-artifacts.mjs && node --check bin/job-application-agent.mjs",
|
|
42
42
|
"prepack": "npm run check && npm test && npm run privacy-audit"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|