mcp-scraper 0.96.2 → 0.97.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +12 -18
  3. package/dist/actions-NCZNPYEY.js +1 -0
  4. package/dist/bin/api-server.js +1 -1
  5. package/dist/bin/mcp-scraper-cli.js +26 -27
  6. package/dist/bin/mcp-scraper-core.js +1 -1
  7. package/dist/bin/mcp-scraper-install.js +1 -1
  8. package/dist/bin/mcp-stdio-server.js +1 -1
  9. package/dist/bin/paa-harvest.js +1 -1
  10. package/dist/bundle-XR6XKYJM.js +1 -0
  11. package/dist/chunk-4P3LZNVA.js +954 -0
  12. package/dist/chunk-6FAMBNHY.js +1 -0
  13. package/dist/chunk-A4UASMEQ.js +1 -0
  14. package/dist/chunk-AMYPXA2F.js +930 -0
  15. package/dist/{chunk-HUNSEGUN.js → chunk-ANQ4JJVI.js} +43 -29
  16. package/dist/chunk-B5Y26E3A.js +1 -0
  17. package/dist/{chunk-WP3QS4CJ.js → chunk-EYGA6LOU.js} +1 -1
  18. package/dist/{chunk-HVQZRQRJ.js → chunk-GLCR4KJI.js} +16 -37
  19. package/dist/{chunk-7WPCGRD7.js → chunk-JNPM3U3L.js} +41 -34
  20. package/dist/chunk-K3VDGJNK.js +1 -0
  21. package/dist/chunk-ND4WIBXT.js +16 -0
  22. package/dist/{chunk-ZTMQEDIB.js → chunk-NULRGHJ4.js} +1 -1
  23. package/dist/{chunk-DTVKZU5X.js → chunk-OOB3RKWD.js} +2 -2
  24. package/dist/{chunk-6BD75VKS.js → chunk-OSKCHEVM.js} +1 -1
  25. package/dist/{chunk-BPKTUCV7.js → chunk-PD7BI7TR.js} +1 -1
  26. package/dist/chunk-PKQHHCO4.js +20 -0
  27. package/dist/{chunk-SFUOSJ3A.js → chunk-PQRT4T2G.js} +3 -3
  28. package/dist/chunk-U3NV72AL.js +8 -0
  29. package/dist/{chunk-JHT6A4U6.js → chunk-WHVK6FUB.js} +1 -1
  30. package/dist/{chunk-2OKQVTQ5.js → chunk-XYUJTIPE.js} +66 -36
  31. package/dist/chunk-YJPFEL2E.js +1 -0
  32. package/dist/{chunk-SE4VKLEC.js → chunk-Z4EHBBL4.js} +1 -1
  33. package/dist/{core-schema-423BSTE6.js → core-schema-Y47YFKH2.js} +7 -44
  34. package/dist/dispatch-ILBBKOSW.js +1 -0
  35. package/dist/index.cjs +10 -10
  36. package/dist/index.js +1 -1
  37. package/dist/metering-YHZ46GV4.js +1 -0
  38. package/dist/queue-VOGXQDPR.js +1 -0
  39. package/dist/reconciliation-OXBG7JA2.js +1 -0
  40. package/dist/repository-UKDA4IWP.js +1 -0
  41. package/dist/{server-AEEE7E3C.js → server-6HUBN3OR.js} +918 -1196
  42. package/dist/settlement-3PS32LQO.js +1 -0
  43. package/dist/worker-NXRU3TT3.js +1 -0
  44. package/package.json +2 -3
  45. package/dist/actions-R4EJDLRO.js +0 -1
  46. package/dist/bundle-FCXZMIRB.js +0 -1
  47. package/dist/chunk-2IATUJO6.js +0 -1
  48. package/dist/chunk-5BKSKLHX.js +0 -1
  49. package/dist/chunk-5LYINW7Z.js +0 -8
  50. package/dist/chunk-6K7ZJYQW.js +0 -16
  51. package/dist/chunk-7H6YWD2L.js +0 -1
  52. package/dist/chunk-CORWWDHL.js +0 -1
  53. package/dist/chunk-H6MODA7W.js +0 -935
  54. package/dist/chunk-KUEMW76G.js +0 -955
  55. package/dist/chunk-RYX4FJVH.js +0 -1
  56. package/dist/chunk-UXNR3K6I.js +0 -1
  57. package/dist/dispatch-P7IY75LH.js +0 -1
  58. package/dist/metering-ZH2P62IC.js +0 -1
  59. package/dist/queue-AC4XKD6Z.js +0 -1
  60. package/dist/reconciliation-UZUZ6B74.js +0 -1
  61. package/dist/repository-4EC5EXVN.js +0 -1
  62. package/dist/settlement-6CS4JZTY.js +0 -1
  63. package/dist/worker-HHUU2ECG.js +0 -1
@@ -1,22 +1,22 @@
1
- import{c as S}from"./chunk-4ZVO6GX4.js";import{a}from"./chunk-WNUXMPVX.js";import{b as E,c as f,d as A,e as m,f as c}from"./chunk-HNNYXMSI.js";import{randomUUID as w}from"crypto";var u="(CAST(strftime('%s', 'now') AS INTEGER) * 1000)",N=e=>{if(!Number.isSafeInteger(e)||e<1e3||e>36e5)throw Error("Execution lease must be between one second and one hour")};async function p(e,t,n){return(await e.execute({sql:`SELECT e.*, r.status AS run_status, r.tool, r.job_id, ${u} AS now_ms FROM operation_executions e
2
- JOIN operation_runs r ON r.id = e.run_id WHERE e.run_id = ? AND r.user_id = ?`,args:[t,n]})).rows[0]}async function R(e,t,n,r,o=a(),s){N(r),s&&c({userId:t,tool:s.tool,jobId:s.jobId},s);let i=await p(o,e,t);return i?(i.phase==="claimed"&&Number(i.expires_at_ms)<=Number(i.now_ms)&&(await o.execute({sql:`UPDATE operation_executions SET claim_token = ?, expires_at_ms = ${u} + ?
3
- WHERE run_id = ? AND phase = 'claimed' AND expires_at_ms <= ${u}
1
+ import{a as A}from"./chunk-PKQHHCO4.js";import{c as w}from"./chunk-4ZVO6GX4.js";import{a as u}from"./chunk-WNUXMPVX.js";import{b as E,c as f,d as S,e as m,f as l}from"./chunk-HNNYXMSI.js";import{randomUUID as D}from"crypto";var a="(CAST(strftime('%s', 'now') AS INTEGER) * 1000)",N=e=>{if(!Number.isSafeInteger(e)||e<1e3||e>36e5)throw Error("Execution lease must be between one second and one hour")};async function d(e,t,n){return(await e.execute({sql:`SELECT e.*, r.status AS run_status, r.tool, r.job_id, ${a} AS now_ms FROM operation_executions e
2
+ JOIN operation_runs r ON r.id = e.run_id WHERE e.run_id = ? AND r.user_id = ?`,args:[t,n]})).rows[0]}async function R(e,t,n,r,o=u(),s){N(r),s&&l({userId:t,tool:s.tool,jobId:s.jobId},s);let i=await d(o,e,t);return i?(i.phase==="claimed"&&Number(i.expires_at_ms)<=Number(i.now_ms)&&(await o.execute({sql:`UPDATE operation_executions SET claim_token = ?, expires_at_ms = ${a} + ?
3
+ WHERE run_id = ? AND phase = 'claimed' AND expires_at_ms <= ${a}
4
4
  AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = 'running' AND (? = 1 OR json_extract(normalized_flags_json,'$._storeGateRequired') IS NOT 1)${s?" AND tool = ? AND job_id = ?":""})
5
- ${s?`AND (${s.sql})`:""}`,args:[n,r,e,e,t,s?1:0,...s?[s.tool,s.jobId,...s.args]:[]]}),i=await p(o,e,t)),i?.phase==="effects_started"&&Number(i.expires_at_ms)<=Number(i.now_ms)&&(await o.batch([{sql:`UPDATE operation_executions SET phase = 'unknown' WHERE run_id = ?
6
- AND phase = 'effects_started' AND expires_at_ms <= ${u}
5
+ ${s?`AND (${s.sql})`:""}`,args:[n,r,e,e,t,s?1:0,...s?[s.tool,s.jobId,...s.args]:[]]}),i=await d(o,e,t)),i?.phase==="effects_started"&&Number(i.expires_at_ms)<=Number(i.now_ms)&&(await o.batch([{sql:`UPDATE operation_executions SET phase = 'unknown' WHERE run_id = ?
6
+ AND phase = 'effects_started' AND expires_at_ms <= ${a}
7
7
  AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ?)`,args:[e,e,t]},{sql:`UPDATE operation_runs SET status = 'unknown', failure_class = 'execution_expired_after_effects',
8
8
  ended_at = datetime('now'), updated_at = datetime('now') WHERE id = ? AND user_id = ? AND status = 'running'
9
- AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND phase = 'unknown')`,args:[e,t,e]}],"write"),i=await p(o,e,t)),i?.phase==="published"&&i.run_status===i.result_status?{kind:"replay",runId:e,result:{json:String(i.result_json),status:i.result_status}}:i?.phase==="unknown"||i?.run_status!=="running"?{kind:"unknown",runId:e}:i.phase==="claimed"&&i.claim_token===n&&Number(i.expires_at_ms)>Number(i.now_ms)?{kind:"claimed",claim:{runId:e,userId:t,token:n}}:{kind:"pending",runId:e}):{kind:"unknown",runId:e}}async function b(e,t){return t&&c({userId:e.userId,tool:t.tool,jobId:t.jobId},t),(await a().execute({sql:`UPDATE operation_executions SET phase = 'effects_started' WHERE run_id = ? AND claim_token = ?
10
- AND phase = 'claimed' AND expires_at_ms > ${u}
9
+ AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND phase = 'unknown')`,args:[e,t,e]}],"write"),i=await d(o,e,t)),i?.phase==="published"&&i.run_status===i.result_status?{kind:"replay",runId:e,result:{json:String(i.result_json),status:i.result_status}}:i?.phase==="unknown"||i?.run_status!=="running"?{kind:"unknown",runId:e}:i.phase==="claimed"&&i.claim_token===n&&Number(i.expires_at_ms)>Number(i.now_ms)?{kind:"claimed",claim:{runId:e,userId:t,token:n}}:{kind:"pending",runId:e}):{kind:"unknown",runId:e}}async function I(e,t){return t&&l({userId:e.userId,tool:t.tool,jobId:t.jobId},t),(await u().execute({sql:`UPDATE operation_executions SET phase = 'effects_started' WHERE run_id = ? AND claim_token = ?
10
+ AND phase = 'claimed' AND expires_at_ms > ${a}
11
11
  AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = 'running' AND (? = 1 OR json_extract(normalized_flags_json,'$._storeGateRequired') IS NOT 1)${t?" AND tool = ? AND job_id = ?":""})
