ghostcrawl 2.3.9 → 2.3.91

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe7a2e186381cf57544932721b83ee4725af9054e73ed215f203ea529dbe0210
4
- data.tar.gz: 5c9f29bc8fccab845463e2bc244cbbed8a0a7a892de1715f73365e20300e029b
3
+ metadata.gz: 4b911186bcef0a85000916eda981072c17bc98e306ef7df32b1737c0f34766a6
4
+ data.tar.gz: 95652112da503148406568133585dbe1bcfd2c13e1635f61a1aef057be287ccc
5
5
  SHA512:
6
- metadata.gz: b05c45ee97297edaa3addb0236f608202d1aeca79c1afb115b8e7a08553bf19b67521f45f592baf4f12295e59a94cafba2e7fba4920abccb325d0185b5578fd3
7
- data.tar.gz: 3ba96738cab7eb576acc628a4b9adb3d7de0f71a0512dcea4ef2786a40a85eb16caa963c0118501ad12942bf76dd6e758ffefb9c0ed304fedaf2272808b9abc9
6
+ metadata.gz: 1d59f121aaf0d61544dc6ec89b5c1daae80e2eba0ca81eb8cba9a8460d44a82458b0af3fcb79c1ddd1b07281333bec4d8a97c55d4632ada8a16179488f07e1ff
7
+ data.tar.gz: 11aa9e620ad9fe4390eb4a65ae7d03eecffe9498a9d3c47bb3b73ceffd8aea135bc5d2b5c5005b0fc16574ccf5edd8d896d5441c28a6f772f4d40ff4ddbdbe99
data/README.md CHANGED
@@ -127,8 +127,8 @@ puts "#{page["status_code"]} — #{page["bytes"]} bytes"
127
127
  png = client.screenshot(url: "https://example.com", full_page: true)
128
128
  File.binwrite("page.png", png)
129
129
 
130
- # PDF — returns raw application/pdf bytes (Chrome-only; a Firefox/WebKit identity
131
- # is rejected with a 400 pdf_engine_unsupported)
130
+ # PDF — returns raw application/pdf bytes (any engine; the PDF-capable engine is selected automatically, so a Firefox/WebKit identity
131
+ # still receives real PDF bytes (capability pin)
132
132
  pdf = client.pdf(url: "https://example.com", paper_format: "a4")
133
133
  File.binwrite("page.pdf", pdf)
