xtrawl 0.1.0 → 0.1.2

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.
Files changed (54) hide show
  1. package/DOCUMENTATION.md +127 -4
  2. package/LICENSE +21 -0
  3. package/README.md +170 -19
  4. package/dist/auth/account-state.d.ts +3 -0
  5. package/dist/auth/account-state.d.ts.map +1 -0
  6. package/dist/auth/account-state.js +85 -0
  7. package/dist/auth/account-state.js.map +1 -0
  8. package/dist/client/accounts.d.ts +31 -0
  9. package/dist/client/accounts.d.ts.map +1 -0
  10. package/dist/client/accounts.js +163 -0
  11. package/dist/client/accounts.js.map +1 -0
  12. package/dist/client/client.d.ts +16 -5
  13. package/dist/client/client.d.ts.map +1 -1
  14. package/dist/client/client.js +58 -19
  15. package/dist/client/client.js.map +1 -1
  16. package/dist/client/database.d.ts +2 -1
  17. package/dist/client/database.d.ts.map +1 -1
  18. package/dist/client/database.js +1 -1
  19. package/dist/client/database.js.map +1 -1
  20. package/dist/client/search.d.ts +3 -2
  21. package/dist/client/search.d.ts.map +1 -1
  22. package/dist/client/search.js +23 -7
  23. package/dist/client/search.js.map +1 -1
  24. package/dist/client/types.d.ts +2 -0
  25. package/dist/client/types.d.ts.map +1 -1
  26. package/dist/domain/account-state.d.ts +68 -0
  27. package/dist/domain/account-state.d.ts.map +1 -0
  28. package/dist/domain/account-state.js +2 -0
  29. package/dist/domain/account-state.js.map +1 -0
  30. package/dist/domain/errors.d.ts +3 -0
  31. package/dist/domain/errors.d.ts.map +1 -1
  32. package/dist/domain/errors.js +5 -0
  33. package/dist/domain/errors.js.map +1 -1
  34. package/dist/domain/records.d.ts +4 -0
  35. package/dist/domain/records.d.ts.map +1 -1
  36. package/dist/domain/requests.d.ts +4 -0
  37. package/dist/domain/requests.d.ts.map +1 -1
  38. package/dist/index.d.ts +7 -4
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +3 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/pool/account-pool.d.ts +12 -5
  43. package/dist/pool/account-pool.d.ts.map +1 -1
  44. package/dist/pool/account-pool.js +102 -13
  45. package/dist/pool/account-pool.js.map +1 -1
  46. package/dist/storage/account-repository.d.ts +8 -1
  47. package/dist/storage/account-repository.d.ts.map +1 -1
  48. package/dist/storage/account-repository.js +63 -26
  49. package/dist/storage/account-repository.js.map +1 -1
  50. package/docs/architecture/overview.md +16 -11
  51. package/docs/decisions/0003-caller-owned-account-state.md +33 -0
  52. package/docs/product/specification.md +19 -2
  53. package/docs/security/data-boundary.md +9 -2
  54. package/package.json +4 -3
@@ -7,6 +7,7 @@ const DEFAULT_DAILY_TWEETS_LIMIT = 600;
7
7
  const DEFAULT_LEASE_TTL_MS = 120_000;