12
- ${t?`AND (${t.sql})`:""}`,args:[e.runId,e.token,e.runId,e.userId,t?1:0,...t?[t.tool,t.jobId,...t.args]:[]]})).rowsAffected===1}async function y(e,t){return N(t),(await a().execute({sql:`UPDATE operation_executions SET expires_at_ms = ${u} + ? WHERE run_id = ? AND claim_token = ?
13
- AND phase IN ('claimed', 'effects_started') AND expires_at_ms > ${u}
14
- AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = 'running')`,args:[t,e.runId,e.token,e.runId,e.userId]})).rowsAffected===1}async function C(e,t,n=3e5){if(N(n),!Number.isSafeInteger(t)||t<=0)throw Error("Authenticated recovery principal is required");let r=a(),o=w(),s;try{await r.batch([{sql:`UPDATE operation_executions SET phase = 'unknown', claim_token = ?, expires_at_ms = ${u} + ?
15
- WHERE run_id = ? AND phase IN ('effects_started', 'unknown') AND expires_at_ms <= ${u}
12
+ ${t?`AND (${t.sql})`:""}`,args:[e.runId,e.token,e.runId,e.userId,t?1:0,...t?[t.tool,t.jobId,...t.args]:[]]})).rowsAffected===1}async function j(e,t){return N(t),(await u().execute({sql:`UPDATE operation_executions SET expires_at_ms = ${a} + ? WHERE run_id = ? AND claim_token = ?
13
+ AND phase IN ('claimed', 'effects_started') AND expires_at_ms > ${a}
14
+ AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = 'running')`,args:[t,e.runId,e.token,e.runId,e.userId]})).rowsAffected===1}async function q(e,t,n=3e5){if(N(n),!Number.isSafeInteger(t)||t<=0)throw Error("Authenticated recovery principal is required");let r=u(),o=D(),s;try{await r.batch([{sql:`UPDATE operation_executions SET phase = 'unknown', claim_token = ?, expires_at_ms = ${a} + ?
15
+ WHERE run_id = ? AND phase IN ('effects_started', 'unknown') AND expires_at_ms <= ${a}
16
16
  AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status IN ('running', 'unknown'))`,args:[o,n,e,e,t]},{sql:`UPDATE operation_runs SET status = 'unknown', failure_class = 'execution_expired_after_effects',
17
17
  ended_at = datetime('now'), updated_at = datetime('now') WHERE id = ? AND user_id = ? AND status = 'running'
18
- AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND phase = 'unknown' AND claim_token = ?)`,args:[e,t,e,o]}],"write")}catch(_){s=_}let i;try{i=await p(r,e,t)}catch(_){throw s??_}if(i?.phase==="unknown"&&i.run_status==="unknown"&&i.claim_token===o&&Number(i.expires_at_ms)>Number(i.now_ms))return{runId:e,userId:t,token:o};if(s)throw s;return null}async function D(e,t,n,r){r&&c({userId:e.userId,tool:r.tool,jobId:r.jobId},r);let o=n?"unknown":"effects_started",s=n?"unknown":"running";if(JSON.parse(t.json),Buffer.byteLength(t.json)>16*1024*1024)throw Error("Operation result exceeds 16 MiB");let i=a(),_;try{await i.batch([{sql:`UPDATE operation_executions SET phase = 'published', result_json = ?, result_status = ?
19
- WHERE run_id = ? AND claim_token = ? AND phase = ? AND expires_at_ms > ${u}
18
+ AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND phase = 'unknown' AND claim_token = ?)`,args:[e,t,e,o]}],"write")}catch(_){s=_}let i;try{i=await d(r,e,t)}catch(_){throw s??_}if(i?.phase==="unknown"&&i.run_status==="unknown"&&i.claim_token===o&&Number(i.expires_at_ms)>Number(i.now_ms))return{runId:e,userId:t,token:o};if(s)throw s;return null}async function x(e,t,n,r){r&&l({userId:e.userId,tool:r.tool,jobId:r.jobId},r);let o=n?"unknown":"effects_started",s=n?"unknown":"running";if(JSON.parse(t.json),Buffer.byteLength(t.json)>16*1024*1024)throw Error("Operation result exceeds 16 MiB");let i=u(),_;try{await i.batch([{sql:`UPDATE operation_executions SET phase = 'published', result_json = ?, result_status = ?
19
+ WHERE run_id = ? AND claim_token = ? AND phase = ? AND expires_at_ms > ${a}
20
20
  AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = ?)
21
21
  AND (? = 0 OR NOT EXISTS (
22
22
  SELECT 1 FROM operation_debit_plans p JOIN billing_debits d ON d.idempotency_key = p.debit_key
@@ -29,29 +29,43 @@ import{c as S}from"./chunk-4ZVO6GX4.js";import{a}from"./chunk-WNUXMPVX.js";impor
29
29
  ))${r?` AND (${r.sql}) AND EXISTS(SELECT 1 FROM operation_runs g WHERE g.id=operation_executions.run_id AND g.tool=? AND g.job_id=?)`:""}`,args:[t.json,t.status,e.runId,e.token,o,e.runId,e.userId,s,n?1:0,...r?[...r.args,r.tool,r.jobId]:[]]},{sql:`UPDATE operation_runs SET status = ?, ended_at = datetime('now'), updated_at = datetime('now')
30
30
  WHERE id = ? AND user_id = ? AND status = ?
31
31
  AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND claim_token = ?
32
- AND phase = 'published' AND result_json = ? AND result_status = ?)`,args:[t.status,e.runId,e.userId,s,e.runId,e.token,t.json,t.status]}],"write")}catch(l){_=l}let d=await p(i,e.runId,e.userId);if(d?.phase==="published"&&d.claim_token===e.token&&d.result_json===t.json&&d.result_status===t.status&&d.run_status===t.status)return!0;if(_)throw _;return!1}async function q(e,t){return D(e,t,!1)}async function $(e,t,n){if(t.status!=="unknown")throw Error("Recovery cannot publish a known execution outcome");return D(e,t,!0,n)}async function j(e){await a().execute({sql:`UPDATE operation_executions SET expires_at_ms = ${u}
32
+ AND phase = 'published' AND result_json = ? AND result_status = ?)`,args:[t.status,e.runId,e.userId,s,e.runId,e.token,t.json,t.status]}],"write")}catch(c){_=c}let p=await d(i,e.runId,e.userId);if(p?.phase==="published"&&p.claim_token===e.token&&p.result_json===t.json&&p.result_status===t.status&&p.run_status===t.status)return!0;if(_)throw _;return!1}async function $(e,t){return x(e,t,!1)}async function H(e,t,n){if(t.status!=="unknown")throw Error("Recovery cannot publish a known execution outcome");return x(e,t,!0,n)}async function W(e){await u().execute({sql:`UPDATE operation_executions SET expires_at_ms = ${a}
33
33
  WHERE run_id = ? AND claim_token = ? AND phase = 'claimed'
34
- AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = 'running')`,args:[e.runId,e.token,e.runId,e.userId]})}async function H(e){await a().batch([{sql:`UPDATE operation_executions SET phase = 'unknown', expires_at_ms = ${u}
35
- WHERE run_id = ? AND claim_token = ? AND phase IN ('effects_started', 'unknown') AND expires_at_ms > ${u}
34
+ AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status = 'running')`,args:[e.runId,e.token,e.runId,e.userId]})}async function F(e){let t=u();await A(t);let n;try{return(await t.execute({sql:`UPDATE operation_executions SET phase = 'claimed', expires_at_ms = ${a}
35
+ WHERE run_id = ? AND claim_token = ? AND phase = 'effects_started' AND expires_at_ms > ${a}
36
+ AND EXISTS (SELECT 1 FROM operation_runs root
37
+ WHERE root.id = operation_executions.run_id AND root.user_id = ? AND root.status = 'running'
38
+ AND root.job_id IS NOT NULL
39
+ AND NOT EXISTS (SELECT 1 FROM operation_runs child
40
+ LEFT JOIN operation_executions execution ON execution.run_id = child.id
41
+ WHERE child.user_id = root.user_id AND child.job_id = root.job_id AND child.id <> root.id
42
+ AND (child.status = 'unknown' OR execution.phase IN ('effects_started', 'unknown')
43
+ OR (child.status = 'running' AND execution.run_id IS NULL)))
44
+ AND NOT EXISTS (SELECT 1 FROM operation_physical_attempts physical
45
+ WHERE physical.user_id = root.user_id AND physical.state IN ('prepared', 'effects_started', 'unknown')
46
+ AND (physical.parent_run_id = root.id OR EXISTS (SELECT 1 FROM operation_runs parent
47
+ WHERE parent.id = physical.parent_run_id AND parent.user_id = root.user_id
48
+ AND parent.job_id = root.job_id))))`,args:[e.runId,e.token,e.userId]})).rowsAffected===1}catch(o){n=o}let r=await d(t,e.runId,e.userId).catch(()=>null);if(r?.phase==="claimed"&&r.run_status==="running"&&r.claim_token===e.token&&Number(r.expires_at_ms)<=Number(r.now_ms))return!0;throw n}async function L(e){await u().batch([{sql:`UPDATE operation_executions SET phase = 'unknown', expires_at_ms = ${a}
49
+ WHERE run_id = ? AND claim_token = ? AND phase IN ('effects_started', 'unknown') AND expires_at_ms > ${a}
36
50
  AND EXISTS (SELECT 1 FROM operation_runs WHERE id = ? AND user_id = ? AND status IN ('running', 'unknown'))`,args:[e.runId,e.token,e.runId,e.userId]},{sql:`UPDATE operation_runs SET status = 'unknown', failure_class = 'execution_outcome_unavailable',
37
51
  ended_at = datetime('now'), updated_at = datetime('now') WHERE id = ? AND user_id = ? AND status IN ('running', 'unknown')
38
- AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND phase = 'unknown' AND claim_token = ?)`,args:[e.runId,e.userId,e.runId,e.token]}],"write")}async function F(e){let t=await p(a(),e.runId,e.userId);return t?.phase==="effects_started"&&t.run_status==="running"&&t.claim_token===e.token&&Number(t.expires_at_ms)>Number(t.now_ms)}function x(e){let t=m(e.tool,"tool"),n=m(e.ownerScope,"ownerScope"),r=e.idempotencyKey?.trim()||null,o=e.requestFingerprint?.trim()||null;if(r==null!=(o==null))throw Error("idempotencyKey and requestFingerprint must be supplied together");let s=r?f(`${n}\0${t}\0${r}`):null,i=e.id??w(),_=[i,e.userId??null,f(n),t,s,o,e.jobId??null,e.requestId??S()?.requestId??null,e.deploymentCommit??null,A(e.normalizedFlags),e.startedAt??new Date().toISOString()];return{id:i,scopeHash:s,requestFingerprint:o,statement:{sql:`INSERT${s?" OR IGNORE":""} INTO operation_runs
52
+ AND EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ? AND phase = 'unknown' AND claim_token = ?)`,args:[e.runId,e.userId,e.runId,e.token]}],"write")}async function P(e){let t=await d(u(),e.runId,e.userId);return t?.phase==="effects_started"&&t.run_status==="running"&&t.claim_token===e.token&&Number(t.expires_at_ms)>Number(t.now_ms)}function h(e){let t=m(e.tool,"tool"),n=m(e.ownerScope,"ownerScope"),r=e.idempotencyKey?.trim()||null,o=e.requestFingerprint?.trim()||null;if(r==null!=(o==null))throw Error("idempotencyKey and requestFingerprint must be supplied together");let s=r?f(`${n}\0${t}\0${r}`):null,i=e.id??D(),_=[i,e.userId??null,f(n),t,s,o,e.jobId??null,e.requestId??w()?.requestId??null,e.deploymentCommit??null,S(e.normalizedFlags),e.startedAt??new Date().toISOString()];return{id:i,scopeHash:s,requestFingerprint:o,statement:{sql:`INSERT${s?" OR IGNORE":""} INTO operation_runs
39
53
  (id, user_id, owner_scope_hash, tool, idempotency_scope_hash, request_fingerprint,
40
54
  job_id, request_id, deployment_commit, normalized_flags_json, started_at)
41
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:_}}}async function O(e,t){let n=(await e.execute({sql:t.scopeHash?"SELECT id, request_fingerprint FROM operation_runs WHERE idempotency_scope_hash = ?":"SELECT id, request_fingerprint FROM operation_runs WHERE id = ?",args:[t.scopeHash??t.id]})).rows[0];if(!n)throw Error("Operation run insert did not produce an idempotency receipt");if(t.scopeHash&&String(n.request_fingerprint)!==t.requestFingerprint)throw new E;return{id:String(n.id),replayed:String(n.id)!==t.id}}async function W(e){let t=a(),n=x(e);return await t.execute(n.statement),n.scopeHash?O(t,n):{id:n.id,replayed:!1}}async function L(e,t,n,r){N(n),r&&c(e,r);let o=a(),s=x(r?{...e,normalizedFlags:{...e.normalizedFlags,_storeGateRequired:!0}}:e),i=r?{sql:s.statement.sql.replace("VALUES (","SELECT ").replace(/\)$/,"")+` WHERE (${r.sql})`,args:[...s.statement.args,...r.args]}:s.statement,_;try{await o.batch([i,{sql:`INSERT INTO operation_executions (run_id, claim_token, expires_at_ms, phase)
42
- SELECT id, ?, ${u} + ?, 'claimed' FROM operation_runs
43
- WHERE id = ? AND user_id = ? AND status = 'running' AND changes() = 1`,args:[t,n,s.id,e.userId]}],"write")}catch(l){_=l}let d;try{d=await O(o,s)}catch(l){if(l instanceof E)throw l;if(r&&!_)return{kind:"unknown",runId:s.id};throw _??l}return R(d.id,e.userId,t,n,o,r)}async function P(e){let t=a(),n=e.endedAt??new Date().toISOString(),r=e.failureClass==null?null:e.failureClass.slice(0,200);if((await t.execute({sql:`UPDATE operation_runs SET status = ?, failure_class = ?, ended_at = ?, updated_at = ?
55
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:_}}}async function O(e,t){let n=(await e.execute({sql:t.scopeHash?"SELECT id, request_fingerprint FROM operation_runs WHERE idempotency_scope_hash = ?":"SELECT id, request_fingerprint FROM operation_runs WHERE id = ?",args:[t.scopeHash??t.id]})).rows[0];if(!n)throw Error("Operation run insert did not produce an idempotency receipt");if(t.scopeHash&&String(n.request_fingerprint)!==t.requestFingerprint)throw new E;return{id:String(n.id),replayed:String(n.id)!==t.id}}async function M(e){let t=u(),n=h(e);return await t.execute(n.statement),n.scopeHash?O(t,n):{id:n.id,replayed:!1}}async function U(e,t,n,r){N(n),r&&l(e,r);let o=u(),s=h(r?{...e,normalizedFlags:{...e.normalizedFlags,_storeGateRequired:!0}}:e),i=r?{sql:s.statement.sql.replace("VALUES (","SELECT ").replace(/\)$/,"")+` WHERE (${r.sql})`,args:[...s.statement.args,...r.args]}:s.statement,_;try{await o.batch([i,{sql:`INSERT INTO operation_executions (run_id, claim_token, expires_at_ms, phase)
56
+ SELECT id, ?, ${a} + ?, 'claimed' FROM operation_runs
57
+ WHERE id = ? AND user_id = ? AND status = 'running' AND changes() = 1`,args:[t,n,s.id,e.userId]}],"write")}catch(c){_=c}let p;try{p=await O(o,s)}catch(c){if(c instanceof E)throw c;if(r&&!_)return{kind:"unknown",runId:s.id};throw _??c}return R(p.id,e.userId,t,n,o,r)}async function X(e){let t=u(),n=e.endedAt??new Date().toISOString(),r=e.failureClass==null?null:e.failureClass.slice(0,200);if((await t.execute({sql:`UPDATE operation_runs SET status = ?, failure_class = ?, ended_at = ?, updated_at = ?
44
58
  WHERE id = ? AND status = 'running'
45
- AND NOT EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ?)`,args:[e.status,r,n,n,e.runId,e.runId]})).rowsAffected===1)return;let s=(await t.execute({sql:"SELECT status, failure_class FROM operation_runs WHERE id = ?",args:[e.runId]})).rows[0];if(!s)throw Error(`Unknown operation run: ${e.runId}`);if(s.status==="running")throw Error("Claimed operation runs require fenced result publication");let i=s.failure_class==null?null:String(s.failure_class);if(String(s.status)!==e.status||i!==r)throw Error(`Operation run ${e.runId} is already terminal as ${String(s.status)}`)}function M(e,t){if(!Number.isSafeInteger(e.userId)||e.userId<=0||!e.runId||!e.token||!t.tool||!t.jobId)throw Error("Invalid operation write fence");let n=t.recovery?"unknown":"effects_started",r=t.recovery?"unknown":"running";return{sql:`EXISTS (SELECT 1 FROM operation_executions x JOIN operation_runs r ON r.id=x.run_id
46
- WHERE x.run_id=? AND x.claim_token=? AND x.phase=? AND x.expires_at_ms > ${u}
47
- AND r.user_id=? AND r.status=? AND r.tool=? AND r.job_id=?)`,args:[e.runId,e.token,n,e.userId,r,t.tool,t.jobId]}}async function v(e,t,n){let o=(await a().execute({sql:`SELECT r.id,r.request_fingerprint,r.status,x.phase,x.result_json,x.result_status
59
+ AND NOT EXISTS (SELECT 1 FROM operation_executions WHERE run_id = ?)`,args:[e.status,r,n,n,e.runId,e.runId]})).rowsAffected===1)return;let s=(await t.execute({sql:"SELECT status, failure_class FROM operation_runs WHERE id = ?",args:[e.runId]})).rows[0];if(!s)throw Error(`Unknown operation run: ${e.runId}`);if(s.status==="running")throw Error("Claimed operation runs require fenced result publication");let i=s.failure_class==null?null:String(s.failure_class);if(String(s.status)!==e.status||i!==r)throw Error(`Operation run ${e.runId} is already terminal as ${String(s.status)}`)}function v(e,t){if(!Number.isSafeInteger(e.userId)||e.userId<=0||!e.runId||!e.token||!t.tool||!t.jobId)throw Error("Invalid operation write fence");let n=t.recovery?"unknown":"effects_started",r=t.recovery?"unknown":"running";return{sql:`EXISTS (SELECT 1 FROM operation_executions x JOIN operation_runs r ON r.id=x.run_id
60
+ WHERE x.run_id=? AND x.claim_token=? AND x.phase=? AND x.expires_at_ms > ${a}
61
+ AND r.user_id=? AND r.status=? AND r.tool=? AND r.job_id=?)`,args:[e.runId,e.token,n,e.userId,r,t.tool,t.jobId]}}async function G(e,t,n){let o=(await u().execute({sql:`SELECT r.id,r.request_fingerprint,r.status,x.phase,x.result_json,x.result_status
48
62
  FROM operation_runs r LEFT JOIN operation_executions x ON x.run_id=r.id
49
- WHERE r.user_id=? AND r.idempotency_scope_hash=?`,args:[e,t]})).rows[0];if(!o)return null;if(String(o.request_fingerprint)!==n)throw new E;return o.phase!=="published"||o.status!==o.result_status?null:{runId:String(o.id),result:{json:String(o.result_json),status:o.result_status}}}async function U(e,t){return!!await p(a(),e,t)}async function X(e,t,n){return(await a().execute({sql:`SELECT 1 FROM operation_runs r JOIN operation_executions x ON x.run_id=r.id
50
- WHERE r.job_id=? AND r.user_id=? AND r.tool=? AND (x.phase='unknown' OR r.status='unknown') LIMIT 1`,args:[e,t,n]})).rows.length>0}function G(e,t,n,r){if(![e,t].every(s=>/^[a-z_.]+$/.test(s))||!/^[a-z_]+$/.test(n))throw Error("Invalid operation group fence");if(r!=null&&(!r.trim()||r.length>512))throw Error("Invalid operation group exclusion");let o=r==null?"":`AND x.run_id <> '${r.replace(/'/g,"''")}'`;return`NOT EXISTS (SELECT 1 FROM operation_runs r JOIN operation_executions x ON x.run_id=r.id
63
+ WHERE r.user_id=? AND r.idempotency_scope_hash=?`,args:[e,t]})).rows[0];if(!o)return null;if(String(o.request_fingerprint)!==n)throw new E;return o.phase!=="published"||o.status!==o.result_status?null:{runId:String(o.id),result:{json:String(o.result_json),status:o.result_status}}}async function z(e,t){return!!await d(u(),e,t)}async function J(e,t,n){return(await u().execute({sql:`SELECT 1 FROM operation_runs r JOIN operation_executions x ON x.run_id=r.id
64
+ WHERE r.job_id=? AND r.user_id=? AND r.tool=? AND (x.phase='unknown' OR r.status='unknown') LIMIT 1`,args:[e,t,n]})).rows.length>0}function V(e,t,n,r){if(![e,t].every(s=>/^[a-z_.]+$/.test(s))||!/^[a-z_]+$/.test(n))throw Error("Invalid operation group fence");if(r!=null&&(!r.trim()||r.length>512))throw Error("Invalid operation group exclusion");let o=r==null?"":`AND x.run_id <> '${r.replace(/'/g,"''")}'`;return`NOT EXISTS (SELECT 1 FROM operation_runs r JOIN operation_executions x ON x.run_id=r.id
51
65
  WHERE r.job_id=${e} AND r.user_id=${t} AND r.tool='${n}'