134
134
  ```
@@ -240,7 +240,7 @@ client = GhostCrawl::Client.new(
240
240
  | URL map | `client.map(url:)` | Discover all reachable URLs |
241
241
  | Content | `client.content(url:)` | Rendered content JSON envelope |
242
242
  | Screenshot | `client.screenshot(url:)` | Capture a URL to PNG bytes |
243
- | PDF | `client.pdf(url:)` | Render a URL to PDF bytes (Chrome-only) |
243
+ | PDF | `client.pdf(url:)` | Render a URL to PDF bytes (any engine) |
244
244
  | Agent (BYO) | `client.agent(task:)` | NL browser task — account-gated, BYO model |
245
245
  | Crawl runs | `client.crawl_runs` | start (with `wait:`), wait\_for\_completion, list, get, cancel |
246
246
  | Sessions | `client.sessions` | create, list, extend, release |
@@ -5,14 +5,14 @@ require_relative './models'
5
5
  module GhostCrawl
6
6
  module Models
7
7
  ##
8
- # POST /v1/pdf request body, render a URL to PDF. Renders the target URL to a PDF document. Supported on Chrome identities; requests that resolve to a Firefox or WebKit identity return 400 pdf_engine_unsupported. Security: - The URL is validated against private/loopback/metadata targets. - All traffic egresses through your configured proxy. - Subject to your daily request quota.
8
+ # POST /v1/pdf request body, render a URL to PDF. Renders the target URL to a PDF document. Any requested engine produces real PDF bytes — the PDF-capable engine is selected automatically (capability pin). Security: - The URL is validated against private/loopback/metadata targets. - All traffic egresses through your configured proxy. - Subject to your daily request quota.
9
9
  class PdfRequest
10
10
  include MicrosoftKiotaAbstractions::AdditionalDataHolder, MicrosoftKiotaAbstractions::Parsable
11
11
  ##
12
12
  # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
13
13
  @additional_data
14
14
  ##
15
- # Engine override. PDF is chrome-only; 'firefox' or 'webkit' returns 400 pdf_engine_unsupported immediately (before dispatch).
15
+ # Engine override. Engine override. PDF output is produced by the PDF-capable engine regardless of the requested value (transparent capability pin).
16
16
  @engine
17
17
  ##
18
18
  # Bypass geo-coherence: claim identity_country's geo (timezone + geolocation) REGARDLESS of the exit IP. Requires a pinned identity_country + geo_select tier. Default off (geo follows the exit; forcing may create an IP<->timezone mismatch).
@@ -69,14 +69,14 @@ module GhostCrawl
69
69
  return PdfRequest.new
70
70
  end
71
71
  ##
72
- ## Gets the engine property value. Engine override. PDF is chrome-only; 'firefox' or 'webkit' returns 400 pdf_engine_unsupported immediately (before dispatch).
72
+ ## Gets the engine property value. Engine override. Engine override. PDF output is produced by the PDF-capable engine regardless of the requested value (transparent capability pin).
73
73
  ## @return a pdf_request_engine
74
74
  ##
75
75
  def engine
76
76
  return @engine
77
77
  end
78
78
  ##
79
- ## Sets the engine property value. Engine override. PDF is chrome-only; 'firefox' or 'webkit' returns 400 pdf_engine_unsupported immediately (before dispatch).
79
+ ## Sets the engine property value. Engine override. Engine override. PDF output is produced by the PDF-capable engine regardless of the requested value (transparent capability pin).
80
80
  ## @param value Value to set for the engine property.
81
81
  ## @return a void
82
82
  ##
@@ -1,7 +1,7 @@
1
1
  module GhostCrawl
2
2
  module Models
3
3
  ##
4
- # Engine override. PDF is chrome-only; 'firefox' or 'webkit' returns 400 pdf_engine_unsupported immediately (before dispatch).
4
+ # Engine override. Engine override. PDF output is produced by the PDF-capable engine regardless of the requested value (transparent capability pin).
5
5
  PdfRequestEngine = {
6
6
  Auto: :Auto,
7
7
  Chrome: :Chrome,
@@ -27,7 +27,7 @@ module GhostCrawl
27
27
  # Engine override. 'auto' (default): the identity's browser decides the engine. 'chrome'|'firefox'|'webkit': force that engine, enforced only if coherent with the identity (e.g. iOS identities are always webkit); incoherent picks are rejected, never coerced to a hybrid.
28
28
  @engine
29
29
  ##
30
- # Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes (Chrome identities only; Firefox and WebKit return 400 pdf_engine_unsupported).
30
+ # Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes. The PDF-capable engine is selected automatically for any requested engine (capability pin).
31
31
  @format
32
32
  ##
33
33
  # When screenshot=true, capture the FULL document height instead of just the visible viewport. Ignored when screenshot_selector is set.
@@ -195,14 +195,14 @@ module GhostCrawl
195
195
  @engine = value
196
196
  end
197
197
  ##
198
- ## Gets the format property value. Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes (Chrome identities only; Firefox and WebKit return 400 pdf_engine_unsupported).
198
+ ## Gets the format property value. Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes. The PDF-capable engine is selected automatically for any requested engine (capability pin).
199
199
  ## @return a scrape_request_format
200
200
  ##
201
201
  def format
202
202
  return @format
203
203
  end
204
204
  ##
205
- ## Sets the format property value. Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes (Chrome identities only; Firefox and WebKit return 400 pdf_engine_unsupported).
205
+ ## Sets the format property value. Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes. The PDF-capable engine is selected automatically for any requested engine (capability pin).
206
206
  ## @param value Value to set for the format property.
207
207
  ## @return a void
208
208
  ##
@@ -1,7 +1,7 @@
1
1
  module GhostCrawl
2
2
  module Models
3
3
  ##
4
- # Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes (Chrome identities only; Firefox and WebKit return 400 pdf_engine_unsupported).
4
+ # Response format. 'html' (default): the fully rendered DOM. 'markdown': returns a {markdown, chunks, citations, token_estimate} envelope with prompt-injection-neutralized, token-budgeted output. 'pdf': returns application/pdf bytes. The PDF-capable engine is selected automatically for any requested engine (capability pin).
5
5
  ScrapeRequestFormat = {
6
6
  Html: :Html,
7
7
  Markdown: :Markdown,
@@ -10,7 +10,7 @@ module GhostCrawl
10
10
  # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
11
11
  @additional_data
12
12
  ##
13
- # Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. NOTE: an explicitly sent engine='chrome' counts as explicit even though it equals the default, so a client that always serializes engine must send 'auto' (or omit it) with random_ios / random_mobile. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
13
+ # Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
14
14
  @device
15
15
  ##
16
16
  # device='static' only: a stable non-negative integer, scoped to YOUR organization (the server derives the identity from org + seed, so another org's seed 1 is a different device). Seeds the population device draw AND pins the fingerprint, so every create from this org with the same seed (and engine) is the same device. Store it to bring the same device back.
@@ -58,14 +58,14 @@ module GhostCrawl
58
58
  return SessionCreateRequest.new
59
59
  end
60
60
  ##
61
- ## Gets the device property value. Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. NOTE: an explicitly sent engine='chrome' counts as explicit even though it equals the default, so a client that always serializes engine must send 'auto' (or omit it) with random_ios / random_mobile. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
61
+ ## Gets the device property value. Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
62
62
  ## @return a session_create_request_device
63
63
  ##
64
64
  def device
65
65
  return @device
66
66
  end
67
67
  ##
68
- ## Sets the device property value. Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. NOTE: an explicitly sent engine='chrome' counts as explicit even though it equals the default, so a client that always serializes engine must send 'auto' (or omit it) with random_ios / random_mobile. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
68
+ ## Sets the device property value. Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
69
69
  ## @param value Value to set for the device property.
70
70
  ## @return a void
71
71
  ##
@@ -1,7 +1,7 @@
1
1
  module GhostCrawl
2
2
  module Models
3
3
  ##
4
- # Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. NOTE: an explicitly sent engine='chrome' counts as explicit even though it equals the default, so a client that always serializes engine must send 'auto' (or omit it) with random_ios / random_mobile. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
4
+ # Device class for the population identity draw. 'random' (default) = the unchanged population draw for the requested engine. 'random_desktop' (windows/macos/linux), 'random_mobile' (ios/android), 'random_windows', 'random_android', 'random_ios' restrict WHICH real-population devices may be drawn; the weights inside the class stay the real OS/browser/device shares. When engine is omitted (or 'auto') the engine is routed from the drawn device: iOS -> webkit (always), android -> chrome, desktop -> chrome/firefox/webkit per the real browser share. An explicit engine the class cannot render on (e.g. random_ios + chrome) is rejected with 422 device_engine_mismatch, never re-routed. With identity_config/profile the operating system must lie inside the class (422 device_identity_mismatch). 'static' pins ONE fixed device: pass device_seed (the same seed always yields the same device and a byte-stable fingerprint), or a profile, or an identity_config carrying reuse_identity_seed (422 device_static_requires_seed otherwise).
5
5
  SessionCreateRequestDevice = {
6
6
  Random: :Random,
7
7
  Random_desktop: :Random_desktop,
@@ -6,7 +6,7 @@ require_relative './models'
6
6
  module GhostCrawl
7
7
  module Models
8
8
  ##
9
- # Wire-public delivery log representation. 13 wire-public fields per webhook_deliveries schema. All fields are operator/integrator-facing, no secret material.
9
+ # Wire-public delivery log representation. 13 wire-public fields per webhook_deliveries schema.
10
10
  class WebhookDeliveryPublic
11
11
  include MicrosoftKiotaAbstractions::AdditionalDataHolder, MicrosoftKiotaAbstractions::Parsable
12
12
  ##
@@ -22,7 +22,7 @@ module GhostCrawl
22
22
  super(path_parameters, request_adapter, "{+baseurl}/v1/extract")
23
23
  end
24
24
  ##
25
- ## structured extraction: deterministic (no model) or connect-your-model. GhostCrawl is a HARNESS, not an AI provider: it fetches and prepares clean content; your OWN connected model does any semantic extraction. GhostCrawl never runs inference on an operator key. CONNECT-YOUR-AI (a prompt but NO model_provider): returns 422 model_provider_required, connect your AI/LLM (pass model_provider) to run semantic extraction. Never a silent empty. DETERMINISTIC (model_provider absent, default): 1. The schema is validated (input guard). 2. The URL is validated against private/loopback/metadata targets. 3. The page is fetched and rendered. 4. Structured data is read natively from the page's schema.org JSON-LD / microdata / Open Graph. 5. The result is validated against the schema, 422 on mismatch (field path only). Returns {"url","data","token_estimate"}. When the page embedded NO matching structured data (every field null/empty), the response also carries a non-fatal "warnings":["no_structured_data: …pass model_provider…"] so an all-null 200 is not mistaken for a failure. BRING-YOUR-OWN-MODEL (model_provider present): 1. Target URLs are resolved (urls or [url]). 2. The schema is validated if present. 3. At least one of prompt or schema is required, 400 prompt_or_schema_required otherwise. 4. Model credentials are validated, 400 invalid_model_provider on error (the message never echoes the key). 5. Every target URL is validated before fetching, 400 ssrf_blocked. 6. Each URL is fetched and converted to clean Markdown. 7. Your connected model performs the extraction. 8. With a schema present, the result is validated, 422 on mismatch. Returns {"urls","data","token_estimate"}. Security: 401 without a valid Bearer token. - model_provider.api_key is request-scoped: never persisted, logged, or echoed. - Error responses never echo the schema body, fetched content, or credentials.
25
+ ## structured extraction: deterministic (no model) or connect-your-model. CONNECT-YOUR-AI (a prompt but NO model_provider): returns 422 model_provider_required, connect your AI/LLM (pass model_provider) to run semantic extraction. Never a silent empty. DETERMINISTIC (model_provider absent, default): 1. The schema is validated (input guard). 2. The URL is validated against private/loopback/metadata targets. 3. The page is fetched and rendered. 4. Structured data is read natively from the page's schema.org JSON-LD / microdata / Open Graph. 5. The result is validated against the schema, 422 on mismatch (field path only). Returns {"url","data","token_estimate"}. When the page embedded NO matching structured data (every field null/empty), the response also carries a non-fatal "warnings":["no_structured_data: …pass model_provider…"] so an all-null 200 is not mistaken for a failure. BRING-YOUR-OWN-MODEL (model_provider present): 1. Target URLs are resolved (urls or [url]). 2. The schema is validated if present. 3. At least one of prompt or schema is required, 400 prompt_or_schema_required otherwise. 4. Model credentials are validated, 400 invalid_model_provider on error (the message never echoes the key). 5. Every target URL is validated before fetching, 400 ssrf_blocked. 6. Each URL is fetched and converted to clean Markdown. 7. Your connected model performs the extraction. 8. With a schema present, the result is validated, 422 on mismatch. Returns {"urls","data","token_estimate"}. Security: 401 without a valid Bearer token. - model_provider.api_key is request-scoped: never persisted, logged, or echoed. - Error responses never echo the schema body, fetched content, or credentials.
26
26
  ## @param body POST /v1/extract request body, schema-driven extraction (deterministic) + bring-your-own-model extraction. Two extraction modes: - Deterministic (default, model_provider absent): native structured-data extraction, reads the schema.org JSON-LD / microdata / Open Graph a page already embeds and fills the schema (no model, no third party); returns whole priced product grids. Requires 'schema'. Returns {"url","data","token_estimate"}. - Bring-your-own-model (model_provider present): GhostCrawl fetches and prepares clean Markdown; your connected model performs the semantic extraction (you are not billed for model inference here, only the request quota). Returns {"urls","data","token_estimate"}. Security notes: - The 'schema' field is validated before any fetch (fail-fast input guard). - URLs are validated against private, loopback, and metadata targets before any fetch. - Error responses never echo the schema body, fetched content, or model credentials. - model_provider.api_key is request-scoped only: never persisted, logged, or returned in any response body or error message.
27
27
  ## @param request_configuration Configuration for the request such as headers, query parameters, and middleware options.
28
28
  ## @return a Fiber of extract_post_response
@@ -44,7 +44,7 @@ module GhostCrawl
44
44
  return @request_adapter.send_async(request_info, lambda {|pn| GhostCrawl::V1::Extract::ExtractPostResponse.create_from_discriminator_value(pn) }, error_mapping)
45
45
  end
46
46
  ##
47
- ## structured extraction: deterministic (no model) or connect-your-model. GhostCrawl is a HARNESS, not an AI provider: it fetches and prepares clean content; your OWN connected model does any semantic extraction. GhostCrawl never runs inference on an operator key. CONNECT-YOUR-AI (a prompt but NO model_provider): returns 422 model_provider_required, connect your AI/LLM (pass model_provider) to run semantic extraction. Never a silent empty. DETERMINISTIC (model_provider absent, default): 1. The schema is validated (input guard). 2. The URL is validated against private/loopback/metadata targets. 3. The page is fetched and rendered. 4. Structured data is read natively from the page's schema.org JSON-LD / microdata / Open Graph. 5. The result is validated against the schema, 422 on mismatch (field path only). Returns {"url","data","token_estimate"}. When the page embedded NO matching structured data (every field null/empty), the response also carries a non-fatal "warnings":["no_structured_data: …pass model_provider…"] so an all-null 200 is not mistaken for a failure. BRING-YOUR-OWN-MODEL (model_provider present): 1. Target URLs are resolved (urls or [url]). 2. The schema is validated if present. 3. At least one of prompt or schema is required, 400 prompt_or_schema_required otherwise. 4. Model credentials are validated, 400 invalid_model_provider on error (the message never echoes the key). 5. Every target URL is validated before fetching, 400 ssrf_blocked. 6. Each URL is fetched and converted to clean Markdown. 7. Your connected model performs the extraction. 8. With a schema present, the result is validated, 422 on mismatch. Returns {"urls","data","token_estimate"}. Security: 401 without a valid Bearer token. - model_provider.api_key is request-scoped: never persisted, logged, or echoed. - Error responses never echo the schema body, fetched content, or credentials.
47
+ ## structured extraction: deterministic (no model) or connect-your-model. CONNECT-YOUR-AI (a prompt but NO model_provider): returns 422 model_provider_required, connect your AI/LLM (pass model_provider) to run semantic extraction. Never a silent empty. DETERMINISTIC (model_provider absent, default): 1. The schema is validated (input guard). 2. The URL is validated against private/loopback/metadata targets. 3. The page is fetched and rendered. 4. Structured data is read natively from the page's schema.org JSON-LD / microdata / Open Graph. 5. The result is validated against the schema, 422 on mismatch (field path only). Returns {"url","data","token_estimate"}. When the page embedded NO matching structured data (every field null/empty), the response also carries a non-fatal "warnings":["no_structured_data: …pass model_provider…"] so an all-null 200 is not mistaken for a failure. BRING-YOUR-OWN-MODEL (model_provider present): 1. Target URLs are resolved (urls or [url]). 2. The schema is validated if present. 3. At least one of prompt or schema is required, 400 prompt_or_schema_required otherwise. 4. Model credentials are validated, 400 invalid_model_provider on error (the message never echoes the key). 5. Every target URL is validated before fetching, 400 ssrf_blocked. 6. Each URL is fetched and converted to clean Markdown. 7. Your connected model performs the extraction. 8. With a schema present, the result is validated, 422 on mismatch. Returns {"urls","data","token_estimate"}. Security: 401 without a valid Bearer token. - model_provider.api_key is request-scoped: never persisted, logged, or echoed. - Error responses never echo the schema body, fetched content, or credentials.
48
48
  ## @param body POST /v1/extract request body, schema-driven extraction (deterministic) + bring-your-own-model extraction. Two extraction modes: - Deterministic (default, model_provider absent): native structured-data extraction, reads the schema.org JSON-LD / microdata / Open Graph a page already embeds and fills the schema (no model, no third party); returns whole priced product grids. Requires 'schema'. Returns {"url","data","token_estimate"}. - Bring-your-own-model (model_provider present): GhostCrawl fetches and prepares clean Markdown; your connected model performs the semantic extraction (you are not billed for model inference here, only the request quota). Returns {"urls","data","token_estimate"}. Security notes: - The 'schema' field is validated before any fetch (fail-fast input guard). - URLs are validated against private, loopback, and metadata targets before any fetch. - Error responses never echo the schema body, fetched content, or model credentials. - model_provider.api_key is request-scoped only: never persisted, logged, or returned in any response body or error message.
49
49
  ## @param request_configuration Configuration for the request such as headers, query parameters, and middleware options.
50
50
  ## @return a request_information
@@ -23,7 +23,7 @@ module GhostCrawl
23
23
  end
24
24
  ##
25
25
  ## render a URL to PDF. Equivalent to /v1/scrape with format=pdf. Returns application/pdf bytes. Supported on Chrome identities; Firefox and WebKit return 400. The URL is validated and all traffic egresses through your configured proxy. Requires a paid plan and is subject to your request quota (same as /v1/extract).
26
- ## @param body POST /v1/pdf request body, render a URL to PDF. Renders the target URL to a PDF document. Supported on Chrome identities; requests that resolve to a Firefox or WebKit identity return 400 pdf_engine_unsupported. Security: - The URL is validated against private/loopback/metadata targets. - All traffic egresses through your configured proxy. - Subject to your daily request quota.
26
+ ## @param body POST /v1/pdf request body, render a URL to PDF. Renders the target URL to a PDF document. Any requested engine produces real PDF bytes — the PDF-capable engine is selected automatically (capability pin). Security: - The URL is validated against private/loopback/metadata targets. - All traffic egresses through your configured proxy. - Subject to your daily request quota.
27
27
  ## @param request_configuration Configuration for the request such as headers, query parameters, and middleware options.
28
28
  ## @return a Fiber of binary
29
29
  ##
@@ -38,7 +38,7 @@ module GhostCrawl
38
38
  end
39
39
  ##
40
40
  ## render a URL to PDF. Equivalent to /v1/scrape with format=pdf. Returns application/pdf bytes. Supported on Chrome identities; Firefox and WebKit return 400. The URL is validated and all traffic egresses through your configured proxy. Requires a paid plan and is subject to your request quota (same as /v1/extract).
41
- ## @param body POST /v1/pdf request body, render a URL to PDF. Renders the target URL to a PDF document. Supported on Chrome identities; requests that resolve to a Firefox or WebKit identity return 400 pdf_engine_unsupported. Security: - The URL is validated against private/loopback/metadata targets. - All traffic egresses through your configured proxy. - Subject to your daily request quota.
41
+ ## @param body POST /v1/pdf request body, render a URL to PDF. Renders the target URL to a PDF document. Any requested engine produces real PDF bytes — the PDF-capable engine is selected automatically (capability pin). Security: - The URL is validated against private/loopback/metadata targets. - All traffic egresses through your configured proxy. - Subject to your daily request quota.
42
42
  ## @param request_configuration Configuration for the request such as headers, query parameters, and middleware options.
43
43
  ## @return a request_information
44
44
  ##
@@ -25,7 +25,7 @@ module GhostCrawl
25
25
  super(path_parameters, request_adapter, "{+baseurl}/v1/search/jobs/{job_id}")
26
26
  end
27
27
  ##
28
- ## 200 + SearchResult when done (real result items = GREEN); 202 {status:"running"} while the extended rotation is still going (carrying ``deadline``/``poll_max_seconds`` so the client loop is bounded); 200 {status:"open", items:[]} on honest exhaustion (challenged/0-result, never a faked GREEN); 200 {status:"temporarily_unavailable"} when the deadline passes with the record still ``running`` (retryable terminal); 404 if unknown/expired/foreign. Ownership-scoped: a job created by another tenant reads as 404. BOUNDED-TERMINAL CONTRACT (no infinite poll): every poll resolves to a terminal within the stamped deadline, whatever happens server-side. A 404 is TERMINAL, the job expired or is unknown; the query may be retried at a HUMAN pace after Retry-After, but a 404 must NEVER be auto-interpreted as "resubmit the same query in a tight loop" (that is the one behavior that turns a recoverable miss into an infinite loop). See the SDK/MCP wrapper.
28
+ ## Ownership-scoped: a job created by another tenant reads as 404.
29
29
  ## @param request_configuration Configuration for the request such as headers, query parameters, and middleware options.
30
30
  ## @return a Fiber of binary
31
31
  ##
@@ -38,7 +38,7 @@ module GhostCrawl
38
38
  return @request_adapter.send_async(request_info, Binary, error_mapping)
39
39
  end
40
40
  ##
41
- ## 200 + SearchResult when done (real result items = GREEN); 202 {status:"running"} while the extended rotation is still going (carrying ``deadline``/``poll_max_seconds`` so the client loop is bounded); 200 {status:"open", items:[]} on honest exhaustion (challenged/0-result, never a faked GREEN); 200 {status:"temporarily_unavailable"} when the deadline passes with the record still ``running`` (retryable terminal); 404 if unknown/expired/foreign. Ownership-scoped: a job created by another tenant reads as 404. BOUNDED-TERMINAL CONTRACT (no infinite poll): every poll resolves to a terminal within the stamped deadline, whatever happens server-side. A 404 is TERMINAL, the job expired or is unknown; the query may be retried at a HUMAN pace after Retry-After, but a 404 must NEVER be auto-interpreted as "resubmit the same query in a tight loop" (that is the one behavior that turns a recoverable miss into an infinite loop). See the SDK/MCP wrapper.
41
+ ## Ownership-scoped: a job created by another tenant reads as 404.
42
42
  ## @param request_configuration Configuration for the request such as headers, query parameters, and middleware options.
43
43
  ## @return a request_information
44
44
  ##
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "microsoft_kiota_abstractions"
4
+
5
+ module GhostCrawl
6
+ # Compatibility type for Kiota 1.32.2 Ruby codegen output.
7
+ #
8
+ # The pinned generated SDK passes `Binary` as the success response factory for
9
+ # every modeled operation whose OpenAPI success schema is empty/binary
10
+ # (e.g. `CrawlRunsRequestBuilder#post` -> `send_async(request_info, Binary, …)`).
11
+ # Kiota 1.32.2 emits that reference but never defines the constant, so every
12
+ # generated endpoint resolves `Binary` at call time and raises `NameError`
13
+ # BEFORE any request is sent — including the documented quickstart examples.
14
+ #
15
+ # This type implements the real Kiota `Parsable` + `AdditionalDataHolder`
16
+ # contract so a generated response deserializes normally:
17
+ # * `self.call(parse_node)` is the factory entry point used by
18
+ # `JsonParseNode#get_object_value`; `assign_field_values` then routes all
19
+ # response fields into `additional_data` (there are no modeled fields).
20
+ # * `serialize` round-trips those fields back out, so
21
+ # `GhostCrawl::ResponseHelper.to_hash` recovers the full JSON payload.
22
+ #
23
+ # This is a source fix in the SDK itself, not a per-example workaround: it
24
+ # repairs the generated-code surface for ALL generated endpoints at once.
25
+ class Binary
26
+ include MicrosoftKiotaAbstractions::AdditionalDataHolder
27
+ include MicrosoftKiotaAbstractions::Parsable
28
+
29
+ def initialize
30
+ @additional_data = {}
31
+ end
32
+
33
+ # Factory invoked by JsonParseNode#get_object_value(factory).
34
+ def self.call(_parse_node)
35
+ new
36
+ end
37
+
38
+ def additional_data
39
+ @additional_data
40
+ end
41
+
42
+ def additional_data=(value)
43
+ @additional_data = value
44
+ end
45
+
46
+ def get_field_deserializers
47
+ {}
48
+ end
49
+
50
+ def serialize(writer)
51
+ writer.write_additional_data(@additional_data)
52
+ end
53
+ end
54
+ end
@@ -1157,6 +1157,13 @@ module GhostCrawl
1157
1157
  ResponseHelper.json_request!(@adapter, :POST, "/v1/sessions/#{profile_id}/recording/stop",
1158
1158
  opts.transform_keys(&:to_s))
