openings 0.1.54 → 0.1.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openings",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "A free, candidate-safe job-search substrate for AI agents",
5
5
  "license": "MIT",
6
6
  "repository": { "type": "git", "url": "git+https://github.com/abhay-avagama/hiring-agent.git" },
package/src/crawler.ts CHANGED
@@ -31,6 +31,14 @@ interface CrawlerOptions {
31
31
  * including one whose board states no date at all. The nightly crawl keeps the 30-day default so it spends
32
32
  * its small budget on what is new; the catch-up pass lifts it to reach roles still listed but long posted. */
33
33
  describeMaxAgeDays?: number;
34
+ /**
35
+ * Whether the snapshot written to disk keeps the description text. A local install needs it: the snapshot is
36
+ * its only copy. A server crawl reports every source to an aggregator that stores them, so keeping a second
37
+ * copy only costs memory — on one box the file reached 1.3 GB and parsing it needed more RAM than the machine
38
+ * had, which killed the crawl for seven nights. The experience read out of each description is always kept,
39
+ * so a role already read is never fetched twice.
40
+ */
41
+ retainDescriptions?: boolean;
34
42
  pacingNow?: () => number;
35
43
  pacingSleep?: (delayMs: number) => Promise<void>;
36
44
  now?: () => Date;
@@ -190,7 +198,9 @@ export function createCrawler(options: CrawlerOptions): Crawler {
190
198
  cached: considered - eligibleSources.length, deferred: eligibleSources.length - selectedSources.length,
191
199
  succeeded, failed: finalFailures, sources: selectedSources.map((source) => metrics.get(source.slug)!),
192
200
  };
193
- await options.store.write({ version: 1, updatedAt: finishedAt, partitions, lastCrawl: report });
201
+ // Reporting below still sends the full partitions; only the copy kept on disk is lightened.
202
+ const stored = options.retainDescriptions === false ? withoutDescriptions(partitions) : partitions;
203
+ await options.store.write({ version: 1, updatedAt: finishedAt, partitions: stored, lastCrawl: report });
194
204
  if (options.onCrawled) {
195
205
  const crawled = selectedSources.filter((source) => metrics.get(source.slug)!.status === "succeeded");
196
206
  // Four at a time: sending a thousand reports at once made the largest ones time out while the aggregator queued them.
@@ -204,6 +214,18 @@ export function createCrawler(options: CrawlerOptions): Crawler {
204
214
  }
205
215
 
206
216
  // ponytail: per-source caps keep one crawl bounded; a big backlog (first run) drains over a few nights.
217
+ /**
218
+ * The same partitions with the description text left out. Everything the next crawl needs to avoid re-reading a
219
+ * description — the experience and its version — is kept, so this costs nothing but the bytes.
220
+ */
221
+ function withoutDescriptions(partitions: JobSnapshot["partitions"]): JobSnapshot["partitions"] {
222
+ const out: JobSnapshot["partitions"] = {};
223
+ for (const [slug, partition] of Object.entries(partitions)) {
224
+ out[slug] = { ...partition, jobs: partition.jobs.map((job) => (job.description ? { ...job, description: "" } : job)) };
225
+ }
226
+ return out;
227
+ }
228
+
207
229
  /** Defaults for the nightly crawl, where the point is to keep every source moving rather than finish any one. */
208
230
  const DESCRIBE_LIMIT = 150;
209
231
  const DESCRIBE_MAX_AGE_DAYS = 30;
package/src/local-jobs.ts CHANGED
@@ -20,6 +20,7 @@ interface LocalJobsOptions {
20
20
  describeLimit?: number;
21
21
  describeBudgetMs?: number;
22
22
  describeMaxAgeDays?: number;
23
+ retainDescriptions?: boolean;
23
24
  now?: () => Date;
24
25
  onCrawled?(source: Company, partition: JobPartition): void | Promise<void>;
25
26
  }
package/src/runtime.ts CHANGED
@@ -41,6 +41,8 @@ export function createRuntime(options: { dataDir?: string; concurrency?: number;
41
41
  describeLimit: positiveEnv("OPENINGS_DESCRIBE_LIMIT"),
42
42
  describeBudgetMs: positiveEnv("OPENINGS_DESCRIBE_BUDGET_MS"),
43
43
  describeMaxAgeDays: wholeEnv("OPENINGS_DESCRIBE_MAX_AGE_DAYS"),
44
+ // Server crawls set this off: the aggregator they report to is the system of record for descriptions.
45
+ retainDescriptions: process.env.OPENINGS_RETAIN_DESCRIPTIONS !== "off",
44
46
  onCrawled,
45
47
  });
46
48
  const recommender = createJobRecommender({ sources: companies, store, crawl: local.crawl });
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.1.54";
1
+ export const VERSION = "0.1.55";