52
- AND x.phase IN ('claimed','effects_started') AND x.expires_at_ms > ${u} AND r.status='running' ${o})`}async function z(e,t){c({userId:e.userId,tool:t.tool,jobId:t.jobId},t);try{return await b(e,t)}catch(n){let r=await p(a(),e.runId,e.userId).catch(()=>null);if(r?.phase==="effects_started"&&r.claim_token===e.token&&r.run_status==="running"&&r.tool===t.tool&&r.job_id===t.jobId&&Number(r.expires_at_ms)>Number(r.now_ms))return!0;throw n}}async function J(e,t,n,r){if(!Number.isSafeInteger(t)||t<=0||!e||!n||!r)return null;let o=(await a().execute({sql:`SELECT r.id,r.status,r.normalized_flags_json,r.request_fingerprint,r.started_at,
53
- e.phase,e.expires_at_ms,${u} AS now_ms FROM operation_runs r JOIN operation_executions e ON e.run_id=r.id
66
+ AND x.phase IN ('claimed','effects_started') AND x.expires_at_ms > ${a} AND r.status='running' ${o})`}async function K(e,t){l({userId:e.userId,tool:t.tool,jobId:t.jobId},t);try{return await I(e,t)}catch(n){let r=await d(u(),e.runId,e.userId).catch(()=>null);if(r?.phase==="effects_started"&&r.claim_token===e.token&&r.run_status==="running"&&r.tool===t.tool&&r.job_id===t.jobId&&Number(r.expires_at_ms)>Number(r.now_ms))return!0;throw n}}async function B(e,t,n,r){if(!Number.isSafeInteger(t)||t<=0||!e||!n||!r)return null;let o=(await u().execute({sql:`SELECT r.id,r.status,r.normalized_flags_json,r.request_fingerprint,r.started_at,
67
+ e.phase,e.expires_at_ms,${a} AS now_ms FROM operation_runs r JOIN operation_executions e ON e.run_id=r.id
54
68
  WHERE r.id=? AND r.user_id=? AND r.tool=? AND r.job_id=?