8
8
  export class AccountRepository {
9
9
  database;
10
+ kind = "sqlite";
10
11
  dailyRequestsLimit;
11
12
  dailyTweetsLimit;
12
13
  leaseTtlMs;
@@ -19,16 +20,13 @@ export class AccountRepository {
19
20
  upsert(account) {
20
21
  const existing = this.findByUsername(account.username) ??
21
22
  (account.authToken ? this.findByAuthToken(account.authToken) : undefined);
22
- if (!existing) {
23
- this.database.run(`INSERT INTO accounts (username,password,email,email_password,two_factor_secret,auth_token,csrf_token,cookies_json,bearer_token,proxy_json,status,available_until,daily_requests,daily_tweets,total_tweets,last_reset_date)
24
- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, account.username, account.password ?? null, account.email ?? null, account.emailPassword ?? null, account.twoFactorSecret ?? null, account.authToken ?? null, account.csrfToken ?? null, JSON.stringify(account.cookies), account.bearerToken ?? null, account.proxy ? JSON.stringify(account.proxy) : null, account.status ?? 1, account.availableUntil ?? 0, account.dailyRequests ?? 0, account.dailyTweets ?? 0, account.totalTweets ?? 0, account.lastResetDate ?? utcDate());
25
- return this.findByUsername(account.username);
26
- }
23
+ if (!existing)
24
+ return this.insert(account);
27
25
  const username = existing.username.startsWith("auth_") && account.username !== existing.username
28
26
  ? account.username
29
27
  : existing.username;
30
28
  const cookies = { ...existing.cookies, ...account.cookies };
31
- this.database.run(`UPDATE accounts SET username=?, password=?, email=?, email_password=?, two_factor_secret=?, auth_token=?, csrf_token=?, cookies_json=?, bearer_token=?, proxy_json=?, status=?, available_until=?, daily_requests=?, daily_tweets=?, total_tweets=?, last_reset_date=? WHERE id=?`, username, account.password ?? existing.password ?? null, account.email ?? existing.email ?? null, account.emailPassword ?? existing.emailPassword ?? null, account.twoFactorSecret ?? existing.twoFactorSecret ?? null, account.authToken ?? existing.authToken ?? null, account.csrfToken ?? existing.csrfToken ?? null, JSON.stringify(cookies), account.bearerToken ?? existing.bearerToken ?? null, account.proxy ? JSON.stringify(account.proxy) : existing.proxy ? JSON.stringify(existing.proxy) : null, account.status ?? existing.status ?? 1, account.availableUntil ?? existing.availableUntil ?? 0, account.dailyRequests ?? existing.dailyRequests ?? 0, account.dailyTweets ?? existing.dailyTweets ?? 0, account.totalTweets ?? existing.totalTweets ?? 0, account.lastResetDate ?? existing.lastResetDate ?? utcDate(), existing.id ?? null);
29
+ this.database.run(`UPDATE accounts SET username=?, password=?, email=?, email_password=?, two_factor_secret=?, auth_token=?, csrf_token=?, cookies_json=?, bearer_token=?, proxy_json=?, status=?, available_until=?, daily_requests=?, daily_tweets=?, total_tweets=?, last_reset_date=?, last_used=?, last_error_code=?, cooldown_reason=? WHERE id=?`, username, account.password ?? existing.password ?? null, account.email ?? existing.email ?? null, account.emailPassword ?? existing.emailPassword ?? null, account.twoFactorSecret ?? existing.twoFactorSecret ?? null, account.authToken ?? existing.authToken ?? null, account.csrfToken ?? existing.csrfToken ?? null, JSON.stringify(cookies), account.bearerToken ?? existing.bearerToken ?? null, account.proxy ? JSON.stringify(account.proxy) : existing.proxy ? JSON.stringify(existing.proxy) : null, account.status ?? existing.status ?? 1, account.availableUntil ?? existing.availableUntil ?? 0, account.dailyRequests ?? existing.dailyRequests ?? 0, account.dailyTweets ?? existing.dailyTweets ?? 0, account.totalTweets ?? existing.totalTweets ?? 0, account.lastResetDate ?? existing.lastResetDate ?? utcDate(), account.lastUsed ?? existing.lastUsed ?? 0, account.lastErrorCode ?? existing.lastErrorCode ?? null, account.cooldownReason ?? existing.cooldownReason ?? null, existing.id ?? null);
32
30
  return this.findByUsername(username);
33
31
  }
34
32
  findByUsername(username) {
@@ -45,6 +43,13 @@ export class AccountRepository {
45
43
  delete(username) {
46
44
  return this.database.run("DELETE FROM accounts WHERE username=?", username).changes === 1;
47
45
  }
46
+ replaceAll(accounts) {
47
+ this.database.transaction(() => {
48
+ this.database.run("DELETE FROM accounts");
49
+ for (const account of accounts)
50
+ this.insert(account);
51
+ });
52
+ }
48
53
  setProxy(username, proxy) {
49
54
  return (this.database.run("UPDATE accounts SET proxy_json=? WHERE username=?", proxy === undefined ? null : JSON.stringify(proxy), username).changes === 1);
50
55
  }
@@ -64,22 +69,39 @@ export class AccountRepository {
64
69
  }
65
70
  lease(options = {}) {
66
71
  const now = options.now ?? Date.now();
67
- this.resetExpiredCooldowns(now);
68
- this.resetDailyCounters();
69
- const candidates = this.list().filter((row) => this.isEligible(row, now, false, options.requireAuthMaterial ?? true));
70
- const selected = candidates.sort((a, b) => (a.lastUsed ?? 0) - (b.lastUsed ?? 0))[0];
71
- if (!selected?.id)
72
- return undefined;
73
- const leaseId = randomUUID();
74
- const expiresAt = now + this.leaseTtlMs;
75
- const changed = this.database.run("UPDATE accounts SET lease_id=?, lease_expires_at=?, last_used=? WHERE id=? AND (lease_id IS NULL OR lease_expires_at<?)", leaseId, expiresAt, now, selected.id, now).changes;
76
- if (changed !== 1)
77
- return undefined;
78
- const current = this.findByUsername(selected.username);
79
- return current ? { ...current, leaseId, leaseExpiresAt: expiresAt } : undefined;
72
+ return this.acquireLease({
73
+ now,
74
+ leaseId: randomUUID(),
75
+ leaseExpiresAt: now + this.leaseTtlMs,
76
+ utcDate: utcDate(now),
77
+ requireAuthMaterial: options.requireAuthMaterial ?? true,
78
+ dailyRequestsLimit: this.dailyRequestsLimit,
79
+ dailyTweetsLimit: this.dailyTweetsLimit,
80
+ });
81
+ }
82
+ acquireLease(request) {
83
+ return this.database.transaction(() => {
84
+ this.resetExpiredCooldowns(request.now);
85
+ this.resetDailyCounters(request.utcDate);
86
+ const candidates = this.list().filter((row) => this.isEligible(row, request.now, false, request.requireAuthMaterial, request.dailyRequestsLimit, request.dailyTweetsLimit));
87
+ const selected = candidates.sort((a, b) => (a.lastUsed ?? 0) - (b.lastUsed ?? 0))[0];
88
+ if (!selected?.id)
89
+ return undefined;
90
+ const changed = this.database.run("UPDATE accounts SET lease_id=?, lease_expires_at=?, last_used=? WHERE id=? AND (lease_id IS NULL OR lease_expires_at<?)", request.leaseId, request.leaseExpiresAt, request.now, selected.id, request.now).changes;
91
+ if (changed !== 1)
92
+ return undefined;
93
+ const current = this.findByUsername(selected.username);
94
+ return current
95
+ ? { ...current, leaseId: request.leaseId, leaseExpiresAt: request.leaseExpiresAt }
96
+ : undefined;
97
+ });
80
98
  }
81
99
  heartbeat(leaseId, extendByMs) {
82
- return (this.database.run("UPDATE accounts SET lease_expires_at=? WHERE lease_id=?", Date.now() + extendByMs, leaseId).changes === 1);
100
+ return this.renewLease(leaseId, Date.now() + extendByMs);
101
+ }
102
+ renewLease(leaseId, leaseExpiresAt) {
103
+ return (this.database.run("UPDATE accounts SET lease_expires_at=? WHERE lease_id=?", leaseExpiresAt, leaseId)
104
+ .changes === 1);
83
105
  }
84
106
  recordUsage(leaseId, pages = 1, tweets = 0) {
85
107
  this.resetDailyCounters();
@@ -90,6 +112,17 @@ export class AccountRepository {
90
112
  const availableUntil = options.availableUntil ?? (status === 1 ? 0 : Date.now());
91
113
  return (this.database.run("UPDATE accounts SET lease_id=NULL, lease_expires_at=NULL, status=?, available_until=?, last_error_code=?, cooldown_reason=? WHERE lease_id=?", status, availableUntil, options.lastErrorCode ?? null, options.cooldownReason ?? null, leaseId).changes === 1);
92
114
  }
115
+ completeLease(completion) {
116
+ return this.database.transaction(() => {
117
+ this.resetDailyCounters(completion.utcDate);
118
+ const status = completion.status === "unusable" ? 0 : completion.status === "cooling_down" ? 2 : 1;
119
+ return (this.database.run(`UPDATE accounts
120
+ SET lease_id=NULL, lease_expires_at=NULL, status=?, available_until=?,
121
+ daily_requests=daily_requests+?, daily_tweets=daily_tweets+?,
122
+ total_tweets=total_tweets+?, last_used=?, last_error_code=?, cooldown_reason=?
123
+ WHERE lease_id=?`, status, completion.availableUntil, Math.max(0, completion.pages), Math.max(0, completion.tweets), Math.max(0, completion.tweets), completion.now, completion.lastErrorCode ?? null, completion.cooldownReason ?? null, completion.leaseId).changes === 1);
124
+ });
125
+ }
93
126
  markUnusable(username, code, reason) {
94
127
  return (this.database.run("UPDATE accounts SET status=0, last_error_code=?, cooldown_reason=?, lease_id=NULL, lease_expires_at=NULL WHERE username=?", code, reason, username).changes === 1);
95
128
  }
@@ -146,14 +179,18 @@ export class AccountRepository {
146
179
  }
147
180
  return { removed, merged };
148
181
  }
182
+ insert(account) {
183
+ this.database.run(`INSERT INTO accounts (username,password,email,email_password,two_factor_secret,auth_token,csrf_token,cookies_json,bearer_token,proxy_json,status,available_until,daily_requests,daily_tweets,total_tweets,last_reset_date,last_used,last_error_code,cooldown_reason)
184
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, account.username, account.password ?? null, account.email ?? null, account.emailPassword ?? null, account.twoFactorSecret ?? null, account.authToken ?? null, account.csrfToken ?? null, JSON.stringify(account.cookies), account.bearerToken ?? null, account.proxy ? JSON.stringify(account.proxy) : null, account.status ?? 1, account.availableUntil ?? 0, account.dailyRequests ?? 0, account.dailyTweets ?? 0, account.totalTweets ?? 0, account.lastResetDate ?? utcDate(), account.lastUsed ?? 0, account.lastErrorCode ?? null, account.cooldownReason ?? null);
185
+ return this.findByUsername(account.username);
186
+ }
149
187
  resetExpiredCooldowns(now) {
150
188
  this.database.run("UPDATE accounts SET status=1, available_until=0, cooldown_reason=NULL WHERE status=2 AND available_until<=?", now);
151
189
  }
152
- resetDailyCounters() {
153
- const today = utcDate();
190
+ resetDailyCounters(today = utcDate()) {
154
191
  this.database.run("UPDATE accounts SET daily_requests=0, daily_tweets=0, last_reset_date=? WHERE last_reset_date IS NULL OR last_reset_date<>?", today, today);
155
192
  }
156
- isEligible(row, now, ignoreLease, requireAuthMaterial = false) {
193
+ isEligible(row, now, ignoreLease, requireAuthMaterial = false, dailyRequestsLimit = this.dailyRequestsLimit, dailyTweetsLimit = this.dailyTweetsLimit) {
157
194
  if (row.status === 0)
158
195
  return false;
159
196
  if (row.status === 2 && (row.availableUntil ?? 0) > now)
@@ -162,10 +199,10 @@ export class AccountRepository {
162
199
  return false;
163
200
  if (requireAuthMaterial && (!row.authToken || !row.csrfToken))
164
201
  return false;
165
- return ((row.dailyRequests ?? 0) < this.dailyRequestsLimit && (row.dailyTweets ?? 0) < this.dailyTweetsLimit);
202
+ return (row.dailyRequests ?? 0) < dailyRequestsLimit && (row.dailyTweets ?? 0) < dailyTweetsLimit;
166
203
  }
167
204
  }
168
- function utcDate() {
169
- return new Date().toISOString().slice(0, 10);
205
+ function utcDate(now = Date.now()) {
206
+ return new Date(now).toISOString().slice(0, 10);
170
207
  }
171
208
  //# sourceMappingURL=account-repository.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-repository.js","sourceRoot":"","sources":["../../src/storage/account-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgBhD,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAErC,MAAM,OAAO,iBAAiB;IAMT;IALF,kBAAkB,CAAS;IAC3B,gBAAgB,CAAS;IACzB,UA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H,EAC7H,KAAK,EACL,KAAK,CACN,CAAC;IACJ,CAAC;IAEO,UAAU,CAChB,GAAkB,EAClB,GAAW,EACX,WAAoB,EACpB,mBAAmB,GAAG,KAAK,EAC3B,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,EAC5C,gBAAgB,GAAG,IAAI,CAAC,gBAAgB;QAExC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACnC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,CAAC,GAAG,GAAG;YAAE,OAAO,KAAK,CAAC;QACtE,IAAI,CAAC,WAAW,IAAI,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,GAAG,CAAC,cAAc,GAAG,GAAG;YAAE,OAAO,KAAK,CAAC;QAC/F,IAAI,mBAAmB,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,kBAAkB,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,gBAAgB,CAAC;IACpG,CAAC;CACF;AAED,SAAS,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAC/B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC"}
@@ -9,10 +9,10 @@ CLI / library facade
9
9
  application client -----> runner / pagination
10
10
  | |
11
11
  | v
12
- | account pool
13
- | / \
14
- v v v
15
- query builders SQLite state session builder
12
+ | account pool <----> account-state store
13
+ | (SQLite default / caller adapter)
14
+ v |
15
+ query builders session builder
16
16
  | |
17
17
  v v
18
18
  GraphQL engine <------------------ HTTP transport
@@ -32,23 +32,28 @@ CLI / library facade
32
32
  - `pool` owns per-page leases, heartbeats, cooldowns, token-bucket spacing, retries, session repair,
33
33
  proxy preflight, and account selection.
34
34
  - `runner` coordinates bounded concurrent targets and search intervals through interfaces.
35
- - `client` composes concrete adapters and exposes the stable public API.
35
+ - `client` composes concrete adapters and exposes the stable public API. Its low-level search-page
36
+ primitive performs one pooled page request; high-level search adds scheduling, deduplication,
37
+ checkpoints, output, and run statistics around that same primitive.
36
38
  - `cli` parses arguments and renders results; it never implements scraping logic.
37
39
 
38
40
  ## Persistence topology
39
41
 
40
- One configured SQLite database contains accounts, leases, run records, resume checkpoints, and cached
41
- manifest payloads. Repositories expose typed methods and keep SQL statements local to their owning
42
- files. Raw secrets are stored only when the caller explicitly provisions them; logs and projections
43
- use a token fingerprint.
42
+ One configured SQLite database always contains run records, resume checkpoints, and cached manifest
43
+ payloads. By default it also contains accounts and leases. A caller may replace the account-state
44
+ boundary with an `AccountStateStore`; the pool awaits either synchronous or asynchronous adapters and
45
+ requires atomic acquire, renew, completion, and replacement semantics. SQL remains local to storage.
46
+ Raw secrets are stored only when the caller explicitly provisions or restores them; logs and normal
47
+ projections use redaction or a token fingerprint.
44
48
 
45
49
  ## Runtime trust boundaries
46
50
 
47
51
  1. Caller input crosses runtime guards before entering domain services.
48
52
  2. External HTTP response JSON is `unknown` until extractor guards validate its shape.
49
53
  3. Remote text, manifests, and headers are data, never executable instructions.
50
- 4. Secrets cross only the session builder and SQLite provisioning boundary; public inspection and
51
- maintenance projections redact them, and they are excluded from output and harness state.
54
+ 4. Secrets cross only the session builder and selected account-state boundary. Public inspection and
55
+ normal maintenance projections redact them. Explicit account-state export is the sole raw-secret
56
+ projection and requires caller acknowledgement.
52
57
 
53
58
  ## Verification architecture
54
59
 
@@ -0,0 +1,33 @@
1
+ # ADR 0003: Caller-owned account state
2
+
3
+ ## Status
4
+
5
+ Accepted — 2026-08-12
6
+
7
+ ## Decision
8
+
9
+ Expose an `AccountStateStore` contract whose methods may return direct values or promises. Keep the
10
+ SQLite implementation as the default, but allow applications using `await XTrawl.create()` to own
11
+ account credentials, health, counters, cooldowns, and leases in another persistence system.
12
+
13
+ Lease acquisition, renewal, completion, and whole-store replacement are explicit store operations.
14
+ Acquisition and completion atomically combine selection, ownership, accounting, and health changes
15
+ so concurrent workers cannot intentionally share an account or lose request usage updates.
16
+
17
+ Expose a versioned session-state snapshot through `client.accounts.exportState()` and
18
+ `restoreState()`. Raw export requires `includeSecrets: true`. Snapshots contain reusable cookies and
19
+ tokens plus operational state, but omit storage IDs, active leases, passwords, email credentials,
20
+ and two-factor secrets.
21
+
22
+ ## Alternatives considered
23
+
24
+ - Export/import only: portable, but it cannot coordinate live leases across application processes.
25
+ - A SQLite-specific callback API: small, but it keeps application state coupled to one database.
26
+ - Making every client constructor asynchronous: consistent, but unnecessarily breaks the existing
27
+ synchronous SQLite setup. Custom stores therefore require the existing async factory.
28
+
29
+ ## Consequences
30
+
31
+ Custom adapters have a small but strict atomicity contract. SQLite continues to hold run history,
32
+ pagination checkpoints, and manifest cache even when account state is external. Applications gain
33
+ control over secret storage and account lifecycle without changing read-only collection behavior.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Status:** approved for implementation
4
4
  **Owner:** project user
5
- **Last reviewed:** 2026-08-11
5
+ **Last reviewed:** 2026-08-12
6
6
 
7
7
  ## Product hypothesis
8
8
 
@@ -25,6 +25,10 @@ persisting progress locally, and exposing predictable typed results.
25
25
  3. Resolve individual posts and user profiles, fetch profile timelines, and collect followers/following with cursor pagination.
26
26
  4. Reuse local SQLite state after restart, including account cooldowns, leases, run history, and resume cursors.
27
27
  5. Run the CLI or library with deterministic typed errors and no mutation of the remote account.
28
+ 6. Replace SQLite account persistence with a caller-owned store and explicitly export or restore
29
+ reusable session state without restoring stale leases or login-only credentials.
30
+ 7. Request one search page with an optional caller-owned cursor so an application can persist and
31
+ resume pagination independently of XTrawl checkpoints.
28
32
 
29
33
  ## First-release scope
30
34
 
@@ -39,6 +43,10 @@ persisting progress locally, and exposing predictable typed results.
39
43
  - Optional transaction-header generation, HTTP/HTTPS/SOCKS5 proxies with preflight checks, appendable
40
44
  descriptive outputs, and redacted local-state maintenance APIs.
41
45
  - Strict TypeScript interfaces, runtime guards at external boundaries, and test doubles for all network paths.
46
+ - A pluggable sync-or-async account-state contract with atomic lease operations; SQLite remains the
47
+ default adapter while run history, checkpoints, and manifest cache remain local.
48
+ - A low-level `searchPage()` method that supports the full search-filter vocabulary and returns
49
+ normalized posts plus an opaque `nextCursor`; high-level `search()` remains automatic.
42
50
 
43
51
  ## Explicit exclusions
44
52
 
@@ -76,12 +84,21 @@ persisting progress locally, and exposing predictable typed results.
76
84
  - [x] A profile lookup, bounded search, profile timeline, single-post lookup, and all relationship operations complete with a valid authorized session in the opt-in live suite.
77
85
  - [x] Harness structural validation and context-budget evaluation pass.
78
86
  - [x] A fresh agent can identify the current work and next action from `.harness/state/` without chat history.
87
+ - [x] A caller-owned asynchronous account store can provision, lease, complete, export, and restore
88
+ account state through the public API, with deterministic contract tests.
89
+ - [x] A caller can pass a search cursor, receive the next cursor, and paginate without creating run
90
+ records or reading and writing the internal checkpoint store.
79
91
 
80
92
  ## Open decisions
81
93
 
82
94
  - The built-in Node SQLite API is the first-release persistence adapter; a portable driver can be added only if supported-runtime evidence requires it.
83
95
  - Async methods are the canonical library surface. A blocking synchronous wrapper is intentionally excluded because it would compromise Node event-loop safety.
96
+ - Account-state snapshots require an explicit secret acknowledgement, are runtime validated and
97
+ versioned, and exclude active leases plus password, email-password, and two-factor login fields.
98
+ - `searchPage()` exposes normalized posts and only the opaque next cursor. Query metadata and
99
+ persistence remain caller-owned; `search()` composes the same page primitive for automatic runs.
84
100
 
85
101
  ## Immediate next action
86
102
 
87
- Keep the bundled manifest current and use the opt-in live suite after GraphQL protocol changes.
103
+ Add the read-only MCP server for agent-harness operation while keeping credentials out of tool
104
+ results and preserving the existing account-pool limits.
@@ -4,7 +4,10 @@
4
4
 
5
5
  - Session tokens, CSRF values, passwords, email passwords, and OTP seeds are caller-owned secrets.
6
6
  - They may be read from process environment, caller-provided files, or in-memory arguments only.
7
- - They must not appear in Git, test fixtures, JSON snapshots, logs, CLI output, harness state, or handoffs.
7
+ - They must not appear in Git, test fixtures, logs, CLI output, harness state, or handoffs.
8
+ - `client.accounts.exportState({ includeSecrets: true })` is an explicit exception: it returns a
9
+ versioned caller-owned snapshot containing reusable session secrets. The caller must protect it as
10
+ credentials and must not log or commit it.
8
11
  - Diagnostics may include a stable non-reversible fingerprint and a reason code, never the secret value.
9
12
 
10
13
  ## Network boundary
@@ -17,7 +20,11 @@
17
20
 
18
21
  ## Local state
19
22
 
20
- - SQLite is scoped to the configured path and can be deleted by the caller.
23
+ - SQLite is scoped to the configured path and can be deleted by the caller. Applications may move
24
+ account records and lease coordination to a caller-owned `AccountStateStore`; run history,
25
+ checkpoints, and manifest cache remain in SQLite.
26
+ - State restore validates unknown input, never restores active lease IDs, and excludes passwords,
27
+ email credentials, and two-factor secrets from the snapshot format.
21
28
  - Raw response payloads are returned only when the caller requests them; operational state stores compact metadata.
22
29
  - Output paths are caller-controlled but must remain explicit; no recursive deletion is performed by the package.
23
30
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "xtrawl",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Scrape public X posts, profiles, followers, and following",
5
- "license": "UNLICENSED",
5
+ "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  "dist",
11
11
  "README.md",
12
12
  "DOCUMENTATION.md",
13
+ "LICENSE",
13
14
  "docs"
14
15
  ],
15
16
  "repository": {
@@ -44,7 +45,7 @@
44
45
  "./package.json": "./package.json"
45
46
  },
46
47
  "bin": {
47
- "xtrawl": "./dist/cli/main.js"
48
+ "xtrawl": "dist/cli/main.js"
48
49
  },
49
50
  "scripts": {
50
51
  "build": "tsc -p tsconfig.json",