1159
1159
  end
1160
+
1161
+ # Drive one navigate/act step on a live session.
1162
+ # Delegates to POST /v1/sessions/{session_id}/step via the shared adapter.
1163
+ def step(session_id, **opts)
1164
+ ResponseHelper.json_request!(@adapter, :POST, "/v1/sessions/#{session_id}/step",
1165
+ opts.transform_keys(&:to_s))
1166
+ end
1160
1167
  end
1161
1168
 
1162
1169
  # Low-level CDP primitives — /v1/cdp/*. These drive a live session directly.
@@ -1988,8 +1995,8 @@ module GhostCrawl
1988
1995
  # data = client.pdf(url: "https://example.com")
1989
1996
  # File.binwrite("page.pdf", data)
1990
1997
  #
1991
- # PDF output is Chrome-only; a request that resolves to a Firefox or WebKit
1992
- # identity is rejected with 400 +pdf_engine_unsupported+ (a {GhostCrawlError}).
1998
+ # PDF output is produced by the PDF-capable engine for any requested engine; a Firefox or WebKit
1999
+ # identity is served real PDF bytes (capability-pinned)
1993
2000
  #
1994
2001
  # +/v1/pdf+ has no generated request builder, so this hand-builds a
1995
2002
  # {MicrosoftKiotaAbstractions::RequestInformation} and routes it through the
@@ -1998,7 +2005,7 @@ module GhostCrawl
1998
2005
  # @param url [String] target URL to render
1999
2006
  # @param paper_format [String] page size: "a4" (default), "letter", "legal", "tabloid"
2000
2007
  # @param landscape [Boolean] render in landscape orientation (default false)
2001
- # @param engine [String] browser engine (PDF is Chrome-only; default "auto")
2008
+ # @param engine [String] browser engine (PDF is capability-pinned; default "auto")
2002
2009
  # @return [String] the raw PDF bytes (ASCII-8BIT)
2003
2010
  def pdf(url:, paper_format: "a4", landscape: false, engine: "auto", **opts)
2004
2011
  data = { "url" => url, "paper_format" => paper_format,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GhostCrawl
4
- VERSION = "2.3.9"
4
+ VERSION = "2.3.91"
5
5
  end
data/lib/ghostcrawl.rb CHANGED
@@ -3,6 +3,9 @@
3
3
  require_relative "ghostcrawl/version"
4
4
  require_relative "ghostcrawl/error_codes"
5
5
  require_relative "ghostcrawl/errors"
6
+ # Must load before client.rb: generated request builders resolve the `Binary`
7
+ # response factory by constant lookup at call time (Kiota 1.32.2 codegen gap).
8
+ require_relative "ghostcrawl/binary"
6
9
  require_relative "ghostcrawl/client"
7
10
 
8
11
  # GhostCrawl SDK — collect web data at scale.
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghostcrawl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.9
4
+ version: 2.3.91
5
5
  platform: ruby
6
6
  authors:
7
7
  - GhostCrawl
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-11-22 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: microsoft_kiota_abstractions
@@ -427,6 +428,7 @@ files:
427
428
  - _generated/v1/webhooks/webhooks.rb
428
429
  - _generated/v1/webhooks/webhooks_request_builder.rb
429
430
  - lib/ghostcrawl.rb
431
+ - lib/ghostcrawl/binary.rb
430
432
  - lib/ghostcrawl/client.rb
431
433
  - lib/ghostcrawl/error_codes.rb
432
434
  - lib/ghostcrawl/errors.rb
@@ -439,6 +441,7 @@ metadata:
439
441
  documentation_uri: https://docs.ghostcrawl.io
440
442
  source_code_uri: https://github.com/ghostcrawl/ghostcrawl-ruby
441
443
  rubygems_mfa_required: 'true'
444
+ post_install_message:
442
445
  rdoc_options: []
443
446
  require_paths:
444
447
  - lib
@@ -454,7 +457,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
454
457
  - !ruby/object:Gem::Version
455
458
  version: '0'
456
459
  requirements: []
457
- rubygems_version: 3.6.9
460
+ rubygems_version: 3.4.20
461
+ signing_key:
458
462
  specification_version: 4
459
463
  summary: The official Ruby SDK for the GhostCrawl API.
460
464
  test_files: []