55
- AND json_extract(r.normalized_flags_json,'$._storeGateRequired') IS 1`,args:[e,t,n,r]})).rows[0];return o?{runId:String(o.id),status:String(o.status),phase:String(o.phase),flags:JSON.parse(String(o.normalized_flags_json)),fingerprint:String(o.request_fingerprint),startedAt:String(o.started_at),expiresAtMs:Number(o.expires_at_ms),nowMs:Number(o.now_ms)}:null}function V(e,t,n){if(![e,t].every(r=>/^[a-z_.]+$/.test(r))||!/^[a-z_]+$/.test(n))throw Error("Invalid unresolved operation fence");return`NOT EXISTS (SELECT 1 FROM operation_runs r JOIN operation_executions e ON e.run_id=r.id
69
+ AND json_extract(r.normalized_flags_json,'$._storeGateRequired') IS 1`,args:[e,t,n,r]})).rows[0];return o?{runId:String(o.id),status:String(o.status),phase:String(o.phase),flags:JSON.parse(String(o.normalized_flags_json)),fingerprint:String(o.request_fingerprint),startedAt:String(o.started_at),expiresAtMs:Number(o.expires_at_ms),nowMs:Number(o.now_ms)}:null}function Q(e,t,n){if(![e,t].every(r=>/^[a-z_.]+$/.test(r))||!/^[a-z_]+$/.test(n))throw Error("Invalid unresolved operation fence");return`NOT EXISTS (SELECT 1 FROM operation_runs r JOIN operation_executions e ON e.run_id=r.id
56
70
  WHERE r.job_id=${e} AND r.user_id=${t} AND r.tool='${n}'
57
- AND (e.phase IN ('effects_started','unknown') OR r.status='unknown'))`}export{R as a,b,y as c,C as d,q as e,$ as f,j as g,H as h,F as i,W as j,L as k,P as l,M as m,v as n,U as o,X as p,G as q,z as r,J as s,V as t};
71
+ AND (e.phase IN ('effects_started','unknown') OR r.status='unknown'))`}export{R as a,I as b,j as c,q as d,$ as e,H as f,W as g,F as h,L as i,P as j,M as k,U as l,X as m,v as n,G as o,z as p,J as q,V as r,K as s,B as t,Q as u};
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";import{z as t}from"zod";var o=t.enum(["hubspot","salesforce","highlevel","zoho","pipedrive","keap"]),m=t.object({provider:o,sourceRecordId:t.string().trim().min(1).max(240),occurredAt:t.string().datetime(),updatedAt:t.string().datetime(),contact:t.object({kind:t.enum(["provider_contact_id","verified_email_hmac","verified_phone_hmac"]),reference:t.string().trim().min(1).max(240)}).strict(),event:t.object({name:t.string().regex(/^[a-z][a-z0-9_]{1,79}$/),pipelineId:t.string().trim().min(1).max(240).nullable(),stageId:t.string().trim().min(1).max(240).nullable(),stageLabel:t.string().trim().min(1).max(240).nullable()}).strict(),revenue:t.object({minor:t.number().int().nonnegative(),currency:t.string().regex(/^[A-Z]{3}$/),provenance:t.enum(["provider_verified","mapped_provider_field"])}).strict().nullable(),tombstone:t.boolean()}).strict(),s=t.object({contractVersion:t.literal(1),provider:o,outcomes:t.array(m).max(500),cursor:t.string().max(2e3).nullable(),hasMore:t.boolean(),warnings:t.array(t.enum(["contact_association_missing","currency_missing","deleted_records_unavailable","effective_scope_narrowed","rate_limit_near","schema_drift"])).max(50)}).strict().superRefine((i,a)=>{i.outcomes.some(c=>c.provider!==i.provider)&&a.addIssue({code:t.ZodIssueCode.custom,message:"provider_mismatch"}),i.hasMore&&!i.cursor&&a.addIssue({code:t.ZodIssueCode.custom,message:"cursor_required_when_more"})});function _(i){return s.parse(i)}var r=e.enum(["hubspot","salesforce","highlevel","zoho","pipedrive","keap"]),n=e.enum(["hubspot","highlevel","zoho","keap"]),l=e.enum(["incremental_and_webhook","incremental_only","webhook_only","manual_backfill","unavailable"]),p=e.object({documented:e.boolean(),normalizedAdapter:e.boolean(),advertisedTools:e.array(e.string().trim().min(1).max(120)).max(100),grantedScopes:e.array(e.string().trim().min(1).max(160)).max(200),missingRequirements:e.array(e.string().trim().min(1).max(240)).max(100),tenantSchemaFingerprint:e.string().regex(/^[a-f0-9]{64}$/).nullable(),evaluatedAt:e.string().datetime()}).strict(),d=e.object({provider:r,mode:l,canSyncNow:e.boolean(),canProvisionFields:e.boolean(),canUpsertPerson:e.boolean(),canApplyPipelineEvent:e.boolean(),supportedObjects:e.array(e.string().trim().min(1).max(100)).max(100),evidence:p,caveats:e.array(e.string().trim().min(1).max(500)).max(100)}).strict(),P=d.extend({provider:n}).strict(),g=e.object({object:e.string().trim().min(1).max(100),internalName:e.string().trim().min(1).max(160),label:e.string().trim().min(1).max(160),type:e.enum(["string","number","datetime","url","boolean"]),writable:e.boolean(),required:e.boolean().optional()}).strict(),u=e.object({planId:e.string().regex(/^crmplan_[a-f0-9]{24}$/),provider:r,connectionId:e.string().trim().min(1).max(240),personObject:e.string().trim().min(1).max(100),existingMappings:e.record(e.string().max(160),e.string().max(160)),proposedFields:e.array(g).max(50),fallback:e.enum(["note","activity"]),permissionRequirements:e.array(e.string().trim().min(1).max(160)).max(50),schemaFingerprint:e.string().regex(/^[a-f0-9]{64}$/),requestFingerprint:e.string().regex(/^[a-f0-9]{64}$/),createdAt:e.string().datetime()}).strict(),I=u.extend({provider:n}).strict(),x=e.object({receiptId:e.string().regex(/^crmreceipt_[a-f0-9]{24}$/),planId:e.string().regex(/^crmplan_[a-f0-9]{24}$/),provider:r,connectionId:e.string().trim().min(1).max(240),status:e.enum(["approved","tested","failed"]),createdFields:e.array(e.object({object:e.string().trim().min(1).max(100),internalName:e.string().trim().min(1).max(160),providerFieldId:e.string().trim().min(1).max(240).optional()}).strict()).max(50),existingMappings:e.record(e.string().max(160),e.string().max(160)),cleanup:e.object({supported:e.boolean(),instructions:e.string().max(1e3)}).strict(),planFingerprint:e.string().regex(/^[a-f0-9]{64}$/),occurredAt:e.string().datetime(),errorCode:e.string().regex(/^[a-zA-Z0-9_:-]{1,120}$/).optional()}).strict(),j=x.extend({provider:n}).strict(),z=e.object({identityTier:e.literal("confirmed"),personId:e.string().trim().min(1).max(240),deterministicIdentity:e.object({kind:e.enum(["email","phone","crm_id","customer_id"]),value:e.string().trim().min(1).max(500)}).strict(),contact:e.object({email:e.string().email().max(320).optional(),phone:e.string().trim().min(3).max(50).optional(),firstName:e.string().trim().max(160).optional(),lastName:e.string().trim().max(160).optional()}).strict().optional(),firstTouch:e.string().max(1e3).optional(),lastNonDirectTouch:e.string().max(1e3).optional(),convertingTouch:e.string().max(1e3).optional(),landingPage:e.string().url().max(2e3).optional(),conversionPage:e.string().url().max(2e3).optional(),sessionCount:e.number().int().nonnegative(),eventCount:e.number().int().nonnegative(),campaignClickCoverage:e.string().max(240).optional(),consentReceiptRef:e.string().trim().min(1).max(240),detailedJourneyUrl:e.string().url().max(2e3)}).strict(),y=e.object({version:e.number().int().positive(),eventName:e.string().regex(/^[a-z][a-z0-9_]{1,79}$/),pipelineId:e.string().trim().min(1).max(240),stageId:e.string().trim().min(1).max(240),operation:e.enum(["create_or_update_deal","update_stage"]),valueSource:e.enum(["none","verified_revenue"]),activationEligible:e.boolean()}).strict(),$=e.object({eventId:e.string().trim().min(1).max(240),eventName:e.string().regex(/^[a-z][a-z0-9_]{1,79}$/),occurredAt:e.string().datetime(),verifiedRevenueMinor:e.number().int().nonnegative().optional(),currency:e.string().regex(/^[A-Z]{3}$/).optional()}).strict(),O=e.object({object:e.string().trim().min(1).max(100),sourceEventIdField:e.string().trim().min(1).max(160),occurredAtField:e.string().trim().min(1).max(160),personIdField:e.string().trim().max(160).optional(),dealIdField:e.string().trim().max(160).optional(),stageField:e.string().trim().max(160).optional(),valueField:e.string().trim().max(160).optional(),currencyField:e.string().trim().max(160).optional(),eventName:e.string().trim().min(2).max(80)}).strict(),b=e.object({syncId:e.string().regex(/^crmsync_[a-f0-9]{24}$/),siteId:e.string().uuid(),connectionId:e.string().trim().min(1).max(240),provider:r,state:e.enum(["queued","running","completed","degraded","cancelled","webhook_only"]),mode:e.enum(["initial","incremental","webhook"]),cursor:e.string().max(2e3).nullable(),lastStartedAt:e.string().datetime().nullable(),lastSuccessAt:e.string().datetime().nullable(),nextRunAt:e.string().datetime().nullable(),imported:e.number().int().nonnegative(),deduplicated:e.number().int().nonnegative(),rejected:e.number().int().nonnegative(),lastErrorCode:e.string().regex(/^[a-zA-Z0-9_:-]{1,120}$/).nullable(),requestFingerprint:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),F=b.extend({provider:n}).strict(),R=e.object({code:e.string().regex(/^[a-zA-Z0-9_:-]{1,120}$/),retryable:e.boolean(),message:e.string().max(500)}).strict(),v=e.enum(["contact.email","contact.phone","contact.firstName","contact.lastName","attribution.firstTouch","attribution.lastNonDirectTouch","attribution.convertingTouch","attribution.landingPage","attribution.conversionPage","clickIds.gclid","clickIds.gbraid","clickIds.wbraid","events.selected","revenue.verified"]),f=e.object({policyId:e.string().regex(/^crmpolicy_[a-f0-9]{24}$/),siteId:e.string().uuid(),provider:r,connectionId:e.string().trim().min(1).max(240),kind:e.enum(["person_summary","pipeline_event"]),enabled:e.boolean(),version:e.number().int().positive(),provisioningReceiptId:e.string().regex(/^crmreceipt_[a-f0-9]{24}$/),schemaFingerprint:e.string().regex(/^[a-f0-9]{64}$/),mappingVersion:e.number().int().positive().nullable(),mapping:y.nullable(),allowedFields:e.array(v).max(20),selectedEvents:e.array(e.string().regex(/^[a-z][a-z0-9_]{1,79}$/)).max(100),purpose:e.enum(["necessary_form_fulfillment","site_analytics","advertising_measurement"]),updatedAt:e.string().datetime()}).strict(),k=f.extend({provider:n}).strict(),w=e.object({jobId:e.string().regex(/^crmjob_[a-f0-9]{24}$/),policyId:e.string().regex(/^crmpolicy_[a-f0-9]{24}$/),siteId:e.string().uuid(),personId:e.string().uuid(),kind:e.enum(["person_summary","pipeline_event"]),state:e.enum(["pending","running","retrying","delivered","dead_letter","cancelled"]),policyVersion:e.number().int().positive(),mappingVersion:e.number().int().positive().nullable(),attempts:e.number().int().nonnegative(),nextAttemptAt:e.string().datetime().nullable(),safeErrorCode:e.string().regex(/^[a-zA-Z0-9_:-]{1,120}$/).nullable(),requestFingerprint:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),E=e.object({receiptId:e.string().trim().min(1).max(240),jobId:e.string().trim().min(1).max(240),status:e.enum(["accepted","rejected","failed","retrying"]),externalReceiptId:e.string().trim().min(1).max(240).optional(),safeErrorCode:e.string().regex(/^[a-zA-Z0-9_:-]{1,120}$/).optional(),occurredAt:e.string().datetime()}).strict();export{s as a,_ as b,n as c,d,P as e,g as f,u as g,I as h,x as i,j,z as k,y as l,$ as m,O as n,b as o,F as p,v as q,f as r,k as s,w as t,E as u};
@@ -1 +1 @@
1
- var e={schemaVersion:1,ratePolicy:{version:"serp-page-2026-09-24",effectiveDate:"2026-09-24T00:00:00.000Z"},costEvidence:{id:"serp-page-rate-basis-2026-09",status:"owner-approved"},operationCosts:{serp:{credits:20,unit:"per page (ordinary search)",label:"SERP search",notes:"search_serp light mode returns one page of organic positions, URLs, titles, and descriptions by default. Unfiltered one-page full mode returns available same-page SERP features. Either mode requests two pages only when pages:2 is explicit. Unfiltered light searches cost 20 credits per delivered page, or 35 credits per delivered page if the backup supplies the result. One-page full searches cost 35 credits. Setting recency to week or month applies Google's date filter through a managed browser and returns organic results only. It costs 35 credits for one page; filtered pages:2 follows Google's page-two control and costs 70 credits when both pages are delivered. Unfiltered searches use the managed browser only as the last backup. Unfiltered two-page full searches return organic results only for 40 credits, with rich features marked unsupported. If only page 1 is delivered, the search is marked partial and billed for one delivered page. A temporary 35-credit-per-requested-page hold is settled to the delivered rate. Location, language, device, and optional module fields do not change ordinary searches. Saved browser identity and capture_serp_snapshot searches retain their 60-credit base price; optional page snapshots add 1 credit per attempted URL."},paa:{credits:10,unit:"per question (+400 credit base)",label:"PAA harvest",notes:"Returns original-query PAA questions with answers and sources plus organic results and Google entity IDs. Optional same-page SERP modules are flag-controlled. Billed 400 credit base + 10 per question actually returned (unused estimate refunded)."},page_scrape:{credits:1,unit:"per page",label:"Page crawl / extract",notes:"Applies to both single-URL extraction and per-page site crawls."},listing_create:{credits:10,unit:"per new listing",label:"Directory or wiki listing creation",notes:"Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included."},listing_edit:{credits:2,unit:"per existing listing revision",label:"Directory or wiki listing edit",notes:"Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity."},url_map:{credits:5,unit:"per mapping operation",label:"Site URL mapping",notes:"Flat rate for the full /map-urls call regardless of URL count discovered."},yt_channel:{credits:2,unit:"per call",label:"YouTube search / channel harvest"},yt_transcription:{credits:200,unit:"base + 2/min of video",label:"YouTube transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_ad:{credits:7,unit:"per call",label:"Facebook search / ad lookup"},maps_search:{credits:5,unit:"per search",label:"Maps business search",notes:"Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses."},maps_place:{credits:60,unit:"per business",label:"Maps business lookup",notes:"Maps place runs reserve the 60-credit base plus the declared review maximum before browsing. Completed runs settle to the base plus unique saved reviews; stopped attempts are refunded."},maps_review:{credits:1,unit:"per review card",label:"Maps review",notes:"One credit per unique saved review on a completed Maps place run. The declared maximum is held before browsing; unused credits are refunded."},fb_search:{credits:8,unit:"per search",label:"Facebook ad library search",notes:"Browser automation to search Facebook Ads Library by keyword."},google_ads_search:{credits:6,unit:"per search",label:"Google Ads Transparency search",notes:"Browser automation to find advertisers in Google Ads Transparency Center by domain or name."},google_ads_intel:{credits:2,unit:"per call",label:"Google Ads Transparency advertiser intel",notes:"Lists and hydrates an advertiser's creatives with image URLs and video references."},google_ads_transcribe:{credits:200,unit:"base + 2/min of video",label:"Google ad video transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_transcribe:{credits:200,unit:"base + 2/min of video",label:"Facebook video / ad transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_reels_inventory:{credits:4,unit:"per profile scan",label:"Facebook Reel URL inventory",notes:"Collects canonical Reel URLs from a Facebook profile. Logged-out scans are capped at 60 URLs; saved browser profiles can request larger inventories."},tiktok_transcribe:{credits:200,unit:"base + 2/min of video",label:"TikTok video transcription",notes:"Transcribes a public TikTok video from its playback media. Flat 200-credit base plus 2 credits per minute, reconciled after transcription."},instagram_profile:{credits:4,unit:"per profile scan",label:"Instagram profile content discovery",notes:"Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile."},instagram_media:{credits:4,unit:"per post or reel",label:"Instagram media download",notes:"Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files."},instagram_transcribe:{credits:200,unit:"base + 2/min of video",label:"Instagram media transcription",notes:"Whisper transcription of selected Instagram audio/video media. Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},browser_minute:{credits:120,unit:"per minute of use",label:"Interactive browser session",notes:"Metered per minute of use for the whole time the browser session is open. Close the session to stop the meter; abandoned sessions are auto-closed after a short idle window."},reddit_thread:{credits:30,unit:"per thread",label:"Reddit thread base lookup",notes:"Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved."},reddit_comment:{credits:2,unit:"per comment",label:"Reddit comment",notes:"Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread."},video_analysis:{credits:6667,unit:"per 120 frames (max 480)",label:"Video breakdown (frame-by-frame + transcript)",notes:"Full video breakdown: samples frames across a video up to 60 minutes, analyzes visuals and audio, then produces a summary, pacing, topic outline, key points, hook, style, and replication guidance. Reserves 6667 Credits per requested 120-frame tier, up to 480 frames. Unused frame tiers and failed-run frame charges are refunded. Incurred analysis-model usage is billed separately, including usage before a failure; terminal status checks settle the original run."},trustpilot_reviews:{credits:5,unit:"per call",label:"Trustpilot review harvest",notes:"Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found."},trustpilot_review:{credits:1,unit:"per review card",label:"Trustpilot review card",notes:"Charged per review actually extracted, billed down automatically if the balance runs out mid-page."},g2_reviews:{credits:5,unit:"per call",label:"G2 review harvest",notes:"Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found."},g2_review:{credits:2,unit:"per review card",label:"G2 review card",notes:"Charged per review actually extracted (each card carries up to 3 Q&A sections), billed down automatically if the balance runs out mid-page."},diff_page:{credits:1,unit:"per check",label:"Page change check",notes:"Same cost as a single page extract \u2014 one scrape is performed per check, then compared against your last stored snapshot for that URL."}},publicTiers:[{tier:"starter",label:"Starter",monthlyUsd:12,credits:8e4,concurrency:3},{tier:"growth",label:"Growth",monthlyUsd:40,credits:266667,concurrency:10},{tier:"scale",label:"Scale",monthlyUsd:100,credits:8e5,concurrency:20}],credits:{mcPerCredit:100,freeSignupCredits:0},inventory:{totalTools:367,scraperTools:241,memoryTools:126},concurrencyPack:{ratePolicyVersion:"2026-08-14.concurrency-pack-v1",monthlyUsd:5,currency:"usd",interval:"month",billingUnit:"pack",slotsPerPack:2},scaleCreditPack:{ratePolicyVersion:"2026-09-21.scale-credit-pack-v1",eligibleTier:"scale",incrementUsd:10,creditsPerIncrement:8e4,maxQuantity:100,currency:"usd",expiryMonths:3},addons:{memory:{monthlyUsd:19,quotaGb:5,freeQuotaGb:.01},scheduling:{billingMode:"credits",entitlement:"paid_plan_included",separateSubscriptionRequired:!1,chargeEvent:"started_occurrence",runBaseCredits:75,runBaseMc:7500,llmCostMultiplier:1.5,llmCostMultiplierBps:15e3,modes:{connection_sync:{runBaseCredits:75,modelCostBilling:"none",modelCostMultiplier:0},agent:{runBaseCredits:75,modelCostBilling:"actual_reported_cost",modelCostMultiplier:1.5,modelCostMultiplierBps:15e3}}},connectedAccounts:{schemaVersion:2,ratePolicyVersion:"2026-08-03.connected-usage-v3",effectiveAt:"2026-08-03T00:00:00.000Z",entitlement:"paid_plan_add_on",connection:{billingMode:"flat_recurring_credits",amountCredits:15e3,interval:"month",unit:"active_connection",proration:"none"},usage:{billingMode:"credits",settlementMode:"authoritative_receipt",rounding:"aggregate_then_ceil_to_mc",functionRun:{credits:2,mc:200,unit:"per_function_run"},proxyRequest:{credits:2,mc:200,unit:"per_proxy_request"},compute:{creditsPerSecond:5,mcPerSecond:500,sourceUnit:"millisecond",unit:"per_compute_second",formula:"ceil(computeMilliseconds * mcPerSecond / 1000)"}}}}};export{e as a};
1
+ var e={schemaVersion:1,ratePolicy:{version:"serp-page-2026-09-24",effectiveDate:"2026-09-24T00:00:00.000Z"},costEvidence:{id:"serp-page-rate-basis-2026-09",status:"owner-approved"},operationCosts:{serp:{credits:20,unit:"per page (ordinary search)",label:"SERP search",notes:"search_serp light mode returns one page of organic positions, URLs, titles, and descriptions by default. Unfiltered one-page full mode returns available same-page SERP features. Either mode requests two pages only when pages:2 is explicit. Unfiltered light searches cost 20 credits per delivered page, or 35 credits per delivered page if the backup supplies the result. One-page full searches cost 35 credits. Setting recency to week or month applies Google's date filter through a managed browser and returns organic results only. It costs 35 credits for one page; filtered pages:2 follows Google's page-two control and costs 70 credits when both pages are delivered. Unfiltered searches use the managed browser only as the last backup. Unfiltered two-page full searches return organic results only for 40 credits, with rich features marked unsupported. If only page 1 is delivered, the search is marked partial and billed for one delivered page. A temporary 35-credit-per-requested-page hold is settled to the delivered rate. Location, language, device, and optional module fields do not change ordinary searches. Saved browser identity and capture_serp_snapshot searches retain their 60-credit base price; optional page snapshots add 1 credit per attempted URL."},paa:{credits:10,unit:"per question (+400 credit base)",label:"PAA harvest",notes:"Returns original-query PAA questions with answers and sources plus organic results and Google entity IDs. Optional same-page SERP modules are flag-controlled. Billed 400 credit base + 10 per question actually returned (unused estimate refunded)."},page_scrape:{credits:1,unit:"per page",label:"Page crawl / extract",notes:"Applies to both single-URL extraction and per-page site crawls."},listing_create:{credits:10,unit:"per new listing",label:"Directory or wiki listing creation",notes:"Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included."},listing_edit:{credits:2,unit:"per existing listing revision",label:"Directory or wiki listing edit",notes:"Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity."},url_map:{credits:5,unit:"per mapping operation",label:"Site URL mapping",notes:"Flat rate for the full /map-urls call regardless of URL count discovered."},yt_channel:{credits:2,unit:"per call",label:"YouTube search / channel harvest"},yt_transcription:{credits:200,unit:"base + 2/min of video",label:"YouTube transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_ad:{credits:7,unit:"per call",label:"Facebook search / ad lookup"},maps_search:{credits:5,unit:"per search",label:"Maps business search",notes:"Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses."},maps_place:{credits:60,unit:"per business",label:"Maps business lookup",notes:"Maps place runs reserve the 60-credit base plus the declared review maximum before browsing. Completed runs settle to the base plus unique saved reviews; stopped attempts are refunded."},maps_review:{credits:1,unit:"per review card",label:"Maps review",notes:"One credit per unique saved review on a completed Maps place run. The declared maximum is held before browsing; unused credits are refunded."},fb_search:{credits:8,unit:"per search",label:"Facebook ad library search",notes:"Browser automation to search Facebook Ads Library by keyword."},google_ads_search:{credits:6,unit:"per search",label:"Google Ads Transparency search",notes:"Browser automation to find advertisers in Google Ads Transparency Center by domain or name."},google_ads_intel:{credits:2,unit:"per call",label:"Google Ads Transparency advertiser intel",notes:"Lists and hydrates an advertiser's creatives with image URLs and video references."},google_ads_transcribe:{credits:200,unit:"base + 2/min of video",label:"Google ad video transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_transcribe:{credits:200,unit:"base + 2/min of video",label:"Facebook video / ad transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_reels_inventory:{credits:4,unit:"per profile scan",label:"Facebook Reel URL inventory",notes:"Collects canonical Reel URLs from a Facebook profile. Logged-out scans are capped at 60 URLs; saved browser profiles can request larger inventories."},tiktok_transcribe:{credits:200,unit:"base + 2/min of video",label:"TikTok video transcription",notes:"Transcribes a public TikTok video from its playback media. Flat 200-credit base plus 2 credits per minute, reconciled after transcription."},instagram_profile:{credits:4,unit:"per profile scan",label:"Instagram profile content discovery",notes:"Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile."},instagram_media:{credits:4,unit:"per post or reel",label:"Instagram media download",notes:"Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files."},instagram_transcribe:{credits:200,unit:"base + 2/min of video",label:"Instagram media transcription",notes:"Whisper transcription of selected Instagram audio/video media. Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},browser_minute:{credits:120,unit:"per minute of use",label:"Interactive browser session",notes:"Metered per minute of use for the whole time the browser session is open. Close the session to stop the meter; abandoned sessions are auto-closed after a short idle window."},reddit_thread:{credits:30,unit:"per thread",label:"Reddit thread base lookup",notes:"Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved."},reddit_comment:{credits:2,unit:"per comment",label:"Reddit comment",notes:"Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread."},video_analysis:{credits:6667,unit:"per 120 frames (max 480)",label:"Video breakdown (frame-by-frame + transcript)",notes:"Full video breakdown: samples frames across a video up to 60 minutes, analyzes visuals and audio, then produces a summary, pacing, topic outline, key points, hook, style, and replication guidance. Reserves 6667 Credits per requested 120-frame tier, up to 480 frames. Unused frame tiers and failed-run frame charges are refunded. Incurred analysis-model usage is billed separately, including usage before a failure; terminal status checks settle the original run."},trustpilot_reviews:{credits:5,unit:"per call",label:"Trustpilot review harvest",notes:"Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found."},trustpilot_review:{credits:1,unit:"per review card",label:"Trustpilot review card",notes:"Charged per review actually extracted, billed down automatically if the balance runs out mid-page."},g2_reviews:{credits:5,unit:"per call",label:"G2 review harvest",notes:"Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found."},g2_review:{credits:2,unit:"per review card",label:"G2 review card",notes:"Charged per review actually extracted (each card carries up to 3 Q&A sections), billed down automatically if the balance runs out mid-page."},diff_page:{credits:1,unit:"per check",label:"Page change check",notes:"Same cost as a single page extract \u2014 one scrape is performed per check, then compared against your last stored snapshot for that URL."}},publicTiers:[{tier:"starter",label:"Starter",monthlyUsd:12,credits:8e4,concurrency:3},{tier:"growth",label:"Growth",monthlyUsd:40,credits:266667,concurrency:10},{tier:"scale",label:"Scale",monthlyUsd:100,credits:8e5,concurrency:20}],credits:{mcPerCredit:100,freeSignupCredits:0},inventory:{totalTools:347,scraperTools:233,memoryTools:114},concurrencyPack:{ratePolicyVersion:"2026-08-14.concurrency-pack-v1",monthlyUsd:5,currency:"usd",interval:"month",billingUnit:"pack",slotsPerPack:2},scaleCreditPack:{ratePolicyVersion:"2026-09-21.scale-credit-pack-v1",eligibleTier:"scale",incrementUsd:10,creditsPerIncrement:8e4,maxQuantity:100,currency:"usd",expiryMonths:3},addons:{memory:{monthlyUsd:19,quotaGb:5,freeQuotaGb:.01},connectedAccounts:{schemaVersion:2,ratePolicyVersion:"2026-08-03.connected-usage-v3",effectiveAt:"2026-08-03T00:00:00.000Z",entitlement:"paid_plan_add_on",connection:{billingMode:"flat_recurring_credits",amountCredits:15e3,interval:"month",unit:"active_connection",proration:"none"},usage:{billingMode:"credits",settlementMode:"authoritative_receipt",rounding:"aggregate_then_ceil_to_mc",functionRun:{credits:2,mc:200,unit:"per_function_run"},proxyRequest:{credits:2,mc:200,unit:"per_proxy_request"},compute:{creditsPerSecond:5,mcPerSecond:500,sourceUnit:"millisecond",unit:"per_compute_second",formula:"ceil(computeMilliseconds * mcPerSecond / 1000)"}}}}};export{e as a};