English fallback
This translation is missing; the canonical English reference follows.
Native content crawl SDK¶
The public Experimental PlanNativeCrawl and asynchronous RunNativeCrawl
consume an existing workspace, current scope, one canonical seed URL, an exact
sorted tuple of at most sixteen selected same-origin URLs, selected owner and a
synchronous current typed ImpactPolicy reader. Only literal-loopback anonymous
HTTP is admitted. Planning contacts no target, creates no execution grant and
returns a NativeCrawlPlan with exact invocations, policy plans and revision bases.
Execution additionally requires approve_safe_crawl=True. Both entry points
accept limits=NativeCrawlLimits(...), an aware decision clock, and optional
current_owner_provider. A trusted reader must return the original selected
owner afresh; default selected-owner attribution cannot detect external principal
changes. Neither consent nor permission is inferred from discovered links.
NativeCrawlSummary preserves the actual JobSnapshot, original records,
ordered completed_urls, reopened model/workspace revisions, per-page
model_saves, workspace_persistence_status, acknowledged_record_ids,
custody_status, events and duration. ToDict() exposes safe original IDs and
source metadata. ExitCode() returns 0 for completion, 3 for authority denial,
4 for other failure and 130 for cancellation. The CLI uses 2 for invalid
configuration; invalid initial SDK arguments can raise before a job exists.
Earlier original acquisitions and commits survive later failure. Observed committed state does not create a missing acknowledgement or trigger a retry, rebase or rollback. Original worker outcomes stay unchanged during cancellation; unknown cleanup/outcomes cannot become successful source projection. Workspace retention uses at most one original Save attempt, independently of page model CAS.
The model stores source/link Observations and structural RequestTemplates, with no security Finding or automatic STANDARD Git-check grant. Body digests attest worker interpretation without retaining bodies or independently replaying extraction. See the operator guide for exact CLI selections, limits, explicit authority and verification boundaries.
fuzzy1337.native_crawl_workflow
¶
Explicit native crawl SDK planning, original job ownership and one workspace CAS.
NativeCrawlPlan
dataclass
¶
Descriptive immutable admitted intents; only the seed initially becomes reachable work.
源代码位于: fuzzy1337/native_crawl_workflow.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
ToDict() -> dict[str, object]
¶
Expose exact nonexecuting selected intent without granting or predicting a frontier.
返回:
| 类型 | 描述 |
|---|---|
dict[str, object]
|
Schema-one plan with no worker contact, raw response bytes or assessment claim. |
源代码位于: fuzzy1337/native_crawl_workflow.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
NativeCrawlWorkflow
¶
Keep guarded original workspace retention inside the same live outer ScanJob.
源代码位于: fuzzy1337/native_crawl_workflow.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
__init__(provider: NativeCrawlProvider, workspace: WorkspaceState) -> None
¶
Freeze one original workspace basis and share one attempt across success/finally.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
provider
|
NativeCrawlProvider
|
Original single-use first-party acquisition/scheduling owner. |
必需 |
workspace
|
WorkspaceState
|
Exact original CAS basis, never refreshed or silently rebased. |
必需 |
源代码位于: fuzzy1337/native_crawl_workflow.py
127 128 129 130 131 132 133 134 135 136 137 | |
Persist(context: JobContext) -> None
¶
Make at most one guarded workspace Save, preserving actual original evidence IDs.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
context
|
JobContext
|
Same active outer owner used for acquisition and canonical model commits. |
必需 |
源代码位于: fuzzy1337/native_crawl_workflow.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
Run(context: JobContext) -> None
async
¶
Retain original model/evidence state on failure without unauthorized Save or repair.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
context
|
JobContext
|
Actual running job context, shared directly with the original provider. |
必需 |
引发:
| 类型 | 描述 |
|---|---|
JobError
|
Original execution, authority or exact persistence failed. |
CancelledError
|
Cancellation after the original provider cleanup settled. |
源代码位于: fuzzy1337/native_crawl_workflow.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
NativeCrawlSummary
dataclass
¶
Actual original job and incremental persistence facts, never a security assessment.
源代码位于: fuzzy1337/native_crawl_workflow.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
ToDict() -> dict[str, object]
¶
Return safe selected URLs, actual original IDs and explicit partial/unknown outcomes.
返回:
| 类型 | 描述 |
|---|---|
dict[str, object]
|
Schema-one summary without raw markup, excluded hrefs or Findings claims. |
源代码位于: fuzzy1337/native_crawl_workflow.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
ExitCode() -> int
¶
Map actual terminal state without converting refused work into a negative finding.
返回:
| 类型 | 描述 |
|---|---|
int
|
Zero on completion, three for denial, four for failure or 130 for cancellation. |
源代码位于: fuzzy1337/native_crawl_workflow.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
PlanNativeCrawl(workspace_root: Path, scope_id: str, seed_url: str, selected_urls: tuple[str, ...], owner_reference: str, policy_provider: Callable[[], ImpactPolicy], *, limits: NativeCrawlLimits = NativeCrawlLimits(), clock: Callable[[], datetime] = UtcNow, current_owner_provider: Callable[[], str] | None = None) -> NativeCrawlPlan
¶
Plan the exact admitted set without grant, target contact or canonical writes.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
workspace_root
|
Path
|
Existing initialized workspace/model/evidence partition. |
必需 |
scope_id
|
str
|
Existing complete selected URL and literal IP consent scope. |
必需 |
seed_url
|
str
|
Original exact canonical anonymous HTTP seed. |
必需 |
selected_urls
|
tuple[str, ...]
|
Entire sorted distinct finite same-origin URL set including the seed. |
必需 |
owner_reference
|
str
|
Original selected actor attribution, independent of consent attester. |
必需 |
policy_provider
|
Callable[[], ImpactPolicy]
|
Fresh synchronous typed acquisition policy reader. |
必需 |
limits
|
NativeCrawlLimits
|
Accepted finite operation/request/allocation bounds. |
NativeCrawlLimits()
|
clock
|
Callable[[], datetime]
|
Aware current authority clock. |
UtcNow
|
current_owner_provider
|
Callable[[], str] | None
|
Optional trusted fresh attribution, without authentication claim. |
None
|
返回:
| 类型 | 描述 |
|---|---|
NativeCrawlPlan
|
Exact descriptive per-source intents and observed canonical revision bases. |
源代码位于: fuzzy1337/native_crawl_workflow.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
RunNativeCrawl(workspace_root: Path, scope_id: str, seed_url: str, selected_urls: tuple[str, ...], owner_reference: str, policy_provider: Callable[[], ImpactPolicy], *, approve_safe_crawl: bool = False, on_event: Callable[[JobEvent], None] | None = None, limits: NativeCrawlLimits = NativeCrawlLimits(), clock: Callable[[], datetime] = UtcNow, current_owner_provider: Callable[[], str] | None = None) -> NativeCrawlSummary
async
¶
Run content-driven acquisition with explicit SAFE approval and one original owner.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
workspace_root
|
Path
|
Existing initialized caller-owned workspace. |
必需 |
scope_id
|
str
|
Existing current complete URL/IP consent scope. |
必需 |
seed_url
|
str
|
Exact canonical seed URL, sole initial scheduled source. |
必需 |
selected_urls
|
tuple[str, ...]
|
Complete sorted same-origin selection, never automatic enrollment. |
必需 |
owner_reference
|
str
|
Original selected actor attribution, independent from attester. |
必需 |
policy_provider
|
Callable[[], ImpactPolicy]
|
Synchronous current typed acquisition policy reader. |
必需 |
approve_safe_crawl
|
bool
|
Exact independent SAFE workflow opt-in. |
False
|
on_event
|
Callable[[JobEvent], None] | None
|
Optional synchronous presentation of original safe events. |
None
|
limits
|
NativeCrawlLimits
|
Accepted finite request/scheduling/allocation/inclusive time bounds. |
NativeCrawlLimits()
|
clock
|
Callable[[], datetime]
|
Fresh aware authority and evidence clock. |
UtcNow
|
current_owner_provider
|
Callable[[], str] | None
|
Optional trusted fresh attribution; default is selected actor. |
None
|
返回:
| 类型 | 描述 |
|---|---|
NativeCrawlSummary
|
Actual terminal job, original records and reopened exact persistence state. |
源代码位于: fuzzy1337/native_crawl_workflow.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |