diff --git a/.claude/skills/seclai-sdk-sync/SKILL.md b/.claude/skills/seclai-sdk-sync/SKILL.md index bfdad17..16818d9 100644 --- a/.claude/skills/seclai-sdk-sync/SKILL.md +++ b/.claude/skills/seclai-sdk-sync/SKILL.md @@ -100,6 +100,15 @@ for those two SDKs will not drop as typing improves. Check the façade before concluding an endpoint is untyped. seclai-javascript needs no façade (`unknown` to a concrete type is source compatible) and does report zero. +**`params` and `returns` follow one hop into a non-public helper, and no further.** +A public method with no request of its own that calls a non-public method of the +same client holding the verb and path literal (Go `c.thingsBody(`, C# `internal +…ResponseAsync`, Python `self._x(`, JS `private`/`#x`) is audited as that request, +with its own declared return type; both summaries then print how many methods +were resolved that way, so a drop in that number is a narrower audit, not a +cleaner SDK. A second hop, a helper that takes its verb or path as an argument, +and a call from another class (the façade's `_client.X(`) are still not followed. + **Dated versioning breaks the one-shape assumption.** Since `Seclai-Version` (2026-07-28) an operation can have two legal response bodies — a bare array by default, the canonical `{data, pagination}` envelope once the caller opts in — diff --git a/.claude/skills/seclai-sdk-sync/sdksync.py b/.claude/skills/seclai-sdk-sync/sdksync.py index 7d3b7ca..6a9d205 100755 --- a/.claude/skills/seclai-sdk-sync/sdksync.py +++ b/.claude/skills/seclai-sdk-sync/sdksync.py @@ -47,6 +47,11 @@ # "this method sends no params" — a silent false pass. # helpers — positional helper calls that expand to a fixed, ordered key list. # Expansion is arity-aware: only as many keys as arguments supplied. +# Endpoint helpers, used by `params` and `returns` (see `request_blocks`): +# helper_re — a NON-public method declaration on the client, name captured. +# helper_call — how the client calls one of its own methods; `{name}` is filled +# in. Receiver-qualified so `_client.X(` and `t.c.x(` — a typed +# façade calling in from another class — are not followed. LANGS = { "python": { "sig_re": r"\n (?:async )?def ([a-z]\w*)\(([^)]*)\)\s*->\s*([^:]+):", @@ -62,6 +67,8 @@ "return_re": r"\s*->\s*([^:\n]+):", "dict_at": [r"params\s*=\s*(?:_strip_none\()?\s*"], "dict_key_re": r'"([a-zA-Z_][a-zA-Z0-9_]*)"\s*:', + "helper_re": r"^[ \t]+(?:async )?def (_[a-z0-9][a-z0-9_]*)\(", + "helper_call": r"\bself\.{name}\(", "skip": {"request", "request_raw", "stream", "paginate"}, }, "javascript": { @@ -82,6 +89,11 @@ "return_re": r"\s*:\s*([^{\n]+?)\s*\{", "dict_at": [r"query:\s*"], "dict_key_re": r'["\']?([a-zA-Z_][a-zA-Z0-9_]*)["\']?\s*:', + # `private`/`protected`/`#name` members only. An unmodified `_name(` is + # matched by method_re and already audited as a block of its own. + "helper_re": (r"^ (?:(?:private|protected) (?:static )?(?:async )?\*?|(?:async )?\*?#)" + r"([a-zA-Z_][a-zA-Z0-9_]*)\s*[(<]"), + "helper_call": r"\bthis\.#?{name}\s*[(<]", "skip": {"request", "requestRaw", "uploadFile", "paginate"}, }, "go": { @@ -105,6 +117,10 @@ "dict_at": [r"map\[string\]string"], "dict_key_re": r'"([a-zA-Z_][a-zA-Z0-9_]*)"\s*:', "helpers": {"listQuery(": ["page", "limit"]}, + "helper_re": r"^func \(c \*Client\) ([a-z][A-Za-z0-9]*)\(", + "helper_call": r"(?,?\[\]. ]+ ([A-Z][A-Za-z0-9]*)\s*\("), + "helper_call": r"(? tuple[str, str] | None: return v.group(1).upper(), path +def strip_docs(text: str) -> str: + """Drop docstrings, block comments and whole-line comments. + + Helper detection reads through this: a docstring's `"GET"` and `"/sources"` + example made seclai-python's `_raise_for_openapi_response` look like the + request behind twenty methods that never issue one. + """ + text = re.sub(r'"""[\s\S]*?"""|\'\'\'[\s\S]*?\'\'\'|/\*[\s\S]*?\*/', "", text) + return re.sub(r"(?m)^[ \t]*(?://|#).*$", "", text) + + +def endpoint_helpers(text: str, cfg: dict) -> dict[str, str]: + """Non-public client method name -> body, for those that DEFINE a request. + + Defining one means holding a verb and a path literal. Transport plumbing + (`doBytes`, `SendRawResponseAsync`) takes both as arguments and holds neither, + which is what keeps it out of this index. + """ + if "helper_re" not in cfg: + return {} + ends = sorted({m.start() + for pat in (cfg["helper_re"], cfg["method_re"], cfg.get("boundary_re")) if pat + for m in re.finditer(pat, text, re.M)}) + out: dict[str, str] = {} + for m in re.finditer(cfg["helper_re"], text, re.M): + name = m.group(1) + if name in cfg.get("skip", ()) or name in out: + continue + end = next((e for e in ends if e > m.start()), len(text)) + body = strip_docs(text[m.start():end]) + if block_call(body, cfg["verb_re"]): + out[name] = body + return out + + +def helper_called(body: str, cfg: dict, helpers: dict[str, str]) -> str | None: + """Name of the first endpoint helper a method body calls, if any.""" + code = strip_docs(body) # a comment naming a helper is not a call to it + first: tuple[int, str] | None = None + for name in helpers: + m = re.search(cfg["helper_call"].replace("{name}", re.escape(name)), code) + if m and (first is None or m.start() < first[0]): + first = (m.start(), name) + return first[1] if first else None + + +def request_blocks(texts: list[str], cfg: dict): + """Yield (name, body, call, request_body, helper) per public method with a request. + + A method with no request call of its own that calls a non-public method + defining one is read through that helper — ONE hop. `body` stays the public + method's, so its declared return type is what `returns` compares; + `request_body` is where query keys are read. `helper` is None for own requests. + """ + shared: dict[str, str] = {} + if cfg.get("helper_scope") == "package": + for text in texts: + for k, v in endpoint_helpers(text, cfg).items(): + shared.setdefault(k, v) + for text in texts: + helpers = shared or endpoint_helpers(text, cfg) + for mname, body in method_blocks(text, cfg["method_re"], cfg.get("boundary_re")): + if mname in cfg.get("skip", ()): + continue + call = block_call(body, cfg["verb_re"]) + if call: + yield mname, body, call, body, None + continue + helper = helper_called(body, cfg, helpers) + if helper: + hbody = helpers[helper] + yield mname, body, block_call(hbody, cfg["verb_re"]), body + "\n" + hbody, helper + + +def via_helper_line(n: int) -> str: + return (f" {n} of the methods read were resolved through a non-public helper" + f" holding the request (one hop)") + + def block_query_keys(body: str, cfg: dict) -> tuple[set[str], bool]: """(keys, parsed_ok). parsed_ok is False when a construction site was found but could not be read — reported as an error, never as "sends nothing".""" @@ -367,32 +465,30 @@ def cmd_params(args) -> int: undeclared, not_in_spec, unparsed, exposed = set(), set(), set(), {} missing_required: set[tuple[str, str, str]] = set() - for f in files: - text = f.read_text(errors="replace") - for mname, body in method_blocks(text, cfg["method_re"], cfg.get("boundary_re")): - if mname in cfg.get("skip", ()): - continue - call = block_call(body, cfg["verb_re"]) - if not call: - continue - keys, ok = block_query_keys(body, cfg) - if not ok: - unparsed.add((mname, f"{call[0]} {call[1]}")) - if call not in index: - not_in_spec.add((mname, f"{call[0]} {call[1]}")) - continue - raw, declared, required = index[call] - exposed.setdefault((call[0], raw), set()).update(keys) - if ok: - # Only trust this when the query construction parsed: an - # unreadable site would otherwise look like "sends nothing". - for k in sorted(required - keys): - missing_required.add((mname, f"{call[0]} {raw}", k)) - for k in sorted(keys - declared): - undeclared.add((mname, f"{call[0]} {raw}", k, tuple(sorted(declared)))) + via_helper = 0 + texts = [f.read_text(errors="replace") for f in files] + for mname, _body, call, request_body, helper in request_blocks(texts, cfg): + via_helper += helper is not None + keys, ok = block_query_keys(request_body, cfg) + if not ok: + unparsed.add((mname, f"{call[0]} {call[1]}")) + if call not in index: + not_in_spec.add((mname, f"{call[0]} {call[1]}")) + continue + raw, declared, required = index[call] + exposed.setdefault((call[0], raw), set()).update(keys) + if ok: + # Only trust this when the query construction parsed: an + # unreadable site would otherwise look like "sends nothing". + for k in sorted(required - keys): + missing_required.add((mname, f"{call[0]} {raw}", k)) + for k in sorted(keys - declared): + undeclared.add((mname, f"{call[0]} {raw}", k, tuple(sorted(declared)))) print(f"{name} [{lang}] — {len(files)} client file(s), " f"{len(index)} spec operations") + if via_helper: + print(via_helper_line(via_helper)) if undeclared: print(f"\nUNDECLARED ({len(undeclared)}) — sent but the endpoint does not accept it:") @@ -845,47 +941,46 @@ def cmd_returns(args) -> int: _schema_label(_json_schema(op, "response", code))) break - mismatched, renamed, untyped, n = [], [], [], 0 - for path in files: - text = path.read_text(encoding="utf-8", errors="replace") - for mname, body in method_blocks(text, cfg["method_re"], cfg.get("boundary_re")): - if mname in cfg.get("skip", set()): - continue - call = block_call(body, cfg["verb_re"]) - if not call or call not in want: - continue - declared = block_return(body, cfg) - if declared is None: - continue - n += 1 - got, expect = normalise_type(declared, lang), want[call] - if expect in ("object", "none", "unknown", "?"): - continue # the spec itself declares nothing to match - if got == expect or strip_generated_prefix(got) == expect: - continue - # Separate the two failure modes. A list where the API returns an - # envelope throws at deserialization; a type NAMED differently from - # its schema is only cosmetic, and the SDKs rename by convention — - # all four drop the spec's `Model` and `Api` affixes. Ranking those - # equally buried the one real finding under eleven harmless ones. - # A wholly untyped return (`JsonElement`, `unknown`, `JSONValue`) - # commits to no shape at all and deserializes anything, so it is a - # coverage warning, never a shape error. - if got == "?": - untyped.append((mname, call, expect, declared)) - # Shape next. `list[dict[str, Any]]` IS a commitment to a list and is - # also untyped; testing untyped-ness first classified seclai-python's - # list_evaluation_criteria as a soft warning and reported the repo - # clean, when it is exactly as broken as the Go and JS ones. - elif got.startswith("array<") != expect.startswith("array<"): - mismatched.append((mname, call, expect, declared)) - elif "?" in got: - untyped.append((mname, call, expect, declared)) - else: - renamed.append((mname, call, expect, declared)) + mismatched, renamed, untyped, n, via_helper = [], [], [], 0, 0 + texts = [path.read_text(encoding="utf-8", errors="replace") for path in files] + for mname, body, call, _request_body, helper in request_blocks(texts, cfg): + if call not in want: + continue + declared = block_return(body, cfg) + if declared is None: + continue + n += 1 + via_helper += helper is not None + got, expect = normalise_type(declared, lang), want[call] + if expect in ("object", "none", "unknown", "?"): + continue # the spec itself declares nothing to match + if got == expect or strip_generated_prefix(got) == expect: + continue + # Separate the two failure modes. A list where the API returns an + # envelope throws at deserialization; a type NAMED differently from + # its schema is only cosmetic, and the SDKs rename by convention — + # all four drop the spec's `Model` and `Api` affixes. Ranking those + # equally buried the one real finding under eleven harmless ones. + # A wholly untyped return (`JsonElement`, `unknown`, `JSONValue`) + # commits to no shape at all and deserializes anything, so it is a + # coverage warning, never a shape error. + if got == "?": + untyped.append((mname, call, expect, declared)) + # Shape next. `list[dict[str, Any]]` IS a commitment to a list and is + # also untyped; testing untyped-ness first classified seclai-python's + # list_evaluation_criteria as a soft warning and reported the repo + # clean, when it is exactly as broken as the Go and JS ones. + elif got.startswith("array<") != expect.startswith("array<"): + mismatched.append((mname, call, expect, declared)) + elif "?" in got: + untyped.append((mname, call, expect, declared)) + else: + renamed.append((mname, call, expect, declared)) print(f"{repo.name} [{lang}] — {n} method(s) with both a declared return type " f"and a named response schema") + if via_helper: + print(via_helper_line(via_helper)) if mismatched: print(f"\nSHAPE MISMATCH ({len(mismatched)}) — list vs object; this fails at deserialization:") diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c441d4..3ea098c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## [1.8.0] - 2026-10-21 + +### Changed + +- Sync the bundled OpenAPI spec, adding 6 paths and 10 schemas. The typed models gain the new fields, including `accepted_attachments` on agent create and definition requests and on the attachment-reference contract, `trigger_id` on an agent, `include_reasoning` on a streaming run, `run_on_attachment_mismatch` on an email trigger, the `cloud_drive_*`, `document_images`, `email_allowed_senders`, `feed_attachments` and `email_address` source fields, `held_for_review` on a content status, `skipped_attachments` on a content item, `error` on `NonManualEvaluationSummaryResponse` and `NonManualEvaluationModeStatResponse`, and `status` on `TestDraftEvaluationResponse` +- Move `LATEST_API_VERSION` to `2026-10-21`. A client built with `api_version=LATEST_API_VERSION` also opts into `2026-10-05` to `2026-10-21`: a content item held for review reports `content_status` `completed` rather than `failed` (read `held_for_review` instead), `create_source()` and `update_source()` refuse an unknown `media_types` kind, or any on a source other than a website or RSS feed, with a 400, `create_source()` refuses `polling_max_items` on a source other than an RSS feed with a 400, `upload_agent_input()` accepts any file type, `ready` at once, `get_non_manual_evaluation_summary()` leaves results whose evaluator returned no verdict out of `failed` and the pass and failure rates (read `error` instead), `get_evaluation_criteria_summary()` averages `average_score` over passed and failed results only, and `test_draft_evaluation()` returns `score` and `passed` as `None` for an `error` result instead of 0.5 and `False` +- Make `input` and `metadata` optional keys of `AgentRunStreamRequest`, and let `metadata` be `None`, as the API schema does. A run on an uploaded file no longer needs `"input": None, "metadata": {}` as filler to satisfy a type checker + +### Added + +- Add `list_content_attachments()`, `get_content_attachment()`, `list_content_attachment_embeddings()` and `download_content_attachment()` to read the files attached to a content item, with their indexing status. The first three return the generated `ContentAttachmentsListResponse`, `ContentAttachmentDetailResponse` and `ContentEmbeddingsListResponse` models; the download returns a streaming `httpx.Response` the caller closes. `get_content_attachment()` sends `start` and `end` only when given, including `end=0` +- Add `set_accepted_attachments()` to declare the input attachments an agent trigger accepts, returning `AcceptedAttachmentsResponse` +- Add `list_email_source_rejections()` to list the mail an email content source refused, and why, returning `EmailSourceRejectionListResponse` +- Add `include_reasoning`, `input_upload_id`, `input_upload_ids` and `replay_of_run_id` as optional keys of `AgentRunStreamRequest`. `include_reasoning` asks `run_streaming_agent()` for `stream_reasoning` events; `run_streaming_agent_and_wait()`, which keeps only the `init` and `done` events, removes it from the body before sending +- Add `ApiVersion` members for `2026-10-05`, `2026-10-13`, `2026-10-16`, `2026-10-18`, `2026-10-19` and `2026-10-21`, so each can be selected without `allow_unknown_api_version` + +### Fixed + +- Make the generated `InsufficientCreditsResponse` read the 402 body the API sends, `{"error": {"code", "message", "account_id"}}`. It expected `{"detail": {"error": ...}}`, so `from_dict` raised `KeyError` on a real body. `run_agent()` was unaffected: it raises `SeclaiAPIStatusError` before the model is read +- Release the connection and raise `SeclaiAPIStatusError` from `download_agent_run_attachment()` and `download_source_export()` when reading an error response's body fails. The connection leaked, and the caller got the transport error instead of the status. The status error has no response text and keeps the transport error as its `__cause__` +- Raise `SeclaiAPIStatusError` from `run_streaming_agent()` and `run_streaming_agent_and_wait()` when reading an error response's body fails, with the transport error as its `__cause__`. The caller got the transport error, or `SeclaiError` for a read timeout, instead of the status +- Correct the streaming-download examples of `download_agent_run_attachment()` and `download_source_export()`. They closed the response with `with response:`, which raises `TypeError` because an `httpx.Response` is not a context manager; they now close it in a `finally` block + ## [1.7.2] - 2026-10-05 ### Fixed @@ -217,6 +240,7 @@ _Stable release. Packaging, CI, and documentation deployment only; no API change _Initial release._ +[1.8.0]: https://github.com/seclai/seclai-python/releases/tag/1.8.0 [1.7.2]: https://github.com/seclai/seclai-python/releases/tag/1.7.2 [1.7.1]: https://github.com/seclai/seclai-python/releases/tag/1.7.1 [1.7.0]: https://github.com/seclai/seclai-python/releases/tag/1.7.0 diff --git a/README.md b/README.md index 1523412..f11953f 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,25 @@ client decodes: | `2026-09-28` | Agent-definition writes use the current file-list grammar: an omitted `attachments` keeps the stored list and `[]` means no files | | `2026-09-30` | A run's and a step's `output`, and a step's `input`, are the text rather than a JSON manifest; files are in `attachments` on every version | | `2026-10-03` | A new LLM step written without `attachments` takes its parent's files, and a new retrieval step's matched media are its files | +| `2026-10-05` | A content item held for review by an Enforce governance policy reports `completed` (with `held_for_review: true`) rather than `failed` | +| `2026-10-13` | `create_source()` and `update_source()` refuse a `media_types` with an unknown kind, or any kind on a source other than a website or RSS feed, with a 400 | +| `2026-10-16` | `upload_agent_input()` accepts a file of any type and it is `ready` at once; each upload reaches steps as a separate file and `input` carries only a heading for it | +| `2026-10-18` | A source's `document_images` defaults to true on a text-only embedder as well | +| `2026-10-19` | `create_source()` refuses `polling_max_items` with a 400 on any source other than an RSS feed | +| `2026-10-21` | An evaluation result whose evaluator returned no verdict (`error`) is left out of `failed` and of the pass and failure rates in `get_non_manual_evaluation_summary()`; `get_evaluation_criteria_summary()`'s `average_score` averages only passed and failed results; `test_draft_evaluation()` returns `score` and `passed` as `None` for an `error` result instead of 0.5 and `False` | + +Moving to a later version can still change a value your code branches on, or +reject a request that used to work. From `2026-10-05`, a content item held for +review reports `content_status` `completed` rather than `failed`, so code that +reads `failed` from `get_source_content_status()` or `list_source_contents()` to +find held items stops seeing them: check `held_for_review` instead. (The +`status` filter already matched held items under `completed` on every version.) +`2026-10-13` and `2026-10-19` turn source bodies that were accepted before into +400s. From `2026-10-21`, code that reads `passed` from `test_draft_evaluation()` +as a bool, or does arithmetic on its `score`, gets `None` when `status` is +`error`, and `get_non_manual_evaluation_summary()`'s `failed` no longer counts +those results: read its `error` count. Passing +`api_version=LATEST_API_VERSION` opts into all of these at once. ## Resources @@ -339,6 +358,15 @@ for event_type, data in client.run_streaming_agent( print(event_type, data) ``` +Set `include_reasoning=True` in the request to also receive `stream_reasoning` +events with the model's reasoning, for a `streaming_result` step whose author +enabled `show_reasoning`. `run_streaming_agent_and_wait()` keeps only the +`init` and `done` events, so it removes `include_reasoning` from the body +before sending. + +Every key of `AgentRunStreamRequest` is optional, so a run on an uploaded file +can send just `AgentRunStreamRequest(input_upload_id=upload["upload_id"])`. + Async: ```python @@ -369,9 +397,24 @@ result = client.run_agent_and_poll( # Discover which files (if any) the agent expects before staging uploads refs = client.get_agent_attachment_references("agent_id") # refs["requires_uploads"] -> bool; refs["agent"] lists the exact_names / -# indexes_max / patterns a run-time upload batch must satisfy. +# indexes_max / patterns a run-time upload batch must satisfy, and +# refs["accepted_attachments"] the attachments the trigger declares. + +# Declare the attachments a trigger accepts; steps reference each one as +# {{agent.attachments.}}. None accepts any files as one attachment, "files". +client.set_accepted_attachments( + "agent_id", + "trigger_id", + [ + {"name": "invoice", "content_types": ["application/pdf"], "min": 1, "max": 1}, + {"name": "photos", "content_types": ["image/*"], "name_pattern": "*.jpg"}, + ], +) +# Only a dynamic_input agent takes uploads; any other agent answers 400. upload = client.upload_agent_input("agent_id", file=b"data", file_name="input.pdf") +# From api_version 2026-10-16 an upload of any type is ready at once. Before +# that, only listed types are accepted: poll until status is "ready". status = client.get_agent_input_upload_status("agent_id", upload["upload_id"]) ``` @@ -381,9 +424,11 @@ status = client.get_agent_input_upload_status("agent_id", upload["upload_id"]) # Download a file emitted by a step in an agent run. attachment_id is the # URL-safe-base64 storage_key surfaced in run output manifests / webhooks. response = client.download_agent_run_attachment("run_id", "attachment_id") # raw httpx.Response -with response: +try: for chunk in response.iter_bytes(): ... # write to disk +finally: + response.close() ``` ### Agent AI assistant @@ -410,8 +455,9 @@ detail = client.get_evaluation_criteria("criteria_id") client.update_evaluation_criteria("criteria_id", {"name": "updated"}) client.delete_evaluation_criteria("criteria_id") -# Test a draft -client.test_draft_evaluation("agent_id", {"criteria": {}, "run_id": "run_id"}) +# Test a draft. "status" is "error" when the evaluator returned no verdict; +# from api_version 2026-10-21 its "score" and "passed" are then None. +draft = client.test_draft_evaluation("agent_id", {"criteria": {}, "run_id": "run_id"}) # Results & summaries results = client.list_evaluation_results("criteria_id") @@ -485,6 +531,16 @@ batch = client.list_source_contents( one = client.get_source_content_status("source_id", "cv_1") ``` +Mail an email source refused, newest first — who sent it and why, never the +message itself. Requires an account owner or administrator: + +```python +refused = client.list_email_source_rejections("source_id", page=1, limit=20) +for r in refused.data: # EmailSourceRejectionListResponse + sender = r.from_address if isinstance(r.from_address, str) else None + print(sender, r.reason, r.authenticated) +``` + ### Cloud drives ```python @@ -568,6 +624,30 @@ client.cancel_source_embedding_migration("source_id") detail = client.get_content_detail("source_connection_content_version") embeddings = client.list_content_embeddings("source_connection_content_version") client.delete_content("source_connection_content_version") + +# Files attached to a content item: email attachments, feed files, page media +# and the images inside documents, each with its indexing status. These return +# the generated models (ContentAttachmentsListResponse and so on). +attachments = client.list_content_attachments("source_connection_content_version") +for item in attachments.data: + print(item.key, item.content_type, item.indexing_status) +att = attachments.data[0] +att_detail = client.get_content_attachment( + "source_connection_content_version", att.id +) +print(att_detail.text_content) # None for a file that was not indexed +att_embeddings = client.list_content_attachment_embeddings( + "source_connection_content_version", att.id +) +response = client.download_content_attachment( + "source_connection_content_version", att.id +) # raw streaming httpx.Response; 403 if withheld, 402 with no credits left +try: + with open(f"{att.id}.bin", "wb") as f: + for chunk in response.iter_bytes(): + f.write(chunk) +finally: + response.close() ``` ### Solutions @@ -648,6 +728,7 @@ config = client.set_email_trigger_config( "ignore_auto_generated": True, # drop auto-replies to prevent loops "require_sender_auth": True, # require SPF or DMARC "queue_on_quota": False, # park over-rate mail instead of failing + "run_on_attachment_mismatch": False, # True runs even if attachments don't fit }, ) print(config["email_addresses"]) diff --git a/openapi/seclai.openapi.json b/openapi/seclai.openapi.json index 058d09e..0ca4052 100644 --- a/openapi/seclai.openapi.json +++ b/openapi/seclai.openapi.json @@ -23,6 +23,99 @@ } }, "schemas": { + "AcceptedAttachmentSlot": { + "additionalProperties": false, + "properties": { + "content_types": { + "description": "Accepted types, e.g. ``application/pdf`` or ``image/*``; empty accepts any type.", + "items": { + "type": "string" + }, + "title": "Content Types", + "type": "array" + }, + "label": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Shown to people.", + "title": "Label" + }, + "max": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Most files a run may include; empty is no limit.", + "title": "Max" + }, + "min": { + "default": 0, + "description": "Fewest files a run must include; fewer refuses the run, except on an email trigger set to run anyway, which lists the shortfall.", + "title": "Min", + "type": "integer" + }, + "name": { + "description": "Lowercase letters, digits and underscores, starting with a letter. Steps reference the files as ``{{agent.attachments.}}``.", + "title": "Name", + "type": "string" + }, + "name_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Filename glob a file must also match, ignoring case.", + "title": "Name Pattern" + } + }, + "required": [ + "name" + ], + "title": "AcceptedAttachmentSlot", + "type": "object" + }, + "AcceptedAttachmentsResponse": { + "properties": { + "accepted_attachments": { + "items": { + "$ref": "#/components/schemas/AcceptedAttachmentSlot" + }, + "title": "Accepted Attachments", + "type": "array" + }, + "agent_id": { + "format": "uuid", + "title": "Agent Id", + "type": "string" + }, + "trigger_id": { + "format": "uuid", + "title": "Trigger Id", + "type": "string" + } + }, + "required": [ + "trigger_id", + "agent_id", + "accepted_attachments" + ], + "title": "AcceptedAttachmentsResponse", + "type": "object" + }, "AddConversationTurnRequest": { "properties": { "actions_taken": { @@ -89,14 +182,22 @@ "type": "object" }, "AgentAttachmentRefsApiResponse": { - "description": "Static attachment-reference contract for an agent.\n\nMirrors the MCP ``get_agent_attachment_references`` tool: returns\nwhat files (if any) an agent's templates expect on a run so API\nconsumers can stage uploads correctly before calling\n``POST /agents/{id}/runs``.", + "description": "The input attachments an agent's trigger declares.\n\nMirrors the MCP ``get_agent_attachment_references`` tool, so API\nconsumers can stage uploads that fit before calling\n``POST /agents/{id}/runs``.", "properties": { + "accepted_attachments": { + "description": "The attachments the agent's trigger declares. A run's files are each assigned to one; a file none accepts, or an attachment with fewer files than its ``min``, rejects the run with HTTP 400. Steps reference one as ``{{agent.attachments.}}``.", + "items": { + "$ref": "#/components/schemas/AcceptedAttachmentSlot" + }, + "title": "Accepted Attachments", + "type": "array" + }, "agent": { "$ref": "#/components/schemas/AttachmentRefsSourceApiSummary", - "description": "Aggregated selector summary across all consumer steps. ``exact_names`` entries must each appear in the upload batch; ``indexes_max+1`` is the minimum file count; every ``patterns`` glob must match at least one upload." + "description": "Aggregated summary of the agent-file references in the steps. Informational: which files a run accepts is ``accepted_attachments``." }, "requires_uploads": { - "description": "When ``false`` the agent's definition does NOT reference any uploaded attachments \u2014 ``POST /agents/{id}/upload-input`` will reject with HTTP 400. When ``true`` the ``agent`` block lists the specific selectors a run-time batch must satisfy.", + "description": "When ``false`` the agent takes no files through the API \u2014 it has no ``dynamic_input`` trigger, or that trigger declares no attachments \u2014 and ``POST /agents/{id}/upload-input`` will reject with HTTP 400. When ``true`` ``accepted_attachments`` lists what a run's files must fit.", "title": "Requires Uploads", "type": "boolean" } @@ -569,7 +670,7 @@ "type": "null" } ], - "description": "ID of a previously uploaded file (via POST /{agent_id}/upload-input) to use as the run input for dynamic-input triggers. Mutually exclusive with ``input_upload_ids`` \u2014 use that field to attach multiple files. May be combined with ``input``: the prompt text leads and the file's extracted text follows under a ``# {filename}`` heading.\n\n**Attachment visibility:** a step only sees the upload when its template references the input \u2014 via ``{{input}}`` / ``{{agent.input}}`` / ``{{step..input|output}}`` (implicit, all attachments) or the ``{{attachments[\u2026]}}`` family (explicit narrowing \u2014 e.g. ``{{attachments[0]}}``, ``{{attachments[*.pdf]}}``).\n\n**Per-batch validation:** every selector the agent's definition declares must be satisfied or the run is rejected with HTTP 400. Exact-name selectors require that filename to be present; indexed selectors require at least N+1 files; glob patterns require at least one matching filename.", + "description": "ID of a previously uploaded file (via POST /{agent_id}/upload-input) to use as the run input for dynamic-input triggers. Mutually exclusive with ``input_upload_ids`` \u2014 use that field to attach multiple files. May be combined with ``input``: the prompt text leads and the file follows under a ``# {filename}`` heading (before ``Seclai-Version: 2026-10-16``, followed by its extracted text).\n\n**Which steps receive it:** a step that sends or stores files takes the files its ``attachments`` field selects. An LLM step (``prompt_call``, ``extract_data``, ``evaluate_step``) takes the files its ``attachments`` field names, or else the files its plain-text templates reference: ``{{agent.attachments.}}`` for one attachment the trigger declares, or ``{{agent.input}}`` for every upload unless a template also names an agent attachment.\n\n**Per-batch validation:** the batch must fit the trigger's ``accepted_attachments`` \u2014 every file fits one declared attachment and each attachment gets at least its ``min`` files \u2014 or the run is rejected with HTTP 400.", "title": "Input Upload Id" }, "input_upload_ids": { @@ -586,7 +687,7 @@ "type": "null" } ], - "description": "IDs of multiple previously uploaded files. Each upload's extracted text is concatenated under a heading; each upload's binary is surfaced as a separate ``MediaAttachment`` so multi-modal prompt steps reason over all files at once. Steps narrow visibility via ``{{attachments[\u2026]}}`` selectors (by index, filename, or fnmatch glob). The batch must satisfy every selector the agent declares \u2014 exact names, indexed references (length must exceed the highest index), and glob patterns (each pattern needs at least one match). Mismatches return HTTP 400 with the unmet requirements listed. Mutually exclusive with ``input_upload_id`` (two spellings of the same batch), but may be combined with ``input`` \u2014 the prompt text leads and the per-file sections follow, so \"a photo plus a sentence about it\" needs no synthetic text upload. Max 20 uploads per run.", + "description": "IDs of multiple previously uploaded files. Each upload gets a heading in ``input`` (before ``Seclai-Version: 2026-10-16``, followed by its extracted text); each upload reaches steps as a separate file (before ``Seclai-Version: 2026-10-16``, a text upload in the open ``files`` attachment is written into ``input`` instead). Steps choose files as described under ``input_upload_id``. The batch must fit the trigger's ``accepted_attachments``; a mismatch returns HTTP 400 listing what does not fit. Mutually exclusive with ``input_upload_id`` (two spellings of the same batch), but may be combined with ``input`` \u2014 the prompt text leads and the per-file sections follow, so \"a photo plus a sentence about it\" needs no synthetic text upload. Max 20 uploads per run.", "title": "Input Upload Ids" }, "metadata": { @@ -620,7 +721,7 @@ "type": "null" } ], - "description": "Re-run this agent reusing a prior run's uploaded input files. The files are re-resolved server-side from the source run (which must belong to this account and agent) \u2014 you do not re-upload them. Combine with ``input`` to change the text while keeping the files. A fresh upload batch (``input_upload_id(s)``) takes precedence and disables replay. Binaries swept by retention fall back to their extracted text.", + "description": "Re-run this agent reusing a prior run's uploaded input files. The files are re-resolved server-side from the source run (which must belong to this account and agent) \u2014 you do not re-upload them. Combine with ``input`` to change the text while keeping the files. A fresh upload batch (``input_upload_id(s)``) takes precedence and disables replay. Binaries swept by retention fall back to their extracted text. Files the trigger's ``accepted_attachments`` no longer accepts are left out.", "title": "Replay Of Run Id" } }, @@ -747,7 +848,7 @@ "type": "null" } ], - "description": "The run's output text; its files are in `attachments`. Below `Seclai-Version: 2026-09-30` an output that has files is instead the manifest JSON `{schema, text, attachments: [{storage_key, mime, name, label, bytes}]}`; `bytes` is absent on runs made before that version shipped.", + "description": "The run's output text; its files are in `attachments`. Below `Seclai-Version: 2026-09-30` an output that has files is instead the manifest JSON `{schema, text, attachments: [{storage_key, mime, name, label, bytes}]}`; `bytes` can be `null` on runs made before that version shipped.", "title": "Output" }, "output_content_type": { @@ -813,7 +914,7 @@ "type": "null" } ], - "description": "When this run's trace content was deleted under the account's agent-trace retention window. Non-null means `input`, `output` and every step's and tool call's I/O are null **by design** and will never be available again \u2014 the run aged out, it did not fail. Branch on this rather than on a null `output`: a run that genuinely produced nothing looks identical. Status, timing and credits remain accurate.", + "description": "When this run's trace content was deleted under the account's agent-trace retention window. Non-null means `input`, `output` and every step's and tool call's I/O are null **by design** and will never be available again \u2014 the run aged out, it did not fail. A tool call's `error` may be null as well, so a failed tool call can report its status without a message. Branch on this rather than on a null `output`: a run that genuinely produced nothing looks identical. Status, timing and credits remain accurate.", "title": "Trace Purged At" }, "wait_ms": { @@ -963,7 +1064,7 @@ "type": "null" } ], - "description": "Authoring problems the step ran into, whether or not it then failed, such as a file name selector that matched none of its source's files.", + "description": "Problems the step ran into, whether or not it then failed, such as a file name selector that matched none of its source's files, or a model that returned no answer.", "title": "Warnings" } }, @@ -984,6 +1085,12 @@ }, "AgentRunStreamRequest": { "properties": { + "include_reasoning": { + "default": false, + "description": "Receive `stream_reasoning` events carrying the model's reasoning while it thinks. They are sent only for a `streaming_result` step whose author enabled `show_reasoning`, and never when a governance policy redacts that step.", + "title": "Include Reasoning", + "type": "boolean" + }, "input": { "anyOf": [ { @@ -1006,7 +1113,7 @@ "type": "null" } ], - "description": "ID of a previously uploaded file (via POST /{agent_id}/upload-input) to use as the run input for dynamic-input triggers. Mutually exclusive with ``input_upload_ids`` \u2014 use that field to attach multiple files. May be combined with ``input``. Subject to the same per-batch attachment-selector validation as the non-streaming endpoint.", + "description": "ID of a previously uploaded file (via POST /{agent_id}/upload-input) to use as the run input for dynamic-input triggers. Mutually exclusive with ``input_upload_ids`` \u2014 use that field to attach multiple files. May be combined with ``input``. Must fit the trigger's ``accepted_attachments``, as on the non-streaming endpoint.", "title": "Input Upload Id" }, "input_upload_ids": { @@ -1023,7 +1130,7 @@ "type": "null" } ], - "description": "IDs of multiple previously uploaded files. See the non-streaming endpoint for full semantics, including per-batch selector validation (exact names, indexed references, and glob patterns must all be satisfied or the run is rejected with HTTP 400) and combining the batch with ``input`` prompt text. Max 20.", + "description": "IDs of multiple previously uploaded files. See the non-streaming endpoint for full semantics, including fitting the trigger's ``accepted_attachments`` (else HTTP 400) and combining the batch with ``input`` prompt text. Max 20.", "title": "Input Upload Ids" }, "metadata": { @@ -1051,7 +1158,7 @@ "type": "null" } ], - "description": "Re-run reusing a prior run's uploaded input files (re-resolved server-side from the source run, which must belong to this account and agent). A fresh upload batch takes precedence.", + "description": "Re-run reusing a prior run's uploaded input files (re-resolved server-side from the source run, which must belong to this account and agent). A fresh upload batch takes precedence. Files the trigger's ``accepted_attachments`` no longer accepts are left out.", "title": "Replay Of Run Id" } }, @@ -1319,6 +1426,18 @@ "description": "Sampling configuration for sample_and_flag mode.", "title": "Sampling Config" }, + "trigger_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "ID of the agent's trigger, for the `/agents/{agent_id}/triggers/{trigger_id}/\u2026` endpoints such as `accepted-attachments` and `email-config`.", + "title": "Trigger Id" + }, "trigger_type": { "anyOf": [ { @@ -2910,6 +3029,90 @@ "title": "CompatibleRunResponse", "type": "object" }, + "ContentAttachmentResponse": { + "description": "A file attached to a content item.", + "properties": { + "content_type": { + "description": "MIME type of the attached file.", + "title": "Content Type", + "type": "string" + }, + "created_at": { + "description": "When the file was first attached.", + "title": "Created At", + "type": "string" + }, + "id": { + "description": "The attachment's id, which the single-attachment endpoints take.", + "title": "Id", + "type": "string" + }, + "indexed": { + "description": "Whether indexing the file for search was asked for.", + "title": "Indexed", + "type": "boolean" + }, + "indexing_error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Why the file was not indexed, when `indexing_status` is `failed`.", + "title": "Indexing Error" + }, + "indexing_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "`pending`, `completed` or `failed`; null when indexing was not asked for. Search finds the file only when `completed`.", + "title": "Indexing Status" + }, + "key": { + "description": "The attachment's key, unique within the item.", + "title": "Key", + "type": "string" + }, + "metadata": { + "additionalProperties": true, + "description": "What is known about the file beyond its bytes. An image extracted from a PDF carries its `page_number`, and `page_render: true` when it is a render of the whole page. An image or video from a web page carries `source_url` (the address it was fetched from), `position` (its place among the media the page listed, from 0) and, when the page gave one, `alt_text`. Empty for most files. A retrieval metadata filter matches these keys, except `alt_text`, which is indexed as the attachment's text.", + "title": "Metadata", + "type": "object" + }, + "size_bytes": { + "description": "Size of the attached file in bytes.", + "title": "Size Bytes", + "type": "integer" + }, + "updated_at": { + "description": "When the attachment last changed.", + "title": "Updated At", + "type": "string" + } + }, + "required": [ + "id", + "key", + "content_type", + "size_bytes", + "indexed", + "indexing_status", + "indexing_error", + "created_at", + "updated_at", + "metadata" + ], + "title": "ContentAttachmentResponse", + "type": "object" + }, "ContentEmbeddingResponse": { "description": "Response model for content embedding.", "properties": { @@ -3560,6 +3763,66 @@ "description": "Chunk size for content processing.", "title": "Chunk Size" }, + "cloud_drive_connection_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Required for a cloud_drive source, and ignored on any other: the id of a connected drive, from GET /cloud-drives.", + "title": "Cloud Drive Connection Id" + }, + "cloud_drive_content_types": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: comma-separated MIME types a file must have to be indexed. Omit for no filter.", + "title": "Cloud Drive Content Types" + }, + "cloud_drive_folder_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the folder to index, as a path inside the drive. Omit to index the connected drive's own folder.", + "title": "Cloud Drive Folder Path" + }, + "cloud_drive_max_file_mb": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: files larger than this many megabytes are skipped. Omit for no limit of the source's own.", + "title": "Cloud Drive Max File Mb" + }, + "cloud_drive_path_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: a glob a file's path must match to be indexed, such as `**/*.pdf` or `/reports/*`. Omit for no filter.", + "title": "Cloud Drive Path Pattern" + }, "content_filter": { "anyOf": [ { @@ -3585,6 +3848,33 @@ "description": "Embedding dimensions override.", "title": "Dimensions" }, + "document_images": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "Whether the images inside PDF, DOCX, PPTX and XLSX files are attached to the item and indexed; on a text-only embedder, by the text in each image. Applies to documents added after it changes. Defaults to true; below Seclai-Version 2026-10-18 it defaults to false on a text-only embedder. On a website or RSS source it is ignored: `media_types` decides.", + "title": "Document Images" + }, + "email_allowed_senders": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Required for an email source, and only valid there: the senders whose mail is stored. Each entry is a full address (news@example.com) or a bare domain (example.com), which also matches its sub-domains. Matched against the message's From address, which must pass DMARC.", + "title": "Email Allowed Senders" + }, "embedding_model": { "anyOf": [ { @@ -3597,6 +3887,21 @@ "description": "Embedding model override \u2014 a `model_type` from `GET /models/embedders`, which also reports each embedder's `supported_input_media`. Defaults to the platform embedder (`default_model_type` on that endpoint) when omitted. Indexing images or video requires an embedder that lists that modality.", "title": "Embedding Model" }, + "feed_attachments": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Kinds of file listed beside a feed item's content to attach to the item and index, on an RSS source. Subset of ['enclosures', 'item_image', 'media_rss']; any other value is refused. None are attached unless chosen.", + "title": "Feed Attachments" + }, "index_mode": { "anyOf": [ { @@ -3620,7 +3925,7 @@ "type": "null" } ], - "description": "Media kinds to extract from indexed content and embed as multi-modal KB chunks. Subset of ['images', 'video']. Only kinds the source's embedder can index are honored (see `supported_input_media` on GET /models/embedders); unsupported values are dropped. Omit / [] for text-only.", + "description": "Media kinds in a web page's main content to attach to the page's item and index, on a website or RSS source. Subset of ['images', 'video']. From `Seclai-Version: 2026-10-13` any other value, and any kind on another source type, is refused with a 400; older versions drop an unknown value and store the rest. A kind the source's embedder cannot index is stored and not indexed (see `supported_input_media` on GET /models/embedders). 'images' also covers the images inside PDF, DOCX, PPTX and XLSX files. Applies to pages and documents added after it is set.", "title": "Media Types" }, "name": { @@ -3664,7 +3969,7 @@ "type": "null" } ], - "description": "Max items per poll.", + "description": "The most new feed items a scheduled poll takes. Read for RSS feeds only: from Seclai-Version 2026-10-19 any other source type rejects it with 400. Earlier versions store it there. An email source rejects it at every version.", "title": "Polling Max Items" }, "retention": { @@ -3681,7 +3986,7 @@ "title": "Retention" }, "source_type": { - "description": "Source type: rss, website, or custom_index. The legacy value 'file_uploads' is accepted as an alias for custom_index.", + "description": "Source type: rss_feed, website, custom_index, cloud_drive or email. The legacy value 'file_uploads' is accepted as an alias for custom_index.", "title": "Source Type", "type": "string" }, @@ -4161,42 +4466,141 @@ "title": "EmailDomainsListResponse", "type": "object" }, - "EmailTriggerConfigResponse": { - "description": "An EMAIL_RECEIVED trigger's resolved address(es) and config.", + "EmailSourceRejectionListResponse": { + "description": "A page of mail an email content source refused.", "properties": { - "agent_id": { - "format": "uuid", - "title": "Agent Id", - "type": "string" - }, - "email_addresses": { + "data": { "items": { - "type": "string" + "$ref": "#/components/schemas/EmailSourceRejectionResponse" }, - "title": "Email Addresses", + "title": "Data", "type": "array" }, - "email_alias": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Email Alias" - }, - "email_allowed_senders": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "null" + "pagination": { + "$ref": "#/components/schemas/PaginationResponse" + } + }, + "required": [ + "data", + "pagination" + ], + "title": "EmailSourceRejectionListResponse", + "type": "object" + }, + "EmailSourceRejectionResponse": { + "description": "Mail an email content source refused: who sent it and why, never what\nit said.", + "properties": { + "auth_verdicts": { + "additionalProperties": { + "type": "string" + }, + "description": "The SPF, DKIM and DMARC verdicts reported for the message.", + "title": "Auth Verdicts", + "type": "object" + }, + "authenticated": { + "description": "Whether the message passed DMARC, which is what authenticates its From address. Adding an unauthenticated sender to the allowed senders does not let its mail in.", + "title": "Authenticated", + "type": "boolean" + }, + "created_at": { + "description": "When the mail was refused.", + "title": "Created At", + "type": "string" + }, + "from_address": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The address in the message's From line, which the source's allowed senders are matched against. Null when no single From address could be read from the message unambiguously.", + "title": "From Address" + }, + "id": { + "description": "Unique identifier of the refusal.", + "title": "Id", + "type": "string" + }, + "reason": { + "description": "Why it was refused: sender_not_allowed, unauthenticated_sender, unreadable_from, sender_blocked, spam, virus, unsafe_content, rate_limited, account_not_chargeable or empty_message; or, for a message the source received before, what became of the earlier one: repeat_stored, repeat_held, repeat_deleted or repeat_in_progress.", + "title": "Reason", + "type": "string" + }, + "recipient": { + "description": "The source address it was sent to.", + "title": "Recipient", + "type": "string" + }, + "sender": { + "description": "The envelope sender. For bulk mail this is the delivery provider's bounce address, not the From address.", + "title": "Sender", + "type": "string" + }, + "sender_ip": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "IP address the mail came from.", + "title": "Sender Ip" + } + }, + "required": [ + "id", + "created_at", + "recipient", + "sender", + "sender_ip", + "reason", + "authenticated" + ], + "title": "EmailSourceRejectionResponse", + "type": "object" + }, + "EmailTriggerConfigResponse": { + "description": "An EMAIL_RECEIVED trigger's resolved address(es) and config.", + "properties": { + "agent_id": { + "format": "uuid", + "title": "Agent Id", + "type": "string" + }, + "email_addresses": { + "items": { + "type": "string" + }, + "title": "Email Addresses", + "type": "array" + }, + "email_alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Email Alias" + }, + "email_allowed_senders": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" } ], "title": "Email Allowed Senders" @@ -4216,6 +4620,11 @@ "title": "Email Require Sender Auth", "type": "boolean" }, + "email_run_on_attachment_mismatch": { + "default": false, + "title": "Email Run On Attachment Mismatch", + "type": "boolean" + }, "trigger_id": { "format": "uuid", "title": "Trigger Id", @@ -4779,7 +5188,7 @@ "type": "null" } ], - "description": "Mean score across all evaluated results, or null if none.", + "description": "Mean score of the final passed and failed results, or null if none. On /api before Seclai-Version 2026-10-21 it averages every final result's stored score, `error` included.", "title": "Average Score" }, "error": { @@ -5491,7 +5900,7 @@ "type": "null" } ], - "description": "Suggested agent-level configuration, if any.", + "description": "Suggested agent-level configuration, if any. For an email_received agent it may carry `email_run_on_attachment_mismatch`, which the caller applies through the trigger's email-config endpoint. For a dynamic_input or email_received agent it may carry `accepted_attachments`, which the caller passes with the steps to `PUT /agents/{agent_id}/definition` so both save together.", "title": "Agent Config" }, "conversation_id": { @@ -6123,17 +6532,17 @@ "type": "object" }, "InsufficientCreditsDetail": { - "description": "``detail`` body for a 402 ``insufficient_credits`` response.", + "description": "``error`` body of a 402 ``insufficient_credits`` response.", "properties": { "account_id": { "description": "UUID of the account that ran out of credits.", "title": "Account Id", "type": "string" }, - "error": { + "code": { "const": "insufficient_credits", "description": "Stable machine-readable error code.", - "title": "Error", + "title": "Code", "type": "string" }, "message": { @@ -6143,7 +6552,7 @@ } }, "required": [ - "error", + "code", "message", "account_id" ], @@ -6151,14 +6560,14 @@ "type": "object" }, "InsufficientCreditsResponse": { - "description": "402 envelope returned when the account has exhausted its credits.", + "description": "402 envelope returned when the account has exhausted its credits.\n\nThe wire shape ``http_exception_handler`` and ``insufficient_credits_exception_handler`` send.", "properties": { - "detail": { + "error": { "$ref": "#/components/schemas/InsufficientCreditsDetail" } }, "required": [ - "detail" + "error" ], "title": "InsufficientCreditsResponse", "type": "object" @@ -7405,6 +7814,30 @@ "title": "ServiceUnavailableError", "type": "object" }, + "SetAcceptedAttachmentsRequest": { + "properties": { + "accepted_attachments": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/AcceptedAttachmentSlot" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The input attachments the trigger accepts; ``null`` accepts any files (one attachment named ``files``). Only ``dynamic_input`` and ``email_received`` triggers take files.", + "title": "Accepted Attachments" + } + }, + "required": [ + "accepted_attachments" + ], + "title": "SetAcceptedAttachmentsRequest", + "type": "object" + }, "SetAutoBlockModeRequest": { "description": "Set the account's governance auto-block mode (shared REST request).", "properties": { @@ -7419,6 +7852,62 @@ "title": "SetAutoBlockModeRequest", "type": "object" }, + "SkippedAttachmentReason": { + "enum": [ + "displayed_in_body", + "over_cap", + "no_filename", + "undecodable" + ], + "title": "SkippedAttachmentReason", + "type": "string" + }, + "SkippedAttachmentResponse": { + "description": "A part of an email that was not stored as an attachment.", + "properties": { + "content_type": { + "description": "The part's declared media type.", + "title": "Content Type", + "type": "string" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The file name the part is listed under; null when it had none.", + "title": "Filename" + }, + "reason": { + "$ref": "#/components/schemas/SkippedAttachmentReason", + "description": "Why the part was not stored." + }, + "size_bytes": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Decoded size in bytes.", + "title": "Size Bytes" + } + }, + "required": [ + "filename", + "content_type", + "size_bytes", + "reason" + ], + "title": "SkippedAttachmentResponse", + "type": "object" + }, "SolutionSourceConnectionResponse": { "properties": { "id": { @@ -7642,7 +8131,7 @@ }, "extracted_media_capped": { "default": false, - "description": "True when extraction stopped with media still unread, so the item references more media than was indexed and media search will not match anything past the cut. Two causes: a web page that ran out of the budget for fetching remote assets, or a container that could not be read to the end (a truncated or hostile archive). An uploaded document that reads cleanly is never capped, however much media it holds \u2014 there is no limit on that.", + "description": "True when extraction stopped with media still unread, so the item references more media than was attached and media search will not match anything past the cut. The cause is a web page that ran out of the budget for fetching remote assets or listed more media than is recorded, or a web page or document that could not be read to the end.", "title": "Extracted Media Capped", "type": "boolean" }, @@ -7655,7 +8144,7 @@ "type": "null" } ], - "description": "Number of embedded images / videos extracted from inside this item and indexed as their own chunks. There is no limit on this \u2014 a document contributes as many as it holds. Null when there is no media record for the item: the extraction pass has not run, does not apply to this container, or found nothing. Treat null as 'unknown', never as zero.", + "description": "Number of images / videos in this web page's main content, or of images inside this PDF or Office document, that were attached to the item on this source; a file over the per-file size limit, listed as a failed attachment, is not counted. Null when there is no media record for the item: the extraction pass has not run, does not apply to this container or this source's settings, or found nothing. Treat null as 'unknown', never as zero.", "title": "Extracted Media Count" }, "extracted_media_limit": { @@ -7667,9 +8156,15 @@ "type": "null" } ], - "description": "The bound that was reached, when extracted_media_capped is true and the stop was a bound \u2014 a number of fetch attempts, or a number of seconds. Null when extraction was not capped, or when it stopped because the container could not be read rather than because a bound fired.", + "description": "The bound that was reached, when extracted_media_capped is true and the stop was a bound \u2014 a number of fetch attempts, of seconds, of bytes, or of media listed. Null when extraction was not capped, or when it stopped because the container could not be read rather than because a bound fired.", "title": "Extracted Media Limit" }, + "held_for_review": { + "default": false, + "description": "An ENFORCE governance policy blocked this item at import. It is held for review and is not retrievable: resolving its blocking evaluations releases it into the source, and it is purged when the hold window ends.", + "title": "Held For Review", + "type": "boolean" + }, "indexed_at": { "anyOf": [ { @@ -8002,6 +8497,66 @@ "description": "Chunk size for content processing.", "title": "Chunk Size" }, + "cloud_drive_connection_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the id of the connected drive it indexes. Null for every other source type.", + "title": "Cloud Drive Connection Id" + }, + "cloud_drive_content_types": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the comma-separated MIME types a file must have to be indexed. Null when there is no filter.", + "title": "Cloud Drive Content Types" + }, + "cloud_drive_folder_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the folder it indexes. Null when it indexes the connected drive's own folder.", + "title": "Cloud Drive Folder Path" + }, + "cloud_drive_max_file_mb": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the size in megabytes above which a file is skipped. Null when the source sets no limit of its own.", + "title": "Cloud Drive Max File Mb" + }, + "cloud_drive_path_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the glob a file's path must match to be indexed. Null when there is none.", + "title": "Cloud Drive Path Pattern" + }, "content_count": { "default": 0, "description": "Number of content items associated with the source connection.", @@ -8030,6 +8585,39 @@ "description": "Dimensions of the embedding model.", "title": "Dimensions" }, + "document_images": { + "default": true, + "description": "Whether the images inside PDF, DOCX, PPTX and XLSX files are attached to the item and indexed; on a source that follows no web pages and has a text-only embedder, by the text in each image. Applies to documents added after it changes. On a website or RSS source it reports whether `media_types` holds 'images', and the images are attached only when the source's embedder indexes images.", + "title": "Document Images", + "type": "boolean" + }, + "email_address": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For an email source: the address to send mail to. Null for every other source type.", + "title": "Email Address" + }, + "email_allowed_senders": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "For an email source: the addresses and domains whose mail is stored. Null for every other source type.", + "title": "Email Allowed Senders" + }, "embedding_model": { "anyOf": [ { @@ -8054,6 +8642,14 @@ "description": "Type of the embedding model.", "title": "Embedding Model Type" }, + "feed_attachments": { + "description": "Kinds of file listed beside a feed item's content that an RSS source attaches to the item and indexes (subset of ['enclosures', 'item_image', 'media_rss']).", + "items": { + "type": "string" + }, + "title": "Feed Attachments", + "type": "array" + }, "free_retention_days": { "anyOf": [ { @@ -8089,7 +8685,7 @@ "description": "Index mode for custom_index sources: fast_and_cheap, balanced, slow_and_thorough, or custom." }, "media_types": { - "description": "Media kinds extracted from indexed content and embedded as multi-modal KB chunks (subset of ['images', 'video']). Empty = text-only.", + "description": "Media kinds in a web page's main content that are attached to the page's item and indexed (subset of ['images', 'video']). On a website or RSS source 'images' also covers the images inside PDF, DOCX, PPTX and XLSX files.", "items": { "type": "string" }, @@ -8146,7 +8742,7 @@ "type": "null" } ], - "description": "Maximum items to poll for the source connection.", + "description": "The most new feed items a scheduled poll takes. Read for RSS feeds only.", "title": "Polling Max Items" }, "pulled_at": { @@ -8549,9 +9145,14 @@ "score": { "title": "Score", "type": "number" + }, + "status": { + "$ref": "#/components/schemas/EvaluationStatus", + "description": "`passed`, `failed`, or `error` when the evaluator returned no verdict." } }, "required": [ + "status", "score", "passed", "explanation" @@ -8593,11 +9194,26 @@ }, "UpdateAgentDefinitionRequest": { "properties": { - "definition": { - "additionalProperties": true, - "description": "The full agent definition (name, description, tags, steps). Steps form a tree workflow. Each step has a `step_type`, `id`, `name`, and type-specific config. Content enrichment steps (write_metadata, write_content_attachment, load_content_attachment, load_content) require content-triggered agents.", - "title": "Definition", - "type": "object" + "accepted_attachments": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/AcceptedAttachmentSlot" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "When given, declared on the main branch's file-taking triggers in the same save, so the steps may read its slots as `{{agent.attachments.}}`; omitted, the triggers keep theirs.", + "title": "Accepted Attachments" + }, + "definition": { + "additionalProperties": true, + "description": "The full agent definition (name, description, tags, steps). Steps form a tree workflow. Each step has a `step_type`, `id`, `name`, and type-specific config. Content enrichment steps (write_metadata, write_content_attachment, load_content_attachment, load_content) require content-triggered agents.", + "title": "Definition", + "type": "object" }, "expected_change_id": { "description": "The change_id from the last GET, for optimistic locking.", @@ -9033,6 +9649,96 @@ "UpdateSourceBody": { "description": "Request body for updating a content source.", "properties": { + "cloud_drive_content_types": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: comma-separated MIME types a file must have to be indexed. Send an empty string to clear it; omit to leave it unchanged.", + "title": "Cloud Drive Content Types" + }, + "cloud_drive_folder_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: the folder to index, as a path inside the drive. Send an empty string to index the connected drive's own folder; omit to leave it unchanged.", + "title": "Cloud Drive Folder Path" + }, + "cloud_drive_max_file_mb": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: files larger than this many megabytes are skipped. Send 0 to clear the source's own limit; omit to leave it unchanged.", + "title": "Cloud Drive Max File Mb" + }, + "cloud_drive_path_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "For a cloud_drive source: a glob a file's path must match to be indexed, such as `**/*.pdf` or `/reports/*`. Send an empty string to clear it; omit to leave it unchanged.", + "title": "Cloud Drive Path Pattern" + }, + "document_images": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "Whether the images inside PDF, DOCX, PPTX and XLSX files are attached to the item and indexed; on a text-only embedder, by the text in each image. Applies to documents added after it changes. Omit the field to leave it unchanged. On a website or RSS source it is ignored: `media_types` decides.", + "title": "Document Images" + }, + "email_allowed_senders": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "For an email source: replaces the allowed senders. Each entry is a full address or a bare domain. The list cannot be emptied. Omit to leave it unchanged.", + "title": "Email Allowed Senders" + }, + "feed_attachments": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Kinds of file listed beside a feed item's content to attach to the item and index, on an RSS source. Subset of ['enclosures', 'item_image', 'media_rss']; any other value is refused. [] attaches none. Applies to items added after it changes. Omit the field to leave it unchanged.", + "title": "Feed Attachments" + }, "media_types": { "anyOf": [ { @@ -9045,7 +9751,7 @@ "type": "null" } ], - "description": "Media kinds to extract from indexed content and embed as multi-modal KB chunks. Subset of ['images', 'video']. Only kinds the source's embedder can index are honored (see `supported_input_media` on GET /models/embedders); unsupported values are dropped. [] disables media extraction (text-only).", + "description": "Media kinds in a web page's main content to attach to the page's item and index, on a website or RSS source. Subset of ['images', 'video']. From `Seclai-Version: 2026-10-13` any other value, and any kind on another source type, is refused with a 400; older versions drop an unknown value and store the rest. A kind the source's embedder cannot index is stored and not indexed (see `supported_input_media` on GET /models/embedders). [] attaches no media from web pages. 'images' also covers the images inside PDF, DOCX, PPTX and XLSX files. Applies to pages and documents added after it changes.", "title": "Media Types" }, "name": { @@ -9582,6 +10288,21 @@ }, "routers__api__agents__CreateAgentRequest": { "properties": { + "accepted_attachments": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/AcceptedAttachmentSlot" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The input attachments the trigger accepts. Omitted, the ``agent_definition`` trigger's declaration is kept when the export carries one and both trigger types take files; otherwise a dynamic_input or email_received trigger accepts any files (one attachment named ``files``), and any other trigger none.", + "title": "Accepted Attachments" + }, "agent_definition": { "anyOf": [ { @@ -9745,6 +10466,18 @@ ], "description": "When true (default for new triggers), the envelope sender must pass SPF or DMARC even on an open inbox (no allowlist); unauthenticated, spoofable mail is rejected. Set false to accept fully unauthenticated mail on an open inbox.", "title": "Require Sender Auth" + }, + "run_on_attachment_mismatch": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When true (default false), an email whose attachments don't fit what the agent expects still runs: files the agent can't take are left out and the problems are listed in the `email_attachment_issues` run metadata. When false, the run fails.", + "title": "Run On Attachment Mismatch" } }, "title": "SetEmailTriggerConfigRequest", @@ -10384,6 +11117,152 @@ "title": "UpdateOrganizationAlertPreferenceRequest", "type": "object" }, + "routers__api__contents__ContentAttachmentDetailResponse": { + "description": "One attached file, with the text indexed from it.", + "properties": { + "content_type": { + "description": "MIME type of the attached file.", + "title": "Content Type", + "type": "string" + }, + "created_at": { + "description": "When the file was first attached.", + "title": "Created At", + "type": "string" + }, + "file_withheld": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Why the file's bytes are not served, or null when they are: `blocked_by_governance_policy`, `redacted_by_governance_policy` (any text below is the redacted text), or `pending_screening`.", + "title": "File Withheld" + }, + "id": { + "description": "The attachment's id, which the single-attachment endpoints take.", + "title": "Id", + "type": "string" + }, + "indexed": { + "description": "Whether indexing the file for search was asked for.", + "title": "Indexed", + "type": "boolean" + }, + "indexing_error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Why the file was not indexed, when `indexing_status` is `failed`.", + "title": "Indexing Error" + }, + "indexing_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "`pending`, `completed` or `failed`; null when indexing was not asked for. Search finds the file only when `completed`.", + "title": "Indexing Status" + }, + "key": { + "description": "The attachment's key, unique within the item.", + "title": "Key", + "type": "string" + }, + "metadata": { + "additionalProperties": true, + "description": "What is known about the file beyond its bytes. An image extracted from a PDF carries its `page_number`, and `page_render: true` when it is a render of the whole page. An image or video from a web page carries `source_url` (the address it was fetched from), `position` (its place among the media the page listed, from 0) and, when the page gave one, `alt_text`. Empty for most files. A retrieval metadata filter matches these keys, except `alt_text`, which is indexed as the attachment's text.", + "title": "Metadata", + "type": "object" + }, + "size_bytes": { + "description": "Size of the attached file in bytes.", + "title": "Size Bytes", + "type": "integer" + }, + "text_content": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The requested range of the text the file is indexed by; null when the file has no completed index or was indexed without text.", + "title": "Text Content" + }, + "text_content_end": { + "title": "Text Content End", + "type": "integer" + }, + "text_content_start": { + "title": "Text Content Start", + "type": "integer" + }, + "text_content_total_length": { + "title": "Text Content Total Length", + "type": "integer" + }, + "updated_at": { + "description": "When the attachment last changed.", + "title": "Updated At", + "type": "string" + } + }, + "required": [ + "id", + "key", + "content_type", + "size_bytes", + "indexed", + "indexing_status", + "indexing_error", + "created_at", + "updated_at", + "metadata", + "file_withheld", + "text_content", + "text_content_start", + "text_content_end", + "text_content_total_length" + ], + "title": "ContentAttachmentDetailResponse", + "type": "object" + }, + "routers__api__contents__ContentAttachmentsListResponse": { + "description": "Response model for a content item's attachments.", + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/ContentAttachmentResponse" + }, + "title": "Data", + "type": "array" + }, + "pagination": { + "$ref": "#/components/schemas/PaginationResponse" + } + }, + "required": [ + "data", + "pagination" + ], + "title": "ContentAttachmentsListResponse", + "type": "object" + }, "routers__api__contents__ContentDetailResponse": { "description": "Response model for content detail.", "properties": { @@ -10469,7 +11348,7 @@ }, "extracted_media_capped": { "default": false, - "description": "True when extraction stopped with media still unread, so the item references more media than was indexed and media search will not match anything past the cut. Two causes: a web page that ran out of the budget for fetching remote assets, or a container that could not be read to the end (a truncated or hostile archive). An uploaded document that reads cleanly is never capped, however much media it holds \u2014 there is no limit on that.", + "description": "True when extraction stopped with media still unread, so the item references more media than was attached and media search will not match anything past the cut. The cause is a web page that ran out of the budget for fetching remote assets or listed more media than is recorded, or a web page or document that could not be read to the end.", "title": "Extracted Media Capped", "type": "boolean" }, @@ -10482,7 +11361,7 @@ "type": "null" } ], - "description": "Number of embedded images / videos extracted from inside this item and indexed as their own chunks. There is no limit on this \u2014 a document contributes as many as it holds. Null when there is no media record for the item: the extraction pass has not run, does not apply to this container, or found nothing. Treat null as 'unknown', never as zero.", + "description": "Number of images / videos in this web page's main content, or of images inside this PDF or Office document, that were attached to the item on this source; a file over the per-file size limit, listed as a failed attachment, is not counted. Null when there is no media record for the item: the extraction pass has not run, does not apply to this container or this source's settings, or found nothing. Treat null as 'unknown', never as zero.", "title": "Extracted Media Count" }, "extracted_media_limit": { @@ -10494,7 +11373,7 @@ "type": "null" } ], - "description": "The bound that was reached, when extracted_media_capped is true and the stop was a bound \u2014 a number of fetch attempts, or a number of seconds. Null when extraction was not capped, or when it stopped because the container could not be read rather than because a bound fired.", + "description": "The bound that was reached, when extracted_media_capped is true and the stop was a bound \u2014 a number of fetch attempts, of seconds, of bytes, or of media listed. Null when extraction was not capped, or when it stopped because the container could not be read rather than because a bound fired.", "title": "Extracted Media Limit" }, "id": { @@ -10537,6 +11416,14 @@ "title": "Pulled At", "type": "string" }, + "skipped_attachments": { + "description": "Parts of an email delivered to an email content source that were not stored as attachments of this item, each with the reason: displayed_in_body (an image the message body shows, such as a signature logo), over_cap (beyond the per-message attachment limit), no_filename, or undecodable. size_bytes is null for a part that was never decoded. Empty for every other item.", + "items": { + "$ref": "#/components/schemas/SkippedAttachmentResponse" + }, + "title": "Skipped Attachments", + "type": "array" + }, "source_connection_content_version_id": { "description": "ID of the source connection content version.", "title": "Source Connection Content Version Id", @@ -12024,7 +12911,7 @@ "type": "null" } ], - "description": "Set when the file is non-text but the source's embedder is text-only \u2014 indexing will rely on OCR / transcription and may produce a FAILED row if no text can be extracted.", + "description": "Set when a file that is not text is indexed from its extracted text alone rather than embedded whole: the item is FAILED if no text can be extracted. Says so when the images inside a document are attached to the item and indexed as well.", "title": "Embedder Warning" }, "filename": { @@ -12568,6 +13455,11 @@ "schemas__v1__agent_evaluations__NonManualEvaluationModeStatResponse": { "description": "Per-mode rollup for evaluation activity.", "properties": { + "error": { + "description": "Results whose evaluator returned no verdict.", + "title": "Error", + "type": "integer" + }, "failed": { "title": "Failed", "type": "integer" @@ -12602,6 +13494,7 @@ "total", "passed", "failed", + "error", "flagged", "pass_rate", "failure_rate" @@ -12619,6 +13512,11 @@ "title": "By Mode", "type": "array" }, + "error": { + "description": "Results whose evaluator returned no verdict.", + "title": "Error", + "type": "integer" + }, "failed": { "title": "Failed", "type": "integer" @@ -12648,6 +13546,7 @@ "total", "passed", "failed", + "error", "flagged", "pass_rate", "failure_rate", @@ -12764,7 +13663,7 @@ ] }, "post": { - "description": "Create a new agent.\n\nTrigger types:\n- `dynamic_input`: triggered via API with user-provided input\n- `template_input`: triggered via API with a predefined template\n- `schedule`: triggered on a schedule\n- `new_content`: triggered when new content arrives\n- `email_received`: a virtual email inbox; runs when mail arrives at the agent's address. Configure the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`.\n\nTemplates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, `content_change_notifier`, `scheduled_report`, `webhook_pipeline`\n\nImporting an existing agent:\n- Pass `agent_definition` with the JSON shape produced by `GET /agents/{id}/export`. The full extras suite (alert_configs, evaluation_criteria, governance_policies, schedules, solutions) is applied; items that don't resolve in this account are reported in the response's `import_warnings` array.\n- Use `POST /agents/preview-import` first to surface `unresolved_refs` (workflow refs to KBs, memory banks, source connections, sub-agents that don't exist here). Then pass `entity_remap: {source_uuid: target_uuid}` on this call to substitute them before save.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. Agent is created in the caller's account.", + "description": "Create a new agent.\n\nTrigger types:\n- `dynamic_input`: triggered via API with user-provided input\n- `template_input`: triggered via API with a predefined template\n- `schedule`: triggered on a schedule\n- `new_content`: triggered when new content arrives\n- `email_received`: a virtual email inbox; runs when mail arrives at the agent's address. Configure the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`, using the `trigger_id` this response returns.\n\nTemplates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, `content_change_notifier`, `scheduled_report`, `webhook_pipeline`\n\nImporting an existing agent:\n- Pass `agent_definition` with the JSON shape produced by `GET /agents/{id}/export`. The full extras suite (alert_configs, evaluation_criteria, governance_policies, schedules, solutions) is applied; items that don't resolve in this account are reported in the response's `import_warnings` array.\n- Use `POST /agents/preview-import` first to surface `unresolved_refs` (workflow refs to KBs, memory banks, source connections, sub-agents that don't exist here). Then pass `entity_remap: {source_uuid: target_uuid}` on this call to substitute them before save.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. Agent is created in the caller's account.", "operationId": "create_agent_api_agents_post", "parameters": [ { @@ -13799,7 +14698,7 @@ }, "/agents/evaluation-criteria/{criteria_id}/summary": { "get": { - "description": "Get an aggregated summary of evaluation results for a criteria.\n\nReturns total, passed, failed, error, and flagged counts alongside the\naverage score, giving a quick overview of how the criteria is performing.", + "description": "Get an aggregated summary of evaluation results for a criteria.\n\nReturns total, passed, failed, error, and flagged counts alongside the\naverage score, giving a quick overview of how the criteria is performing.\nWith ``2026-10-21`` or later, ``average_score`` averages only passed and failed\nresults; earlier versions average every stored score, ``error`` included.", "operationId": "get_evaluation_summary_api_agents_evaluation_criteria__criteria_id__summary_get", "parameters": [ { @@ -13866,7 +14765,7 @@ }, "/agents/evaluation-results/non-manual-summary": { "get": { - "description": "Get an evaluation summary for API key clients.\n\nReturns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, sample_and_flag).\n\nThe ``agent_id`` scoping parameter is part of the ``2026-07-27`` changeset\n(opt in via the ``Seclai-Version`` header). Clients on the legacy baseline\nalways receive the account-wide rollup; ``agent_id`` is ignored for them so\nthe endpoint's behavior is frozen. With ``2026-07-27`` or later, the summary\nis scoped to ``agent_id`` when supplied (and returns 404 if it doesn't exist).", + "description": "Get an evaluation summary for API key clients.\n\nReturns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, sample_and_flag).\n\nWith ``2026-10-21`` or later, ``error`` results (the evaluator returned no\nverdict) are left out of ``failed``, and the rates are over passed and\nfailed results. Earlier versions count them in ``failed`` and rate over\nevery result. ``error`` is returned on every version.\n\nThe ``agent_id`` scoping parameter is part of the ``2026-07-27`` changeset\n(opt in via the ``Seclai-Version`` header). Clients on the legacy baseline\nalways receive the account-wide rollup; ``agent_id`` is ignored for them so\nthe endpoint's behavior is frozen. With ``2026-07-27`` or later, the summary\nis scoped to ``agent_id`` when supplied (and returns 404 if it doesn't exist).", "operationId": "get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get", "parameters": [ { @@ -15065,7 +15964,7 @@ }, "/agents/{agent_id}/attachment-references": { "get": { - "description": "Return the static attachment-reference contract for an agent \u2014 what files the agent's definition expects on a run.\n\nCall this BEFORE staging uploads so you know whether the agent accepts files at all (``requires_uploads``), and which specific filenames/indexes/patterns the templates reference. Mismatched batches are rejected at run time with HTTP 400.", + "description": "Return the input attachments the agent's dynamic_input trigger declares \u2014 the files a run may carry.\n\nCall this BEFORE staging uploads so you know whether the agent accepts files at all (``requires_uploads``), and which attachments its trigger declares (``accepted_attachments``). Batches that do not fit them are rejected at run time with HTTP 400.", "operationId": "api_get_agent_attachment_references_api_agents__agent_id__attachment_references_get", "parameters": [ { @@ -15648,7 +16547,7 @@ }, "/agents/{agent_id}/evaluation-criteria/test-draft": { "post": { - "description": "Run an ephemeral evaluation against provided step output without persisting results.\n\nUse this to interactively test evaluation prompts and expectation\nconfigurations while editing criteria. The evaluation is a billed LLM\ncall; only its result goes unrecorded.", + "description": "Run an ephemeral evaluation against provided step output without persisting results.\n\nUse this to interactively test evaluation prompts and expectation\nconfigurations while editing criteria. The evaluation is a billed LLM\ncall; only its result goes unrecorded.\n\n``status`` is ``error`` when the evaluator returned no verdict. With\n``Seclai-Version: 2026-10-21`` or later, ``score`` and ``passed`` are then\n``null``; earlier versions return ``score`` 0.5 and ``passed`` false.", "operationId": "test_draft_evaluation_api_agents__agent_id__evaluation_criteria_test_draft_post", "parameters": [ { @@ -16308,7 +17207,7 @@ ] }, "post": { - "description": "Start an agent run.\n\nAn *agent* is an automated workflow that can monitor content from your sources, process it with AI, and trigger actions. This endpoint creates a new run and returns a `run_id` you can poll to retrieve status and output.\n\nWhen to use:\n- Use this endpoint for request/response style integrations where polling is acceptable.\n- Use `POST /agents/{agent_id}/runs/stream` if you need real-time progress via SSE.\n\nKey fields:\n- `input`: text input for agents with a `dynamic_input` trigger.\n- `input_upload_id` / `input_upload_ids`: reference one or more files previously uploaded via `POST /agents/{agent_id}/upload-input`. Send them **with** `input` to pair prompt text with the files (the text leads, each file's extracted text follows); only the two upload fields are mutually exclusive with each other.\n- `priority`: set true for latency-sensitive, user-facing work. For agents with a `streaming_result` step, set `priority=true` to enable real-time token streaming; otherwise the run still proceeds, but without live token streaming.\n- `metadata`: a JSON object that becomes available to agent steps for string substitution.\n\nAfter starting:\n- Poll `GET /agents/runs/{run_id}` until `status` is `completed` or `failed`.\n- Use `include_step_outputs=true` to include per-step outputs, timing, and credits.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", + "description": "Start an agent run.\n\nAn *agent* is an automated workflow that can monitor content from your sources, process it with AI, and trigger actions. This endpoint creates a new run and returns a `run_id` you can poll to retrieve status and output.\n\nWhen to use:\n- Use this endpoint for request/response style integrations where polling is acceptable.\n- Use `POST /agents/{agent_id}/runs/stream` if you need real-time progress via SSE.\n\nKey fields:\n- `input`: text input for agents with a `dynamic_input` trigger.\n- `input_upload_id` / `input_upload_ids`: reference one or more files previously uploaded via `POST /agents/{agent_id}/upload-input`. Send them **with** `input` to pair prompt text with the files (the text leads, each file follows under its heading); only the two upload fields are mutually exclusive with each other.\n- `priority`: set true for latency-sensitive, user-facing work. For agents with a `streaming_result` step, set `priority=true` to enable real-time token streaming; otherwise the run still proceeds, but without live token streaming.\n- `metadata`: a JSON object that becomes available to agent steps for string substitution.\n\nAfter starting:\n- Poll `GET /agents/runs/{run_id}` until `status` is `completed` or `failed`.\n- Use `include_step_outputs=true` to include per-step outputs, timing, and credits.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", "operationId": "run_agent_api_agents__agent_id__runs_post", "parameters": [ { @@ -16395,7 +17294,7 @@ }, "/agents/{agent_id}/runs/stream": { "post": { - "description": "Start a **priority** agent run and stream run events using Server-Sent Events (SSE).\n\nThis is the best option for interactive UIs where you want progress updates as the run executes.\n\nHow it works:\n- The first `init` event contains an `AgentRunResponse` snapshot, including the `run_id`.\n- Subsequent events are forwarded from the run event stream (status changes, step events, etc).\n- If the agent contains a `streaming_result` step, `stream_token` events deliver individual LLM tokens (with a `token` field) and a `stream_end` event signals completion.\n- The final `done` event contains the terminal snapshot (including `output` and `credits` when available).\n\nInput options (for `dynamic_input` triggers):\n- `input`: text input passed directly.\n- `input_upload_id` / `input_upload_ids`: reference one or more files uploaded via `POST /agents/{agent_id}/upload-input`. Combine either with `input` to send prompt text alongside the files; only the two upload fields are mutually exclusive with each other.\n\nClient guidance:\n- Keep the connection open and handle keepalive comments.\n- On `timeout` or `error`, the payload includes `run_id` so clients can resume by polling `GET /agents/runs/{run_id}`.\n- `stream_token` events carry the model's raw output. When the agent pairs `streaming_result` with a sibling `extract_content`/`display_result` branch, that branch's `display_result` takes precedence over the stream, so the `done` snapshot's `output` is the validated payload and the tokens are a progress channel \u2014 render tokens live, but read the result from `done`. Check `done.status` first: the streamed text is already the run's output when the stream ends, so a run that FAILED its validation step still carries that raw text in `output`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", + "description": "Start a **priority** agent run and stream run events using Server-Sent Events (SSE).\n\nThis is the best option for interactive UIs where you want progress updates as the run executes.\n\nHow it works:\n- The first `init` event contains an `AgentRunResponse` snapshot, including the `run_id`.\n- Subsequent events are forwarded from the run event stream (status changes, step events, etc).\n- If the agent contains a `streaming_result` step, `stream_token` events deliver individual LLM tokens (with a `token` field) and a `stream_end` event signals completion.\n- With `include_reasoning=true`, `stream_reasoning` events (with a `text` field) carry the model's reasoning while it thinks, when the `streaming_result` step's author enabled `show_reasoning`. Reasoning is never part of `output`.\n- The final `done` event contains the terminal snapshot (including `output` and `credits` when available).\n\nInput options (for `dynamic_input` triggers):\n- `input`: text input passed directly.\n- `input_upload_id` / `input_upload_ids`: reference one or more files uploaded via `POST /agents/{agent_id}/upload-input`. Combine either with `input` to send prompt text alongside the files; only the two upload fields are mutually exclusive with each other.\n\nClient guidance:\n- Keep the connection open and handle keepalive comments.\n- On `timeout` or `error`, the payload includes `run_id` so clients can resume by polling `GET /agents/runs/{run_id}`.\n- `stream_token` events carry the model's raw output. When the agent pairs `streaming_result` with a sibling `extract_content`/`display_result` branch, that branch's `display_result` takes precedence over the stream, so the `done` snapshot's `output` is the validated payload and the tokens are a progress channel \u2014 render tokens live, but read the result from `done`. Check `done.status` first: the streamed text is already the run's output when the stream ends, so a run that FAILED its validation step still carries that raw text in `output`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", "operationId": "run_streaming_agent_api_agents__agent_id__runs_stream_post", "parameters": [ { @@ -16587,10 +17486,10 @@ ] } }, - "/agents/{agent_id}/triggers/{trigger_id}/email-config": { + "/agents/{agent_id}/triggers/{trigger_id}/accepted-attachments": { "put": { - "description": "Set the custom alias, sender allowlist, and inbound-handling flags (`ignore_auto_generated`, `require_sender_auth`, `queue_on_quota`) on an agent's EMAIL_RECEIVED trigger, and return its computed email address(es). Omitted fields are left unchanged.\n\nAuth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account.", - "operationId": "set_email_trigger_config_api_api_agents__agent_id__triggers__trigger_id__email_config_put", + "description": "Replace the input attachments a trigger accepts. A run's files are each assigned to one declared attachment before any step runs; steps reference one as ``{{agent.attachments.}}``. Rejected with HTTP 400 when the agent references an attachment the new declaration leaves out. `trigger_id` is the one `GET /agents/{agent_id}` returns.\n\nAuth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account.", + "operationId": "set_accepted_attachments_api_api_agents__agent_id__triggers__trigger_id__accepted_attachments_put", "parameters": [ { "in": "path", @@ -16621,7 +17520,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/routers__api__agents__SetEmailTriggerConfigRequest" + "$ref": "#/components/schemas/SetAcceptedAttachmentsRequest" } } }, @@ -16632,7 +17531,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EmailTriggerConfigResponse" + "$ref": "#/components/schemas/AcceptedAttachmentsResponse" } } }, @@ -16667,16 +17566,16 @@ } } }, - "summary": "Configure an EMAIL_RECEIVED trigger", + "summary": "Declare the input attachments a trigger accepts", "tags": [ "agents" ] } }, - "/agents/{agent_id}/upload-input": { - "post": { - "description": "Upload a file to use as input for a `dynamic_input` agent run.\n\nSupports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. Text and document files are processed synchronously; audio/video are submitted for asynchronous transcription.\n\n**Size limit:** 200 MB per file.\n\n**Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi.\n\nAfter uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, then pass `input_upload_id` to `POST /agents/{agent_id}/runs`.\n\n**Multi-modal routing:** non-text uploads (image, audio, video, PDF) are surfaced natively to multi-modal-capable prompt steps; text-only models fall back to the OCR / transcript text counterpart. Audio originals are preserved past transcription so audio-capable models (Gemini 2.5/3, GPT-5 audio) read them directly; the agent-input-binary janitor sweeps originals once they pass your account's agent-trace retention (the agent-traces source's retention period; free default 7 days).\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", - "operationId": "api_upload_agent_input_api_agents__agent_id__upload_input_post", + "/agents/{agent_id}/triggers/{trigger_id}/email-config": { + "put": { + "description": "Set the custom alias, sender allowlist, and inbound-handling flags (`ignore_auto_generated`, `require_sender_auth`, `queue_on_quota`, `run_on_attachment_mismatch`) on an agent's EMAIL_RECEIVED trigger, and return its computed email address(es). `trigger_id` is the one `GET /agents/{agent_id}` returns. Omitted fields are left unchanged.\n\nAuth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account.", + "operationId": "set_email_trigger_config_api_api_agents__agent_id__triggers__trigger_id__email_config_put", "parameters": [ { "in": "path", @@ -16687,6 +17586,15 @@ "type": "string" } }, + { + "in": "path", + "name": "trigger_id", + "required": true, + "schema": { + "title": "Trigger Id", + "type": "string" + } + }, { "$ref": "#/components/parameters/X-Account-Id" }, @@ -16694,11 +17602,88 @@ "$ref": "#/components/parameters/Seclai-Version" } ], - "responses": { - "202": { - "content": { - "application/json": { - "schema": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/routers__api__agents__SetEmailTriggerConfigRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EmailTriggerConfigResponse" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceUnavailableError" + } + } + }, + "description": "A dependency is unavailable. `database_unavailable` is temporary (for example routine maintenance) and carries a `Retry-After` header, after which the request can be retried unchanged. `vector_store_unavailable` means the vector store backing an embeddings operation is not configured; it carries no `Retry-After` because it does not clear without an operator.", + "headers": { + "Retry-After": { + "description": "Seconds to wait before retrying. Sent only with `database_unavailable`.", + "schema": { + "type": "integer" + } + } + } + } + }, + "summary": "Configure an EMAIL_RECEIVED trigger", + "tags": [ + "agents" + ] + } + }, + "/agents/{agent_id}/upload-input": { + "post": { + "description": "Upload a file to use as input for a `dynamic_input` agent run. Any other agent rejects the upload with HTTP 400.\n\n**Size limit:** 200 MB per file.\n\nFrom `Seclai-Version: 2026-10-16` a file of any type is accepted and is `ready` at once: pass `input_upload_id` to `POST /agents/{agent_id}/runs`. Each step receives the file itself when its model reads that type, and otherwise its text (OCR, extraction or transcript), made once for the steps that need it; a type nothing reads or converts is passed on as a file only. `input` carries a `# filename` heading per file.\n\nEarlier versions accept only these extensions: avi, bmp, csv, docx, epub, flac, gif, html, jpg, json, m4a, markdown, md, mov, mp3, mp4, msg, ogg, pdf, png, ppt, pptx, svg, tiff, txt, wav, webp, xls, xlsx, xml, zip. They write each file's text into `input`, so poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready` before running.\n\nThe agent-input-binary janitor sweeps originals once they pass your account's agent-trace retention (the agent-traces source's retention period; free default 7 days).\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", + "operationId": "api_upload_agent_input_api_agents__agent_id__upload_input_post", + "parameters": [ + { + "in": "path", + "name": "agent_id", + "required": true, + "schema": { + "title": "Agent Id", + "type": "string" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + }, + { + "$ref": "#/components/parameters/Seclai-Version" + } + ], + "responses": { + "202": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/UploadAgentInputApiResponse" } } @@ -18969,9 +19954,326 @@ "name": "limit", "required": false, "schema": { - "default": 50, - "maximum": 200, - "minimum": 1, + "default": 50, + "maximum": 200, + "minimum": 1, + "title": "Limit", + "type": "integer" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + }, + { + "$ref": "#/components/parameters/Seclai-Version" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/CloudDriveRejectionResponseModel" + }, + "title": "Response List Cloud Drive Rejections Api Api Cloud Drives Connection Id Rejections Get", + "type": "array" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceUnavailableError" + } + } + }, + "description": "A dependency is unavailable. `database_unavailable` is temporary (for example routine maintenance) and carries a `Retry-After` header, after which the request can be retried unchanged. `vector_store_unavailable` means the vector store backing an embeddings operation is not configured; it carries no `Retry-After` because it does not clear without an operator.", + "headers": { + "Retry-After": { + "description": "Seconds to wait before retrying. Sent only with `database_unavailable`.", + "schema": { + "type": "integer" + } + } + } + } + }, + "summary": "List files this connection did not process", + "tags": [ + "cloud_drives" + ] + } + }, + "/contents/{source_connection_content_version}": { + "delete": { + "description": "Delete a content item (a `SourceConnectionContentVersion`).\n\nUse this to remove an uploaded or indexed item from your account. Deleting content can affect agents and knowledge base workflows that reference this item.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only delete content belonging to your account.\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.", + "operationId": "delete_content_api_contents__source_connection_content_version__delete", + "parameters": [ + { + "in": "path", + "name": "source_connection_content_version", + "required": true, + "schema": { + "title": "Source Connection Content Version", + "type": "string" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + }, + { + "$ref": "#/components/parameters/Seclai-Version" + } + ], + "responses": { + "204": { + "description": "Successful Response" + }, + "403": { + "description": "The key's user is a member of the account but not an owner or administrator (`error.code` is `permission_denied`)." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceUnavailableError" + } + } + }, + "description": "A dependency is unavailable. `database_unavailable` is temporary (for example routine maintenance) and carries a `Retry-After` header, after which the request can be retried unchanged. `vector_store_unavailable` means the vector store backing an embeddings operation is not configured; it carries no `Retry-After` because it does not clear without an operator.", + "headers": { + "Retry-After": { + "description": "Seconds to wait before retrying. Sent only with `database_unavailable`.", + "schema": { + "type": "integer" + } + } + } + } + }, + "summary": "Delete content", + "tags": [ + "contents" + ] + }, + "get": { + "description": "Get detailed information about a specific content item (a `SourceConnectionContentVersion`).\n\nThis is useful when you want to:\n- Inspect the extracted text for debugging or review.\n- Display content details in a UI.\n\nText range:\n- `start` and `end` control the character range returned in `text_content` so clients can page through large documents.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account.", + "operationId": "get_content_detail_api_contents__source_connection_content_version__get", + "parameters": [ + { + "in": "path", + "name": "source_connection_content_version", + "required": true, + "schema": { + "title": "Source Connection Content Version", + "type": "string" + } + }, + { + "in": "query", + "name": "start", + "required": false, + "schema": { + "default": 0, + "title": "Start", + "type": "integer" + } + }, + { + "in": "query", + "name": "end", + "required": false, + "schema": { + "default": 5000, + "title": "End", + "type": "integer" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + }, + { + "$ref": "#/components/parameters/Seclai-Version" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/routers__api__contents__ContentDetailResponse" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceUnavailableError" + } + } + }, + "description": "A dependency is unavailable. `database_unavailable` is temporary (for example routine maintenance) and carries a `Retry-After` header, after which the request can be retried unchanged. `vector_store_unavailable` means the vector store backing an embeddings operation is not configured; it carries no `Retry-After` because it does not clear without an operator.", + "headers": { + "Retry-After": { + "description": "Seconds to wait before retrying. Sent only with `database_unavailable`.", + "schema": { + "type": "integer" + } + } + } + } + }, + "summary": "Get content details", + "tags": [ + "contents" + ] + }, + "put": { + "description": "Replace a content version using a small inline text payload.\n\n**Maximum payload size:** 8192 bytes (UTF-8).\n\n**Supported content types:**\n- `application/json`\n- `application/xml`\n- `text/csv`\n- `text/html`\n- `text/markdown`\n- `text/plain`\n- `text/x-markdown`\n- `text/xml`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- Use this endpoint for small text payloads; larger files should use `/upload`.\n- `title` is merged into `metadata.title` when not already present.\n- The replacement is indexed in the background. This `SourceConnectionContentVersion` ID keeps working, and reads return the previous content until indexing finishes; poll `list_source_content_status` to follow it. The returned `content_version_id` is the new version.", + "operationId": "replace_content_with_inline_text_api_contents__source_connection_content_version__put", + "parameters": [ + { + "in": "path", + "name": "source_connection_content_version", + "required": true, + "schema": { + "title": "Source Connection Content Version", + "type": "string" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + }, + { + "$ref": "#/components/parameters/Seclai-Version" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InlineTextReplaceRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/routers__api__contents__FileUploadResponse" + } + } + }, + "description": "Successful Response" + }, + "403": { + "description": "The key's user is not an owner or administrator of the account (`error.code` is `permission_denied`), or the account is suspended (`suspended_account`)." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceUnavailableError" + } + } + }, + "description": "A dependency is unavailable. `database_unavailable` is temporary (for example routine maintenance) and carries a `Retry-After` header, after which the request can be retried unchanged. `vector_store_unavailable` means the vector store backing an embeddings operation is not configured; it carries no `Retry-After` because it does not clear without an operator.", + "headers": { + "Retry-After": { + "description": "Seconds to wait before retrying. Sent only with `database_unavailable`.", + "schema": { + "type": "integer" + } + } + } + } + }, + "summary": "Replace a content version with inline text", + "tags": [ + "contents" + ] + } + }, + "/contents/{source_connection_content_version}/attachments": { + "get": { + "description": "List the files attached to a content item, with pagination.\n\nAn agent's `write_content_attachment` step attaches a file, and an email content source attaches the files sent with a message. An RSS source attaches the kinds of feed file chosen in its `feed_attachments`. The images and video in a web page's main content are attached on a source with media indexing on. The images inside a PDF, DOCX, PPTX or XLSX item or attachment are attached too, on a source that indexes document images. Each entry says whether the file is indexed for search and, when indexing failed, why.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content belonging to your account.", + "operationId": "list_content_attachments_api_contents__source_connection_content_version__attachments_get", + "parameters": [ + { + "in": "path", + "name": "source_connection_content_version", + "required": true, + "schema": { + "title": "Source Connection Content Version", + "type": "string" + } + }, + { + "in": "query", + "name": "page", + "required": false, + "schema": { + "default": 1, + "title": "Page", + "type": "integer" + } + }, + { + "in": "query", + "name": "limit", + "required": false, + "schema": { + "default": 20, "title": "Limit", "type": "integer" } @@ -18988,11 +20290,7 @@ "content": { "application/json": { "schema": { - "items": { - "$ref": "#/components/schemas/CloudDriveRejectionResponseModel" - }, - "title": "Response List Cloud Drive Rejections Api Api Cloud Drives Connection Id Rejections Get", - "type": "array" + "$ref": "#/components/schemas/routers__api__contents__ContentAttachmentsListResponse" } } }, @@ -19027,26 +20325,59 @@ } } }, - "summary": "List files this connection did not process", + "summary": "List content attachments", "tags": [ - "cloud_drives" + "contents" ] } }, - "/contents/{source_connection_content_version}": { - "delete": { - "description": "Delete a content item (a `SourceConnectionContentVersion`).\n\nUse this to remove an uploaded or indexed item from your account. Deleting content can affect agents and knowledge base workflows that reference this item.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only delete content belonging to your account.\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.", - "operationId": "delete_content_api_contents__source_connection_content_version__delete", + "/contents/{source_connection_content_version}/attachments/{attachment_id}": { + "get": { + "description": "Get one file attached to a content item: its indexing status and reason, its metadata, and the text it is indexed by.\n\n`attachment_id` is the `id` of an entry in the item's attachment list. Use `start` and `end` to page through long text. A file that was not indexed has no text.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content belonging to your account.", + "operationId": "get_content_attachment_api_contents__source_connection_content_version__attachments__attachment_id__get", "parameters": [ { "in": "path", "name": "source_connection_content_version", "required": true, "schema": { + "format": "uuid", "title": "Source Connection Content Version", "type": "string" } }, + { + "in": "path", + "name": "attachment_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Attachment Id", + "type": "string" + } + }, + { + "in": "query", + "name": "start", + "required": false, + "schema": { + "default": 0, + "minimum": 0, + "title": "Start", + "type": "integer" + } + }, + { + "in": "query", + "name": "end", + "required": false, + "schema": { + "default": 5000, + "minimum": 0, + "title": "End", + "type": "integer" + } + }, { "$ref": "#/components/parameters/X-Account-Id" }, @@ -19055,11 +20386,18 @@ } ], "responses": { - "204": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/routers__api__contents__ContentAttachmentDetailResponse" + } + } + }, "description": "Successful Response" }, - "403": { - "description": "The key's user is a member of the account but not an owner or administrator (`error.code` is `permission_denied`)." + "402": { + "description": "The account has no credits left (`error.code` is `insufficient_credits`)." }, "422": { "content": { @@ -19090,41 +20428,57 @@ } } }, - "summary": "Delete content", + "summary": "Get a content attachment", "tags": [ "contents" ] - }, + } + }, + "/contents/{source_connection_content_version}/attachments/{attachment_id}/embeddings": { "get": { - "description": "Get detailed information about a specific content item (a `SourceConnectionContentVersion`).\n\nThis is useful when you want to:\n- Inspect the extracted text for debugging or review.\n- Display content details in a UI.\n\nText range:\n- `start` and `end` control the character range returned in `text_content` so clients can page through large documents.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account.", - "operationId": "get_content_detail_api_contents__source_connection_content_version__get", + "description": "List the embeddings (chunk vectors) an attached file is indexed by, with pagination. The list is empty for a file that has no completed index.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content belonging to your account.", + "operationId": "list_content_attachment_embeddings_api_contents__source_connection_content_version__attachments__attachment_id__embeddings_get", "parameters": [ { "in": "path", "name": "source_connection_content_version", "required": true, "schema": { + "format": "uuid", "title": "Source Connection Content Version", "type": "string" } }, + { + "in": "path", + "name": "attachment_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Attachment Id", + "type": "string" + } + }, { "in": "query", - "name": "start", + "name": "page", "required": false, "schema": { - "default": 0, - "title": "Start", + "default": 1, + "minimum": 1, + "title": "Page", "type": "integer" } }, { "in": "query", - "name": "end", + "name": "limit", "required": false, "schema": { - "default": 5000, - "title": "End", + "default": 20, + "maximum": 100, + "minimum": 1, + "title": "Limit", "type": "integer" } }, @@ -19140,12 +20494,15 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/routers__api__contents__ContentDetailResponse" + "$ref": "#/components/schemas/routers__api__contents__ContentEmbeddingsListResponse" } } }, "description": "Successful Response" }, + "402": { + "description": "The account has no credits left (`error.code` is `insufficient_credits`)." + }, "422": { "content": { "application/json": { @@ -19175,24 +20532,37 @@ } } }, - "summary": "Get content details", + "summary": "List a content attachment's embeddings", "tags": [ "contents" ] - }, - "put": { - "description": "Replace a content version using a small inline text payload.\n\n**Maximum payload size:** 8192 bytes (UTF-8).\n\n**Supported content types:**\n- `application/json`\n- `application/xml`\n- `text/csv`\n- `text/html`\n- `text/markdown`\n- `text/plain`\n- `text/x-markdown`\n- `text/xml`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- Use this endpoint for small text payloads; larger files should use `/upload`.\n- `title` is merged into `metadata.title` when not already present.\n- The replacement is indexed in the background. This `SourceConnectionContentVersion` ID keeps working, and reads return the previous content until indexing finishes; poll `list_source_content_status` to follow it. The returned `content_version_id` is the new version.", - "operationId": "replace_content_with_inline_text_api_contents__source_connection_content_version__put", + } + }, + "/contents/{source_connection_content_version}/attachments/{attachment_id}/file": { + "get": { + "description": "Download an attached file's bytes.\n\nImages, audio, video, PDF and plain text are served with their own type; an SVG that cannot be sanitized, and anything else, is served as `application/octet-stream`.\n\nAnswers 403 when the file is withheld: a governance policy blocked or redacted it, or it arrived from outside and is still being indexed. The attachment's `file_withheld` field says which before you ask.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content belonging to your account.", + "operationId": "get_content_attachment_file_api_contents__source_connection_content_version__attachments__attachment_id__file_get", "parameters": [ { "in": "path", "name": "source_connection_content_version", "required": true, "schema": { + "format": "uuid", "title": "Source Connection Content Version", "type": "string" } }, + { + "in": "path", + "name": "attachment_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Attachment Id", + "type": "string" + } + }, { "$ref": "#/components/parameters/X-Account-Id" }, @@ -19200,29 +20570,53 @@ "$ref": "#/components/parameters/Seclai-Version" } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InlineTextReplaceRequest" - } - } - }, - "required": true - }, "responses": { "200": { "content": { - "application/json": { + "application/octet-stream": { "schema": { - "$ref": "#/components/schemas/routers__api__contents__FileUploadResponse" + "format": "binary", + "type": "string" + } + }, + "application/pdf": { + "schema": { + "format": "binary", + "type": "string" + } + }, + "audio/*": { + "schema": { + "format": "binary", + "type": "string" + } + }, + "image/*": { + "schema": { + "format": "binary", + "type": "string" + } + }, + "text/plain": { + "schema": { + "format": "binary", + "type": "string" + } + }, + "video/*": { + "schema": { + "format": "binary", + "type": "string" } } }, - "description": "Successful Response" + "description": "The file's bytes." + }, + "402": { + "description": "The account has no credits left (`error.code` is `insufficient_credits`)." }, "403": { - "description": "The key's user is not an owner or administrator of the account (`error.code` is `permission_denied`), or the account is suspended (`suspended_account`)." + "description": "The file is withheld; `error.code` says why." }, "422": { "content": { @@ -19253,7 +20647,7 @@ } } }, - "summary": "Replace a content version with inline text", + "summary": "Download a content attachment", "tags": [ "contents" ] @@ -19348,7 +20742,7 @@ }, "/contents/{source_connection_content_version}/upload": { "post": { - "description": "Upload a new file and replace the content backing an existing `SourceConnectionContentVersion`.\n\nThis behaves like a source file upload, but it targets an existing content version ID. This is useful when you want to correct or update an uploaded document while keeping references stable.\n\n**Maximum file size:** 209715200 bytes, except `image/svg+xml` at 5242880 bytes (SVG is sanitized before it is stored).\n\n**Supported MIME types:**\n- `application/epub+zip`\n- `application/json`\n- `application/pdf`\n- `application/vnd.ms-excel`\n- `application/vnd.ms-outlook`\n- `application/vnd.ms-powerpoint`\n- `application/vnd.openxmlformats-officedocument.presentationml.presentation`\n- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n- `application/vnd.openxmlformats-officedocument.wordprocessingml.document`\n- `application/xml`\n- `application/zip`\n- `audio/flac`\n- `audio/mp4`\n- `audio/mpeg`\n- `audio/ogg`\n- `audio/wav`\n- `image/bmp`\n- `image/gif`\n- `image/jpeg`\n- `image/png`\n- `image/svg+xml`\n- `image/tiff`\n- `image/webp`\n- `text/csv`\n- `text/html`\n- `text/markdown`\n- `text/plain`\n- `text/x-markdown`\n- `text/xml`\n- `video/mp4`\n- `video/quicktime`\n- `video/x-msvideo`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- The replacement is indexed in the background. This `SourceConnectionContentVersion` ID keeps working, and reads return the previous content until indexing finishes; poll `list_source_content_status` to follow it. The returned `content_version_id` is the new version.\n- If the uploaded file's content type is `application/octet-stream`, the server attempts to infer the type from the file extension.\n- Use `metadata` to attach an arbitrary JSON object of metadata (for example `metadata={\"category\":\"docs\"}`).\n- `title` is a convenience field and is merged into the metadata as `metadata.title` (it does not override an existing `metadata.title`).\n- For backwards compatibility, you can also pass form fields named `metadata_` (for example `metadata_author=...`). These override keys from `metadata`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only replace content belonging to your account.", + "description": "Upload a new file and replace the content backing an existing `SourceConnectionContentVersion`.\n\nThis behaves like a source file upload, but it targets an existing content version ID. This is useful when you want to correct or update an uploaded document while keeping references stable.\n\n**Maximum file size:** 209715200 bytes, except `image/svg+xml` at 5242880 bytes (SVG is sanitized before it is stored).\n\n**Supported MIME types:**\n- `application/atom+xml`\n- `application/epub+zip`\n- `application/json`\n- `application/pdf`\n- `application/rss+xml`\n- `application/rtf`\n- `application/vnd.ms-excel`\n- `application/vnd.ms-outlook`\n- `application/vnd.ms-powerpoint`\n- `application/vnd.openxmlformats-officedocument.presentationml.presentation`\n- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n- `application/vnd.openxmlformats-officedocument.wordprocessingml.document`\n- `application/x-ipynb+json`\n- `application/xhtml+xml`\n- `application/xml`\n- `application/zip`\n- `audio/aac`\n- `audio/amr`\n- `audio/flac`\n- `audio/mp4`\n- `audio/mpeg`\n- `audio/ogg`\n- `audio/opus`\n- `audio/wav`\n- `audio/webm`\n- `image/bmp`\n- `image/gif`\n- `image/jpeg`\n- `image/png`\n- `image/svg+xml`\n- `image/tiff`\n- `image/webp`\n- `message/rfc822`\n- `text/calendar`\n- `text/csv`\n- `text/html`\n- `text/javascript`\n- `text/markdown`\n- `text/plain`\n- `text/tab-separated-values`\n- `text/vcard`\n- `text/vtt`\n- `text/x-c`\n- `text/x-c++`\n- `text/x-csharp`\n- `text/x-go`\n- `text/x-ini`\n- `text/x-java`\n- `text/x-log`\n- `text/x-markdown`\n- `text/x-php`\n- `text/x-python`\n- `text/x-ruby`\n- `text/x-rust`\n- `text/x-shellscript`\n- `text/x-sql`\n- `text/x-subrip`\n- `text/x-tex`\n- `text/x-toml`\n- `text/x-typescript`\n- `text/xml`\n- `text/yaml`\n- `video/3gpp`\n- `video/mp2t`\n- `video/mp4`\n- `video/mpeg`\n- `video/quicktime`\n- `video/webm`\n- `video/x-matroska`\n- `video/x-msvideo`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- The replacement is indexed in the background. This `SourceConnectionContentVersion` ID keeps working, and reads return the previous content until indexing finishes; poll `list_source_content_status` to follow it. The returned `content_version_id` is the new version.\n- If the uploaded file's content type is `application/octet-stream`, the server attempts to infer the type from the file extension.\n- Use `metadata` to attach an arbitrary JSON object of metadata (for example `metadata={\"category\":\"docs\"}`).\n- `title` is a convenience field and is merged into the metadata as `metadata.title` (it does not override an existing `metadata.title`).\n- For backwards compatibility, you can also pass form fields named `metadata_` (for example `metadata_author=...`). These override keys from `metadata`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only replace content belonging to your account.", "operationId": "upload_file_to_content_api_contents__source_connection_content_version__upload_post", "parameters": [ { @@ -22312,7 +23706,7 @@ }, "/models/embedders": { "get": { - "description": "List the embedding models a source can be created with.\n\nEach entry carries the `model_type` to pass as `embedding_model` when creating a source, the `dimensions` it supports, and \u2014 most importantly for multi-modal indexing \u2014 `supported_input_media`: the modalities that embedder can actually index. A source only honours a `media_types` entry its embedder lists here; unsupported kinds are dropped at save time with an `embedder_warning`, so check this before choosing an embedder for a knowledge base of images or video.\n\nText-only embedders report `supported_input_media` as null. Pricing is reported as `credits` (per ~1,000 English words of text) plus `per_modality_rates` for the non-text modalities a multi-modal embedder bills differently.\n\nAn embedder whose credit rate has not been published yet is omitted, so you are never offered one that cannot be billed.\n\nOptional query parameters:\n- `supports_input_media`: keep only embedders that can index this modality (`text`/`image`/`video`/`audio` or a full MIME)\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. The catalog is global reference data, identical for every account.", + "description": "List the embedding models a source can be created with.\n\nEach entry carries the `model_type` to pass as `embedding_model` when creating a source, the `dimensions` it supports, and \u2014 most importantly for multi-modal indexing \u2014 `supported_input_media`: the modalities that embedder can actually index. A source only honours a `media_types` entry its embedder lists here; a kind it does not list is stored and not indexed, so check this before choosing an embedder for a knowledge base of images or video.\n\nText-only embedders report `supported_input_media` as null. Pricing is reported as `credits` (per ~1,000 English words of text) plus `per_modality_rates` for the non-text modalities a multi-modal embedder bills differently.\n\nAn embedder whose credit rate has not been published yet is omitted, so you are never offered one that cannot be billed.\n\nOptional query parameters:\n- `supports_input_media`: keep only embedders that can index this modality (`text`/`image`/`video`/`audio` or a full MIME)\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. The catalog is global reference data, identical for every account.", "operationId": "list_embedding_models_api_models_embedders_get", "parameters": [ { @@ -22766,7 +24160,7 @@ }, "/models/playground/experiments/{experiment_id}/cancel": { "post": { - "description": "Cancel a running or pending model playground experiment.\n\nSignals running model calls to abort and marks the experiment as canceled.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. The experiment must belong to the caller's account and, when the credential is bound to a user, to that user; otherwise 404.", + "description": "Cancel a running or pending model playground experiment.\n\nMarks the experiment as canceled. An experiment that has not started never runs. One that is running starts no further model calls, and records each model it did not call with the error `Canceled`. A model call or evaluation already in progress is not interrupted by the cancel: it continues and is billed, and its result is recorded on the canceled experiment. Canceling may therefore not shorten the run or reduce its cost.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. The experiment must belong to the caller's account and, when the credential is bound to a user, to that user; otherwise 404.", "operationId": "cancel_experiment_endpoint_api_models_playground_experiments__experiment_id__cancel_post", "parameters": [ { @@ -24818,7 +26212,7 @@ ] }, "post": { - "description": "Create a new content source.\n\nSource types: `rss`, `website`, `custom_index`.\n\nFor RSS and website sources, provide the URL. For custom index sources, the URL is created automatically.\n\nFor custom_index sources, you can optionally specify an `index_mode`: `fast_and_cheap` (default), `balanced`, `slow_and_thorough`, or `custom`. The legacy `file_uploads` source type is accepted as an alias for `custom_index` with `index_mode=fast_and_cheap`.", + "description": "Create a new content source.\n\nSource types: `rss_feed`, `website`, `custom_index`, `cloud_drive`, `email`.\n\nFor RSS and website sources, provide the URL. For custom index sources, the URL is created automatically.\n\nAn `email` source takes no URL and requires `email_allowed_senders`; the response's `email_address` is where to send mail.\n\nA `cloud_drive` source takes no URL and requires `cloud_drive_connection_id`, the id of a drive connected in the app (`GET /cloud-drives` lists them).\n\nFor custom_index sources, you can optionally specify an `index_mode`: `fast_and_cheap` (default), `balanced`, `slow_and_thorough`, or `custom`. The legacy `file_uploads` source type is accepted as an alias for `custom_index` with `index_mode=fast_and_cheap`.", "operationId": "create_source_api_sources_post", "parameters": [ { @@ -25014,7 +26408,7 @@ ] }, "post": { - "description": "Upload a small text payload to a content source (no multipart/form-data required).\n\n**Maximum payload size:** 8192 bytes (UTF-8).\n\n**Supported content types:**\n- `application/json`\n- `application/xml`\n- `text/csv`\n- `text/html`\n- `text/markdown`\n- `text/plain`\n- `text/x-markdown`\n- `text/xml`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- Use this endpoint for small text payloads; larger files should use `/upload`.\n- `title` is merged into `metadata.title` when not already present.\n\nTracking indexing progress:\n- **Which id you get back depends on `status`, and they are not interchangeable:**\n - `uploaded` \u2014 a new item. `content_version_id` is set and `source_connection_content_version_id` is `null`. Indexing continues in the background after this call returns.\n - `duplicate` \u2014 this exact file is already on the source, so nothing was created and nothing is being indexed. `content_version_id` is `null` and `source_connection_content_version_id` is the existing, already-indexed item: pass it straight to `GET /contents/{id}`. There is nothing to poll.\n- For an `uploaded` item, poll `GET /sources/{id}/contents/{content_version_id}` with the returned `content_version_id`, or `GET /sources/{id}/contents?content_version_id=\u2026&content_version_id=\u2026` for a whole batch, to follow each item through to `completed` or `failed`.\n- On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes.", + "description": "Upload a small text payload to a content source (no multipart/form-data required).\n\n**Maximum payload size:** 8192 bytes (UTF-8).\n\n**Supported content types:**\n- `application/json`\n- `application/xml`\n- `text/csv`\n- `text/html`\n- `text/markdown`\n- `text/plain`\n- `text/x-markdown`\n- `text/xml`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- Use this endpoint for small text payloads; larger files should use `/upload`.\n- `title` is merged into `metadata.title` when not already present.\n\nTracking indexing progress:\n- **Which id you get back depends on `status`, and they are not interchangeable:**\n - `uploaded` \u2014 a new item. `content_version_id` is set and `source_connection_content_version_id` is `null`. Indexing continues in the background after this call returns.\n - `duplicate` \u2014 this exact file is already on the source, so nothing was created and nothing is being indexed. `content_version_id` is `null` and `source_connection_content_version_id` is the existing, already-indexed item: pass it straight to `GET /contents/{id}`. There is nothing to poll.\n- For an `uploaded` item, poll `GET /sources/{id}/contents/{content_version_id}` with the returned `content_version_id`, or `GET /sources/{id}/contents?content_version_id=\u2026&content_version_id=\u2026` for a whole batch, to follow each item through to `completed` or `failed`.\n- On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes.\n- An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is not in the source and its id stays `null` unless a reviewer releases it, so stop polling.", "operationId": "upload_inline_text_to_source_api_sources__source_connection_id__post", "parameters": [ { @@ -25171,7 +26565,7 @@ }, "/sources/{source_connection_id}/contents": { "get": { - "description": "List every content item this source has attempted to index, with the status of each.\n\nUnlike the source's `content_count`, which only counts finished items, this listing includes items that are still processing and items that failed \u2014 so a bulk upload can report per-item progress and point at the specific items that did not make it.\n\nCorrelating with an upload:\n- Each item is keyed by `content_version_id`, which is what the upload endpoints return. Pass those ids as repeated `content_version_id` query parameters to poll exactly the items you uploaded.\n- `source_connection_content_version_id` is `null` until an item finishes indexing; once set, it is the id `GET /contents/{id}` takes.\n- `content_status` reaches `completed` on success and `failed` on error, with the reason in `error`. The intermediate values are `pending`, `fetching`, `transcribing`, `scanning`, and `indexing`.\n\nParameters:\n- Pagination: `page` and `limit`.\n- Sorting: `sort` (created_at/title/status) and `order` (asc/desc). `created_at` sorts on when the item was uploaded or pulled.\n- Filtering: `status` and repeatable `content_version_id`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only list content for sources belonging to your account.", + "description": "List every content item this source has attempted to index, with the status of each.\n\nUnlike the source's `content_count`, which only counts finished items, this listing includes items that are still processing and items that failed \u2014 so a bulk upload can report per-item progress and point at the specific items that did not make it.\n\nCorrelating with an upload:\n- Each item is keyed by `content_version_id`, which is what the upload endpoints return. Pass those ids as repeated `content_version_id` query parameters to poll exactly the items you uploaded.\n- `source_connection_content_version_id` is `null` until an item finishes indexing; once set, it is the id `GET /contents/{id}` takes.\n- `content_status` reaches `completed` on success and `failed` on error, with the reason in `error`. The intermediate values are `pending`, `fetching`, `transcribing`, `scanning`, and `indexing`.\n- An item an Enforce governance policy blocked at import is held for review: `held_for_review` is `true` and `source_connection_content_version_id` stays `null` until a reviewer releases it. With `Seclai-Version: 2026-10-05` or later it reports `completed`; earlier versions report it as `failed` with the hold as the `error`. The `status` filter matches the item under `completed` on every version.\n\nParameters:\n- Pagination: `page` and `limit`.\n- Sorting: `sort` (created_at/title/status) and `order` (asc/desc). `created_at` sorts on when the item was uploaded or pulled.\n- Filtering: `status` and repeatable `content_version_id`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only list content for sources belonging to your account.", "operationId": "list_source_contents_api_sources__source_connection_id__contents_get", "parameters": [ { @@ -25331,7 +26725,7 @@ }, "/sources/{source_connection_id}/contents/{content_version_id}": { "get": { - "description": "Get the indexing status of a single content item, addressed by the `content_version_id` the upload endpoints return.\n\nUse this to follow one uploaded file through indexing. To follow many at once, use `GET /sources/{id}/contents` with repeated `content_version_id` parameters instead of polling this endpoint per item.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account.", + "description": "Get the indexing status of a single content item, addressed by the `content_version_id` the upload endpoints return.\n\nUse this to follow one uploaded file through indexing. To follow many at once, use `GET /sources/{id}/contents` with repeated `content_version_id` parameters instead of polling this endpoint per item.\n\nAn item held for review by an Enforce governance policy reports `held_for_review: true`. With `Seclai-Version: 2026-10-05` or later its `content_status` is `completed`; earlier versions report `failed` with the hold as the `error`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account.", "operationId": "get_source_content_status_endpoint_api_sources__source_connection_id__contents__content_version_id__get", "parameters": [ { @@ -25407,6 +26801,101 @@ ] } }, + "/sources/{source_connection_id}/email-rejections": { + "get": { + "description": "List mail that an email content source refused, newest first. Each entry says who sent the message and why it was refused, never its subject or body. A message refused as `unsafe_content` also has a prompt-scan record, which keeps the scanned text.\n\nTo accept a refused sender, add its `from_address` or that address's domain to the source's `email_allowed_senders`. That only helps when `authenticated` is true. A `repeat_*` reason marks a message the source received before; allowing its sender does not store it.\n\nRequires an account owner or administrator: a key or token bound to another member gets 403. Returns 404 for a source that is not an email source.", + "operationId": "list_email_source_rejections_api_api_sources__source_connection_id__email_rejections_get", + "parameters": [ + { + "in": "path", + "name": "source_connection_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Source Connection Id", + "type": "string" + } + }, + { + "description": "Page number.", + "in": "query", + "name": "page", + "required": false, + "schema": { + "default": 1, + "description": "Page number.", + "minimum": 1, + "title": "Page", + "type": "integer" + } + }, + { + "description": "Items per page.", + "in": "query", + "name": "limit", + "required": false, + "schema": { + "default": 20, + "description": "Items per page.", + "maximum": 100, + "minimum": 1, + "title": "Limit", + "type": "integer" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + }, + { + "$ref": "#/components/parameters/Seclai-Version" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EmailSourceRejectionListResponse" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServiceUnavailableError" + } + } + }, + "description": "A dependency is unavailable. `database_unavailable` is temporary (for example routine maintenance) and carries a `Retry-After` header, after which the request can be retried unchanged. `vector_store_unavailable` means the vector store backing an embeddings operation is not configured; it carries no `Retry-After` because it does not clear without an operator.", + "headers": { + "Retry-After": { + "description": "Seconds to wait before retrying. Sent only with `database_unavailable`.", + "schema": { + "type": "integer" + } + } + } + } + }, + "summary": "List mail an email source refused", + "tags": [ + "sources" + ] + } + }, "/sources/{source_connection_id}/embedding-migration": { "get": { "description": "Get the latest embedding migration status for a custom-index source.\n\nReturns `null` when no migration has ever been started for this source.", @@ -26187,7 +27676,7 @@ }, "/sources/{source_connection_id}/upload": { "post": { - "description": "Upload a file to a content source.\n\n**Maximum file size:** 209715200 bytes, except `image/svg+xml` at 5242880 bytes (SVG is sanitized before it is stored).\n\n**Supported MIME types:**\n- `application/epub+zip`\n- `application/json`\n- `application/pdf`\n- `application/vnd.ms-excel`\n- `application/vnd.ms-outlook`\n- `application/vnd.ms-powerpoint`\n- `application/vnd.openxmlformats-officedocument.presentationml.presentation`\n- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n- `application/vnd.openxmlformats-officedocument.wordprocessingml.document`\n- `application/xml`\n- `application/zip`\n- `audio/flac`\n- `audio/mp4`\n- `audio/mpeg`\n- `audio/ogg`\n- `audio/wav`\n- `image/bmp`\n- `image/gif`\n- `image/jpeg`\n- `image/png`\n- `image/svg+xml`\n- `image/tiff`\n- `image/webp`\n- `text/csv`\n- `text/html`\n- `text/markdown`\n- `text/plain`\n- `text/x-markdown`\n- `text/xml`\n- `video/mp4`\n- `video/quicktime`\n- `video/x-msvideo`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- If the uploaded file's content type is `application/octet-stream`, the server attempts to infer the type from the file extension.\n- Use `metadata` to attach an arbitrary JSON object of metadata (for example `metadata={\"author\":\"Ada\",\"category\":\"docs\"}`).\n- `title` is a convenience field and is merged into the metadata as `metadata.title` (it does not override an existing `metadata.title`).\n- For backwards compatibility, you can also pass form fields named `metadata_` (for example `metadata_author=...`). These override keys from `metadata`.\n\nResponse:\n- `status` is `uploaded` for a new upload, or `duplicate` when the same file already exists for this source.\n\nTracking indexing progress:\n- **Which id you get back depends on `status`, and they are not interchangeable:**\n - `uploaded` \u2014 a new item. `content_version_id` is set and `source_connection_content_version_id` is `null`. Indexing continues in the background after this call returns.\n - `duplicate` \u2014 this exact file is already on the source, so nothing was created and nothing is being indexed. `content_version_id` is `null` and `source_connection_content_version_id` is the existing, already-indexed item: pass it straight to `GET /contents/{id}`. There is nothing to poll.\n- For an `uploaded` item, poll `GET /sources/{id}/contents/{content_version_id}` with the returned `content_version_id`, or `GET /sources/{id}/contents?content_version_id=\u2026&content_version_id=\u2026` for a whole batch, to follow each item through to `completed` or `failed`.\n- On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes.", + "description": "Upload a file to a content source.\n\n**Maximum file size:** 209715200 bytes, except `image/svg+xml` at 5242880 bytes (SVG is sanitized before it is stored).\n\n**Supported MIME types:**\n- `application/atom+xml`\n- `application/epub+zip`\n- `application/json`\n- `application/pdf`\n- `application/rss+xml`\n- `application/rtf`\n- `application/vnd.ms-excel`\n- `application/vnd.ms-outlook`\n- `application/vnd.ms-powerpoint`\n- `application/vnd.openxmlformats-officedocument.presentationml.presentation`\n- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n- `application/vnd.openxmlformats-officedocument.wordprocessingml.document`\n- `application/x-ipynb+json`\n- `application/xhtml+xml`\n- `application/xml`\n- `application/zip`\n- `audio/aac`\n- `audio/amr`\n- `audio/flac`\n- `audio/mp4`\n- `audio/mpeg`\n- `audio/ogg`\n- `audio/opus`\n- `audio/wav`\n- `audio/webm`\n- `image/bmp`\n- `image/gif`\n- `image/jpeg`\n- `image/png`\n- `image/svg+xml`\n- `image/tiff`\n- `image/webp`\n- `message/rfc822`\n- `text/calendar`\n- `text/csv`\n- `text/html`\n- `text/javascript`\n- `text/markdown`\n- `text/plain`\n- `text/tab-separated-values`\n- `text/vcard`\n- `text/vtt`\n- `text/x-c`\n- `text/x-c++`\n- `text/x-csharp`\n- `text/x-go`\n- `text/x-ini`\n- `text/x-java`\n- `text/x-log`\n- `text/x-markdown`\n- `text/x-php`\n- `text/x-python`\n- `text/x-ruby`\n- `text/x-rust`\n- `text/x-shellscript`\n- `text/x-sql`\n- `text/x-subrip`\n- `text/x-tex`\n- `text/x-toml`\n- `text/x-typescript`\n- `text/xml`\n- `text/yaml`\n- `video/3gpp`\n- `video/mp2t`\n- `video/mp4`\n- `video/mpeg`\n- `video/quicktime`\n- `video/webm`\n- `video/x-matroska`\n- `video/x-msvideo`\n\nNotes:\n- A key bound to a user must belong to an owner or administrator of the account; a viewer's key is refused with 403 `permission_denied`. Account-scoped keys carry no user and are unaffected.\n- If the uploaded file's content type is `application/octet-stream`, the server attempts to infer the type from the file extension.\n- Use `metadata` to attach an arbitrary JSON object of metadata (for example `metadata={\"author\":\"Ada\",\"category\":\"docs\"}`).\n- `title` is a convenience field and is merged into the metadata as `metadata.title` (it does not override an existing `metadata.title`).\n- For backwards compatibility, you can also pass form fields named `metadata_` (for example `metadata_author=...`). These override keys from `metadata`.\n\nResponse:\n- `status` is `uploaded` for a new upload, or `duplicate` when the same file already exists for this source.\n\nTracking indexing progress:\n- **Which id you get back depends on `status`, and they are not interchangeable:**\n - `uploaded` \u2014 a new item. `content_version_id` is set and `source_connection_content_version_id` is `null`. Indexing continues in the background after this call returns.\n - `duplicate` \u2014 this exact file is already on the source, so nothing was created and nothing is being indexed. `content_version_id` is `null` and `source_connection_content_version_id` is the existing, already-indexed item: pass it straight to `GET /contents/{id}`. There is nothing to poll.\n- For an `uploaded` item, poll `GET /sources/{id}/contents/{content_version_id}` with the returned `content_version_id`, or `GET /sources/{id}/contents?content_version_id=\u2026&content_version_id=\u2026` for a whole batch, to follow each item through to `completed` or `failed`.\n- On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes.\n- An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is not in the source and its id stays `null` unless a reviewer releases it, so stop polling.", "operationId": "upload_file_to_source_api_sources__source_connection_id__upload_post", "parameters": [ { @@ -26267,7 +27756,7 @@ }, "/v2/agent-runs/{run_id}/attachments/{attachment_id}": { "get": { - "description": "Streams the bytes of an attachment emitted by a step in the given agent run. ``attachment_id`` is the ``id`` of an entry in the run's or a step's ``attachments``, or the URL-safe-base64-encoded storage key, which webhook and email links carry.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token.\n- The calling account must own ``run_id``; lookup failures (missing run, cross-account run, soft-deleted agent, a run whose trace was purged, a file not in the run) all collapse to a single 404 to prevent cross-tenant existence enumeration.\n\nMIME handling:\n- Inline-safe MIMEs (image/*, audio/*, video/*, application/pdf, text/plain, application/vnd.seclai.manifest+json) are served with their declared type.\n- Everything else is served as ``application/octet-stream`` with an attachment disposition to prevent stored-XSS.", + "description": "Streams the bytes of a file of the given agent run: one a step emitted, or one the run started with. ``attachment_id`` is the ``id`` of an entry in the run's or a step's ``attachments``, or the URL-safe-base64-encoded storage key, which webhook and email links carry.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token.\n- The calling account must own ``run_id``; lookup failures (missing run, cross-account run, soft-deleted agent, a run whose trace was purged, a file not in the run) all collapse to a single 404 to prevent cross-tenant existence enumeration.\n\nMIME handling:\n- Inline-safe MIMEs (image/*, audio/*, video/*, application/pdf, text/plain, application/vnd.seclai.manifest+json) are served with their declared type.\n- Everything else is served as ``application/octet-stream`` with an attachment disposition to prevent stored-XSS.", "operationId": "serve_agent_run_attachment_api_v2_agent_runs__run_id__attachments__attachment_id__get", "parameters": [ { @@ -26528,8 +28017,14 @@ "2026-08-21", "2026-09-28", "2026-09-30", - "2026-10-03" + "2026-10-03", + "2026-10-05", + "2026-10-13", + "2026-10-16", + "2026-10-18", + "2026-10-19", + "2026-10-21" ], - "latest": "2026-10-03" + "latest": "2026-10-21" } } diff --git a/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py b/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py index 7a9f366..632a8ae 100644 --- a/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py +++ b/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py @@ -94,6 +94,8 @@ def sync_detailed( Returns total, passed, failed, error, and flagged counts alongside the average score, giving a quick overview of how the criteria is performing. + With ``2026-10-21`` or later, ``average_score`` averages only passed and failed + results; earlier versions average every stored score, ``error`` included. Args: criteria_id (str): @@ -139,6 +141,8 @@ def sync( Returns total, passed, failed, error, and flagged counts alongside the average score, giving a quick overview of how the criteria is performing. + With ``2026-10-21`` or later, ``average_score`` averages only passed and failed + results; earlier versions average every stored score, ``error`` included. Args: criteria_id (str): @@ -176,6 +180,8 @@ async def asyncio_detailed( Returns total, passed, failed, error, and flagged counts alongside the average score, giving a quick overview of how the criteria is performing. + With ``2026-10-21`` or later, ``average_score`` averages only passed and failed + results; earlier versions average every stored score, ``error`` included. Args: criteria_id (str): @@ -219,6 +225,8 @@ async def asyncio( Returns total, passed, failed, error, and flagged counts alongside the average score, giving a quick overview of how the criteria is performing. + With ``2026-10-21`` or later, ``average_score`` averages only passed and failed + results; earlier versions average every stored score, ``error`` included. Args: criteria_id (str): diff --git a/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py b/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py index 9bd990a..b26f2ea 100644 --- a/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py +++ b/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py @@ -128,6 +128,11 @@ def sync_detailed( Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, sample_and_flag). + With ``2026-10-21`` or later, ``error`` results (the evaluator returned no + verdict) are left out of ``failed``, and the rates are over passed and + failed results. Earlier versions count them in ``failed`` and rate over + every result. ``error`` is returned on every version. + The ``agent_id`` scoping parameter is part of the ``2026-07-27`` changeset (opt in via the ``Seclai-Version`` header). Clients on the legacy baseline always receive the account-wide rollup; ``agent_id`` is ignored for them so @@ -188,6 +193,11 @@ def sync( Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, sample_and_flag). + With ``2026-10-21`` or later, ``error`` results (the evaluator returned no + verdict) are left out of ``failed``, and the rates are over passed and + failed results. Earlier versions count them in ``failed`` and rate over + every result. ``error`` is returned on every version. + The ``agent_id`` scoping parameter is part of the ``2026-07-27`` changeset (opt in via the ``Seclai-Version`` header). Clients on the legacy baseline always receive the account-wide rollup; ``agent_id`` is ignored for them so @@ -240,6 +250,11 @@ async def asyncio_detailed( Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, sample_and_flag). + With ``2026-10-21`` or later, ``error`` results (the evaluator returned no + verdict) are left out of ``failed``, and the rates are over passed and + failed results. Earlier versions count them in ``failed`` and rate over + every result. ``error`` is returned on every version. + The ``agent_id`` scoping parameter is part of the ``2026-07-27`` changeset (opt in via the ``Seclai-Version`` header). Clients on the legacy baseline always receive the account-wide rollup; ``agent_id`` is ignored for them so @@ -298,6 +313,11 @@ async def asyncio( Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, sample_and_flag). + With ``2026-10-21`` or later, ``error`` results (the evaluator returned no + verdict) are left out of ``failed``, and the rates are over passed and + failed results. Earlier versions count them in ``failed`` and rate over + every result. ``error`` is returned on every version. + The ``agent_id`` scoping parameter is part of the ``2026-07-27`` changeset (opt in via the ``Seclai-Version`` header). Clients on the legacy baseline always receive the account-wide rollup; ``agent_id`` is ignored for them so diff --git a/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py b/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py index 63b845d..e7c83a0 100644 --- a/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py +++ b/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py @@ -98,6 +98,10 @@ def sync_detailed( configurations while editing criteria. The evaluation is a billed LLM call; only its result goes unrecorded. + ``status`` is ``error`` when the evaluator returned no verdict. With + ``Seclai-Version: 2026-10-21`` or later, ``score`` and ``passed`` are then + ``null``; earlier versions return ``score`` 0.5 and ``passed`` false. + Args: agent_id (str): x_account_id (UUID | Unset): @@ -146,6 +150,10 @@ def sync( configurations while editing criteria. The evaluation is a billed LLM call; only its result goes unrecorded. + ``status`` is ``error`` when the evaluator returned no verdict. With + ``Seclai-Version: 2026-10-21`` or later, ``score`` and ``passed`` are then + ``null``; earlier versions return ``score`` 0.5 and ``passed`` false. + Args: agent_id (str): x_account_id (UUID | Unset): @@ -191,6 +199,10 @@ async def asyncio_detailed( configurations while editing criteria. The evaluation is a billed LLM call; only its result goes unrecorded. + ``status`` is ``error`` when the evaluator returned no verdict. With + ``Seclai-Version: 2026-10-21`` or later, ``score`` and ``passed`` are then + ``null``; earlier versions return ``score`` 0.5 and ``passed`` false. + Args: agent_id (str): x_account_id (UUID | Unset): @@ -237,6 +249,10 @@ async def asyncio( configurations while editing criteria. The evaluation is a billed LLM call; only its result goes unrecorded. + ``status`` is ``error`` when the evaluator returned no verdict. With + ``Seclai-Version: 2026-10-21`` or later, ``score`` and ``passed`` are then + ``null``; earlier versions return ``score`` 0.5 and ``passed`` false. + Args: agent_id (str): x_account_id (UUID | Unset): diff --git a/seclai/_generated/api/agent_run_attachments/serve_agent_run_attachment_api_v2_agent_runs_run_id_attachments_attachment_id_get.py b/seclai/_generated/api/agent_run_attachments/serve_agent_run_attachment_api_v2_agent_runs_run_id_attachments_attachment_id_get.py index b6b0f94..76fef0a 100644 --- a/seclai/_generated/api/agent_run_attachments/serve_agent_run_attachment_api_v2_agent_runs_run_id_attachments_attachment_id_get.py +++ b/seclai/_generated/api/agent_run_attachments/serve_agent_run_attachment_api_v2_agent_runs_run_id_attachments_attachment_id_get.py @@ -98,9 +98,9 @@ def sync_detailed( ) -> Response[File | HTTPValidationError | ServiceUnavailableError]: """Download an agent-run attachment - Streams the bytes of an attachment emitted by a step in the given agent run. ``attachment_id`` is - the ``id`` of an entry in the run's or a step's ``attachments``, or the URL-safe-base64-encoded - storage key, which webhook and email links carry. + Streams the bytes of a file of the given agent run: one a step emitted, or one the run started with. + ``attachment_id`` is the ``id`` of an entry in the run's or a step's ``attachments``, or the URL- + safe-base64-encoded storage key, which webhook and email links carry. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. @@ -155,9 +155,9 @@ def sync( ) -> File | HTTPValidationError | ServiceUnavailableError | None: """Download an agent-run attachment - Streams the bytes of an attachment emitted by a step in the given agent run. ``attachment_id`` is - the ``id`` of an entry in the run's or a step's ``attachments``, or the URL-safe-base64-encoded - storage key, which webhook and email links carry. + Streams the bytes of a file of the given agent run: one a step emitted, or one the run started with. + ``attachment_id`` is the ``id`` of an entry in the run's or a step's ``attachments``, or the URL- + safe-base64-encoded storage key, which webhook and email links carry. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. @@ -207,9 +207,9 @@ async def asyncio_detailed( ) -> Response[File | HTTPValidationError | ServiceUnavailableError]: """Download an agent-run attachment - Streams the bytes of an attachment emitted by a step in the given agent run. ``attachment_id`` is - the ``id`` of an entry in the run's or a step's ``attachments``, or the URL-safe-base64-encoded - storage key, which webhook and email links carry. + Streams the bytes of a file of the given agent run: one a step emitted, or one the run started with. + ``attachment_id`` is the ``id`` of an entry in the run's or a step's ``attachments``, or the URL- + safe-base64-encoded storage key, which webhook and email links carry. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. @@ -262,9 +262,9 @@ async def asyncio( ) -> File | HTTPValidationError | ServiceUnavailableError | None: """Download an agent-run attachment - Streams the bytes of an attachment emitted by a step in the given agent run. ``attachment_id`` is - the ``id`` of an entry in the run's or a step's ``attachments``, or the URL-safe-base64-encoded - storage key, which webhook and email links carry. + Streams the bytes of a file of the given agent run: one a step emitted, or one the run started with. + ``attachment_id`` is the ``id`` of an entry in the run's or a step's ``attachments``, or the URL- + safe-base64-encoded storage key, which webhook and email links carry. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. diff --git a/seclai/_generated/api/agents/api_get_agent_attachment_references_api_agents_agent_id_attachment_references_get.py b/seclai/_generated/api/agents/api_get_agent_attachment_references_api_agents_agent_id_attachment_references_get.py index 8a21071..1c24f4e 100644 --- a/seclai/_generated/api/agents/api_get_agent_attachment_references_api_agents_agent_id_attachment_references_get.py +++ b/seclai/_generated/api/agents/api_get_agent_attachment_references_api_agents_agent_id_attachment_references_get.py @@ -90,12 +90,11 @@ def sync_detailed( ]: """Get agent attachment-reference contract - Return the static attachment-reference contract for an agent — what files the agent's definition - expects on a run. + Return the input attachments the agent's dynamic_input trigger declares — the files a run may carry. Call this BEFORE staging uploads so you know whether the agent accepts files at all - (``requires_uploads``), and which specific filenames/indexes/patterns the templates reference. - Mismatched batches are rejected at run time with HTTP 400. + (``requires_uploads``), and which attachments its trigger declares (``accepted_attachments``). + Batches that do not fit them are rejected at run time with HTTP 400. Args: agent_id (str): @@ -137,12 +136,11 @@ def sync( ): """Get agent attachment-reference contract - Return the static attachment-reference contract for an agent — what files the agent's definition - expects on a run. + Return the input attachments the agent's dynamic_input trigger declares — the files a run may carry. Call this BEFORE staging uploads so you know whether the agent accepts files at all - (``requires_uploads``), and which specific filenames/indexes/patterns the templates reference. - Mismatched batches are rejected at run time with HTTP 400. + (``requires_uploads``), and which attachments its trigger declares (``accepted_attachments``). + Batches that do not fit them are rejected at run time with HTTP 400. Args: agent_id (str): @@ -176,12 +174,11 @@ async def asyncio_detailed( ]: """Get agent attachment-reference contract - Return the static attachment-reference contract for an agent — what files the agent's definition - expects on a run. + Return the input attachments the agent's dynamic_input trigger declares — the files a run may carry. Call this BEFORE staging uploads so you know whether the agent accepts files at all - (``requires_uploads``), and which specific filenames/indexes/patterns the templates reference. - Mismatched batches are rejected at run time with HTTP 400. + (``requires_uploads``), and which attachments its trigger declares (``accepted_attachments``). + Batches that do not fit them are rejected at run time with HTTP 400. Args: agent_id (str): @@ -221,12 +218,11 @@ async def asyncio( ): """Get agent attachment-reference contract - Return the static attachment-reference contract for an agent — what files the agent's definition - expects on a run. + Return the input attachments the agent's dynamic_input trigger declares — the files a run may carry. Call this BEFORE staging uploads so you know whether the agent accepts files at all - (``requires_uploads``), and which specific filenames/indexes/patterns the templates reference. - Mismatched batches are rejected at run time with HTTP 400. + (``requires_uploads``), and which attachments its trigger declares (``accepted_attachments``). + Batches that do not fit them are rejected at run time with HTTP 400. Args: agent_id (str): diff --git a/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py b/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py index a37b599..5c3c7e3 100644 --- a/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py +++ b/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py @@ -85,25 +85,24 @@ def sync_detailed( ]: """Upload file input - Upload a file to use as input for a `dynamic_input` agent run. - - Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. - Text and document files are processed synchronously; audio/video are submitted for asynchronous - transcription. + Upload a file to use as input for a `dynamic_input` agent run. Any other agent rejects the upload + with HTTP 400. **Size limit:** 200 MB per file. - **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, - zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + From `Seclai-Version: 2026-10-16` a file of any type is accepted and is `ready` at once: pass + `input_upload_id` to `POST /agents/{agent_id}/runs`. Each step receives the file itself when its + model reads that type, and otherwise its text (OCR, extraction or transcript), made once for the + steps that need it; a type nothing reads or converts is passed on as a file only. `input` carries a + `# filename` heading per file. - After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, - then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + Earlier versions accept only these extensions: avi, bmp, csv, docx, epub, flac, gif, html, jpg, + json, m4a, markdown, md, mov, mp3, mp4, msg, ogg, pdf, png, ppt, pptx, svg, tiff, txt, wav, webp, + xls, xlsx, xml, zip. They write each file's text into `input`, so poll `GET + /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready` before running. - **Multi-modal routing:** non-text uploads (image, audio, video, PDF) are surfaced natively to multi- - modal-capable prompt steps; text-only models fall back to the OCR / transcript text counterpart. - Audio originals are preserved past transcription so audio-capable models (Gemini 2.5/3, GPT-5 audio) - read them directly; the agent-input-binary janitor sweeps originals once they pass your account's - agent-trace retention (the agent-traces source's retention period; free default 7 days). + The agent-input-binary janitor sweeps originals once they pass your account's agent-trace retention + (the agent-traces source's retention period; free default 7 days). Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's @@ -144,25 +143,24 @@ def sync( ) -> HTTPValidationError | ServiceUnavailableError | UploadAgentInputApiResponse | None: """Upload file input - Upload a file to use as input for a `dynamic_input` agent run. - - Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. - Text and document files are processed synchronously; audio/video are submitted for asynchronous - transcription. + Upload a file to use as input for a `dynamic_input` agent run. Any other agent rejects the upload + with HTTP 400. **Size limit:** 200 MB per file. - **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, - zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + From `Seclai-Version: 2026-10-16` a file of any type is accepted and is `ready` at once: pass + `input_upload_id` to `POST /agents/{agent_id}/runs`. Each step receives the file itself when its + model reads that type, and otherwise its text (OCR, extraction or transcript), made once for the + steps that need it; a type nothing reads or converts is passed on as a file only. `input` carries a + `# filename` heading per file. - After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, - then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + Earlier versions accept only these extensions: avi, bmp, csv, docx, epub, flac, gif, html, jpg, + json, m4a, markdown, md, mov, mp3, mp4, msg, ogg, pdf, png, ppt, pptx, svg, tiff, txt, wav, webp, + xls, xlsx, xml, zip. They write each file's text into `input`, so poll `GET + /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready` before running. - **Multi-modal routing:** non-text uploads (image, audio, video, PDF) are surfaced natively to multi- - modal-capable prompt steps; text-only models fall back to the OCR / transcript text counterpart. - Audio originals are preserved past transcription so audio-capable models (Gemini 2.5/3, GPT-5 audio) - read them directly; the agent-input-binary janitor sweeps originals once they pass your account's - agent-trace retention (the agent-traces source's retention period; free default 7 days). + The agent-input-binary janitor sweeps originals once they pass your account's agent-trace retention + (the agent-traces source's retention period; free default 7 days). Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's @@ -200,25 +198,24 @@ async def asyncio_detailed( ]: """Upload file input - Upload a file to use as input for a `dynamic_input` agent run. - - Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. - Text and document files are processed synchronously; audio/video are submitted for asynchronous - transcription. + Upload a file to use as input for a `dynamic_input` agent run. Any other agent rejects the upload + with HTTP 400. **Size limit:** 200 MB per file. - **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, - zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + From `Seclai-Version: 2026-10-16` a file of any type is accepted and is `ready` at once: pass + `input_upload_id` to `POST /agents/{agent_id}/runs`. Each step receives the file itself when its + model reads that type, and otherwise its text (OCR, extraction or transcript), made once for the + steps that need it; a type nothing reads or converts is passed on as a file only. `input` carries a + `# filename` heading per file. - After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, - then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + Earlier versions accept only these extensions: avi, bmp, csv, docx, epub, flac, gif, html, jpg, + json, m4a, markdown, md, mov, mp3, mp4, msg, ogg, pdf, png, ppt, pptx, svg, tiff, txt, wav, webp, + xls, xlsx, xml, zip. They write each file's text into `input`, so poll `GET + /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready` before running. - **Multi-modal routing:** non-text uploads (image, audio, video, PDF) are surfaced natively to multi- - modal-capable prompt steps; text-only models fall back to the OCR / transcript text counterpart. - Audio originals are preserved past transcription so audio-capable models (Gemini 2.5/3, GPT-5 audio) - read them directly; the agent-input-binary janitor sweeps originals once they pass your account's - agent-trace retention (the agent-traces source's retention period; free default 7 days). + The agent-input-binary janitor sweeps originals once they pass your account's agent-trace retention + (the agent-traces source's retention period; free default 7 days). Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's @@ -257,25 +254,24 @@ async def asyncio( ) -> HTTPValidationError | ServiceUnavailableError | UploadAgentInputApiResponse | None: """Upload file input - Upload a file to use as input for a `dynamic_input` agent run. - - Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. - Text and document files are processed synchronously; audio/video are submitted for asynchronous - transcription. + Upload a file to use as input for a `dynamic_input` agent run. Any other agent rejects the upload + with HTTP 400. **Size limit:** 200 MB per file. - **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, - zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + From `Seclai-Version: 2026-10-16` a file of any type is accepted and is `ready` at once: pass + `input_upload_id` to `POST /agents/{agent_id}/runs`. Each step receives the file itself when its + model reads that type, and otherwise its text (OCR, extraction or transcript), made once for the + steps that need it; a type nothing reads or converts is passed on as a file only. `input` carries a + `# filename` heading per file. - After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, - then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + Earlier versions accept only these extensions: avi, bmp, csv, docx, epub, flac, gif, html, jpg, + json, m4a, markdown, md, mov, mp3, mp4, msg, ogg, pdf, png, ppt, pptx, svg, tiff, txt, wav, webp, + xls, xlsx, xml, zip. They write each file's text into `input`, so poll `GET + /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready` before running. - **Multi-modal routing:** non-text uploads (image, audio, video, PDF) are surfaced natively to multi- - modal-capable prompt steps; text-only models fall back to the OCR / transcript text counterpart. - Audio originals are preserved past transcription so audio-capable models (Gemini 2.5/3, GPT-5 audio) - read them directly; the agent-input-binary janitor sweeps originals once they pass your account's - agent-trace retention (the agent-traces source's retention period; free default 7 days). + The agent-input-binary janitor sweeps originals once they pass your account's agent-trace retention + (the agent-traces source's retention period; free default 7 days). Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's diff --git a/seclai/_generated/api/agents/create_agent_api_agents_post.py b/seclai/_generated/api/agents/create_agent_api_agents_post.py index 88f706c..1cd3705 100644 --- a/seclai/_generated/api/agents/create_agent_api_agents_post.py +++ b/seclai/_generated/api/agents/create_agent_api_agents_post.py @@ -113,7 +113,8 @@ def sync_detailed( - `schedule`: triggered on a schedule - `new_content`: triggered when new content arrives - `email_received`: a virtual email inbox; runs when mail arrives at the agent's address. Configure - the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`. + the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`, using the + `trigger_id` this response returns. Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, `content_change_notifier`, `scheduled_report`, `webhook_pipeline` @@ -178,7 +179,8 @@ def sync( - `schedule`: triggered on a schedule - `new_content`: triggered when new content arrives - `email_received`: a virtual email inbox; runs when mail arrives at the agent's address. Configure - the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`. + the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`, using the + `trigger_id` this response returns. Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, `content_change_notifier`, `scheduled_report`, `webhook_pipeline` @@ -237,7 +239,8 @@ async def asyncio_detailed( - `schedule`: triggered on a schedule - `new_content`: triggered when new content arrives - `email_received`: a virtual email inbox; runs when mail arrives at the agent's address. Configure - the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`. + the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`, using the + `trigger_id` this response returns. Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, `content_change_notifier`, `scheduled_report`, `webhook_pipeline` @@ -300,7 +303,8 @@ async def asyncio( - `schedule`: triggered on a schedule - `new_content`: triggered when new content arrives - `email_received`: a virtual email inbox; runs when mail arrives at the agent's address. Configure - the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`. + the alias/allowlist with `PUT /agents/{agent_id}/triggers/{trigger_id}/email-config`, using the + `trigger_id` this response returns. Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, `content_change_notifier`, `scheduled_report`, `webhook_pipeline` diff --git a/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py b/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py index f01bd90..035caac 100644 --- a/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py +++ b/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py @@ -124,7 +124,7 @@ def sync_detailed( - `input`: text input for agents with a `dynamic_input` trigger. - `input_upload_id` / `input_upload_ids`: reference one or more files previously uploaded via `POST /agents/{agent_id}/upload-input`. Send them **with** `input` to pair prompt text with the files (the - text leads, each file's extracted text follows); only the two upload fields are mutually exclusive + text leads, each file follows under its heading); only the two upload fields are mutually exclusive with each other. - `priority`: set true for latency-sensitive, user-facing work. For agents with a `streaming_result` step, set `priority=true` to enable real-time token streaming; otherwise the run still proceeds, but @@ -197,7 +197,7 @@ def sync( - `input`: text input for agents with a `dynamic_input` trigger. - `input_upload_id` / `input_upload_ids`: reference one or more files previously uploaded via `POST /agents/{agent_id}/upload-input`. Send them **with** `input` to pair prompt text with the files (the - text leads, each file's extracted text follows); only the two upload fields are mutually exclusive + text leads, each file follows under its heading); only the two upload fields are mutually exclusive with each other. - `priority`: set true for latency-sensitive, user-facing work. For agents with a `streaming_result` step, set `priority=true` to enable real-time token streaming; otherwise the run still proceeds, but @@ -264,7 +264,7 @@ async def asyncio_detailed( - `input`: text input for agents with a `dynamic_input` trigger. - `input_upload_id` / `input_upload_ids`: reference one or more files previously uploaded via `POST /agents/{agent_id}/upload-input`. Send them **with** `input` to pair prompt text with the files (the - text leads, each file's extracted text follows); only the two upload fields are mutually exclusive + text leads, each file follows under its heading); only the two upload fields are mutually exclusive with each other. - `priority`: set true for latency-sensitive, user-facing work. For agents with a `streaming_result` step, set `priority=true` to enable real-time token streaming; otherwise the run still proceeds, but @@ -335,7 +335,7 @@ async def asyncio( - `input`: text input for agents with a `dynamic_input` trigger. - `input_upload_id` / `input_upload_ids`: reference one or more files previously uploaded via `POST /agents/{agent_id}/upload-input`. Send them **with** `input` to pair prompt text with the files (the - text leads, each file's extracted text follows); only the two upload fields are mutually exclusive + text leads, each file follows under its heading); only the two upload fields are mutually exclusive with each other. - `priority`: set true for latency-sensitive, user-facing work. For agents with a `streaming_result` step, set `priority=true` to enable real-time token streaming; otherwise the run still proceeds, but diff --git a/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py b/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py index c9582ba..4935f05 100644 --- a/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py +++ b/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py @@ -111,6 +111,9 @@ def sync_detailed( - Subsequent events are forwarded from the run event stream (status changes, step events, etc). - If the agent contains a `streaming_result` step, `stream_token` events deliver individual LLM tokens (with a `token` field) and a `stream_end` event signals completion. + - With `include_reasoning=true`, `stream_reasoning` events (with a `text` field) carry the model's + reasoning while it thinks, when the `streaming_result` step's author enabled `show_reasoning`. + Reasoning is never part of `output`. - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). @@ -188,6 +191,9 @@ def sync( - Subsequent events are forwarded from the run event stream (status changes, step events, etc). - If the agent contains a `streaming_result` step, `stream_token` events deliver individual LLM tokens (with a `token` field) and a `stream_end` event signals completion. + - With `include_reasoning=true`, `stream_reasoning` events (with a `text` field) carry the model's + reasoning while it thinks, when the `streaming_result` step's author enabled `show_reasoning`. + Reasoning is never part of `output`. - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). @@ -256,6 +262,9 @@ async def asyncio_detailed( - Subsequent events are forwarded from the run event stream (status changes, step events, etc). - If the agent contains a `streaming_result` step, `stream_token` events deliver individual LLM tokens (with a `token` field) and a `stream_end` event signals completion. + - With `include_reasoning=true`, `stream_reasoning` events (with a `text` field) carry the model's + reasoning while it thinks, when the `streaming_result` step's author enabled `show_reasoning`. + Reasoning is never part of `output`. - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). @@ -331,6 +340,9 @@ async def asyncio( - Subsequent events are forwarded from the run event stream (status changes, step events, etc). - If the agent contains a `streaming_result` step, `stream_token` events deliver individual LLM tokens (with a `token` field) and a `stream_end` event signals completion. + - With `include_reasoning=true`, `stream_reasoning` events (with a `text` field) carry the model's + reasoning while it thinks, when the `streaming_result` step's author enabled `show_reasoning`. + Reasoning is never part of `output`. - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). diff --git a/seclai/_generated/api/agents/set_accepted_attachments_api_api_agents_agent_id_triggers_trigger_id_accepted_attachments_put.py b/seclai/_generated/api/agents/set_accepted_attachments_api_api_agents_agent_id_triggers_trigger_id_accepted_attachments_put.py new file mode 100644 index 0000000..2ff1eba --- /dev/null +++ b/seclai/_generated/api/agents/set_accepted_attachments_api_api_agents_agent_id_triggers_trigger_id_accepted_attachments_put.py @@ -0,0 +1,272 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.accepted_attachments_response import AcceptedAttachmentsResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.service_unavailable_error import ServiceUnavailableError +from ...models.set_accepted_attachments_request import SetAcceptedAttachmentsRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + trigger_id: str, + *, + body: SetAcceptedAttachmentsRequest, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + if not isinstance(seclai_version, Unset): + headers["Seclai-Version"] = seclai_version + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/agents/{agent_id}/triggers/{trigger_id}/accepted-attachments".format( + agent_id=quote(str(agent_id), safe=""), + trigger_id=quote(str(trigger_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError | None: + if response.status_code == 200: + response_200 = AcceptedAttachmentsResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if response.status_code == 503: + response_503 = ServiceUnavailableError.from_dict(response.json()) + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + trigger_id: str, + *, + client: AuthenticatedClient | Client, + body: SetAcceptedAttachmentsRequest, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError +]: + """Declare the input attachments a trigger accepts + + Replace the input attachments a trigger accepts. A run's files are each assigned to one declared + attachment before any step runs; steps reference one as ``{{agent.attachments.}}``. Rejected + with HTTP 400 when the agent references an attachment the new declaration leaves out. `trigger_id` + is the one `GET /agents/{agent_id}` returns. + + Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an + agent in the key's account. + + Args: + agent_id (str): + trigger_id (str): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + body (SetAcceptedAttachmentsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + trigger_id=trigger_id, + body=body, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + trigger_id: str, + *, + client: AuthenticatedClient | Client, + body: SetAcceptedAttachmentsRequest, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError | None: + """Declare the input attachments a trigger accepts + + Replace the input attachments a trigger accepts. A run's files are each assigned to one declared + attachment before any step runs; steps reference one as ``{{agent.attachments.}}``. Rejected + with HTTP 400 when the agent references an attachment the new declaration leaves out. `trigger_id` + is the one `GET /agents/{agent_id}` returns. + + Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an + agent in the key's account. + + Args: + agent_id (str): + trigger_id (str): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + body (SetAcceptedAttachmentsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError + """ + + return sync_detailed( + agent_id=agent_id, + trigger_id=trigger_id, + client=client, + body=body, + x_account_id=x_account_id, + seclai_version=seclai_version, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + trigger_id: str, + *, + client: AuthenticatedClient | Client, + body: SetAcceptedAttachmentsRequest, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError +]: + """Declare the input attachments a trigger accepts + + Replace the input attachments a trigger accepts. A run's files are each assigned to one declared + attachment before any step runs; steps reference one as ``{{agent.attachments.}}``. Rejected + with HTTP 400 when the agent references an attachment the new declaration leaves out. `trigger_id` + is the one `GET /agents/{agent_id}` returns. + + Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an + agent in the key's account. + + Args: + agent_id (str): + trigger_id (str): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + body (SetAcceptedAttachmentsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + trigger_id=trigger_id, + body=body, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + trigger_id: str, + *, + client: AuthenticatedClient | Client, + body: SetAcceptedAttachmentsRequest, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError | None: + """Declare the input attachments a trigger accepts + + Replace the input attachments a trigger accepts. A run's files are each assigned to one declared + attachment before any step runs; steps reference one as ``{{agent.attachments.}}``. Rejected + with HTTP 400 when the agent references an attachment the new declaration leaves out. `trigger_id` + is the one `GET /agents/{agent_id}` returns. + + Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an + agent in the key's account. + + Args: + agent_id (str): + trigger_id (str): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + body (SetAcceptedAttachmentsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AcceptedAttachmentsResponse | HTTPValidationError | ServiceUnavailableError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + trigger_id=trigger_id, + client=client, + body=body, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + ).parsed diff --git a/seclai/_generated/api/agents/set_email_trigger_config_api_api_agents_agent_id_triggers_trigger_id_email_config_put.py b/seclai/_generated/api/agents/set_email_trigger_config_api_api_agents_agent_id_triggers_trigger_id_email_config_put.py index 5ec9910..0d88642 100644 --- a/seclai/_generated/api/agents/set_email_trigger_config_api_api_agents_agent_id_triggers_trigger_id_email_config_put.py +++ b/seclai/_generated/api/agents/set_email_trigger_config_api_api_agents_agent_id_triggers_trigger_id_email_config_put.py @@ -96,8 +96,9 @@ def sync_detailed( """Configure an EMAIL_RECEIVED trigger Set the custom alias, sender allowlist, and inbound-handling flags (`ignore_auto_generated`, - `require_sender_auth`, `queue_on_quota`) on an agent's EMAIL_RECEIVED trigger, and return its - computed email address(es). Omitted fields are left unchanged. + `require_sender_auth`, `queue_on_quota`, `run_on_attachment_mismatch`) on an agent's EMAIL_RECEIVED + trigger, and return its computed email address(es). `trigger_id` is the one `GET /agents/{agent_id}` + returns. Omitted fields are left unchanged. Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account. @@ -148,8 +149,9 @@ def sync( """Configure an EMAIL_RECEIVED trigger Set the custom alias, sender allowlist, and inbound-handling flags (`ignore_auto_generated`, - `require_sender_auth`, `queue_on_quota`) on an agent's EMAIL_RECEIVED trigger, and return its - computed email address(es). Omitted fields are left unchanged. + `require_sender_auth`, `queue_on_quota`, `run_on_attachment_mismatch`) on an agent's EMAIL_RECEIVED + trigger, and return its computed email address(es). `trigger_id` is the one `GET /agents/{agent_id}` + returns. Omitted fields are left unchanged. Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account. @@ -197,8 +199,9 @@ async def asyncio_detailed( """Configure an EMAIL_RECEIVED trigger Set the custom alias, sender allowlist, and inbound-handling flags (`ignore_auto_generated`, - `require_sender_auth`, `queue_on_quota`) on an agent's EMAIL_RECEIVED trigger, and return its - computed email address(es). Omitted fields are left unchanged. + `require_sender_auth`, `queue_on_quota`, `run_on_attachment_mismatch`) on an agent's EMAIL_RECEIVED + trigger, and return its computed email address(es). `trigger_id` is the one `GET /agents/{agent_id}` + returns. Omitted fields are left unchanged. Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account. @@ -247,8 +250,9 @@ async def asyncio( """Configure an EMAIL_RECEIVED trigger Set the custom alias, sender allowlist, and inbound-handling flags (`ignore_auto_generated`, - `require_sender_auth`, `queue_on_quota`) on an agent's EMAIL_RECEIVED trigger, and return its - computed email address(es). Omitted fields are left unchanged. + `require_sender_auth`, `queue_on_quota`, `run_on_attachment_mismatch`) on an agent's EMAIL_RECEIVED + trigger, and return its computed email address(es). `trigger_id` is the one `GET /agents/{agent_id}` + returns. Omitted fields are left unchanged. Auth & scoping: requires `X-API-Key` header or OAuth Bearer token; the trigger must belong to an agent in the key's account. diff --git a/seclai/_generated/api/contents/get_content_attachment_api_contents_source_connection_content_version_attachments_attachment_id_get.py b/seclai/_generated/api/contents/get_content_attachment_api_contents_source_connection_content_version_attachments_attachment_id_get.py new file mode 100644 index 0000000..a3f8787 --- /dev/null +++ b/seclai/_generated/api/contents/get_content_attachment_api_contents_source_connection_content_version_attachments_attachment_id_get.py @@ -0,0 +1,330 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.content_attachment_detail_response import ContentAttachmentDetailResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.service_unavailable_error import ServiceUnavailableError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + start: int | Unset = 0, + end: int | Unset = 5000, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + if not isinstance(seclai_version, Unset): + headers["Seclai-Version"] = seclai_version + + params: dict[str, Any] = {} + + params["start"] = start + + params["end"] = end + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/contents/{source_connection_content_version}/attachments/{attachment_id}".format( + source_connection_content_version=quote( + str(source_connection_content_version), safe="" + ), + attachment_id=quote(str(attachment_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + Any + | ContentAttachmentDetailResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + if response.status_code == 200: + response_200 = ContentAttachmentDetailResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 402: + response_402 = cast(Any, None) + return response_402 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if response.status_code == 503: + response_503 = ServiceUnavailableError.from_dict(response.json()) + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + Any + | ContentAttachmentDetailResponse + | HTTPValidationError + | ServiceUnavailableError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + start: int | Unset = 0, + end: int | Unset = 5000, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + Any + | ContentAttachmentDetailResponse + | HTTPValidationError + | ServiceUnavailableError +]: + """Get a content attachment + + Get one file attached to a content item: its indexing status and reason, its metadata, and the text + it is indexed by. + + `attachment_id` is the `id` of an entry in the item's attachment list. Use `start` and `end` to page + through long text. A file that was not indexed has no text. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + start (int | Unset): Default: 0. + end (int | Unset): Default: 5000. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | ContentAttachmentDetailResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + start=start, + end=end, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + start: int | Unset = 0, + end: int | Unset = 5000, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + Any + | ContentAttachmentDetailResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """Get a content attachment + + Get one file attached to a content item: its indexing status and reason, its metadata, and the text + it is indexed by. + + `attachment_id` is the `id` of an entry in the item's attachment list. Use `start` and `end` to page + through long text. A file that was not indexed has no text. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + start (int | Unset): Default: 0. + end (int | Unset): Default: 5000. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | ContentAttachmentDetailResponse | HTTPValidationError | ServiceUnavailableError + """ + + return sync_detailed( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + client=client, + start=start, + end=end, + x_account_id=x_account_id, + seclai_version=seclai_version, + ).parsed + + +async def asyncio_detailed( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + start: int | Unset = 0, + end: int | Unset = 5000, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + Any + | ContentAttachmentDetailResponse + | HTTPValidationError + | ServiceUnavailableError +]: + """Get a content attachment + + Get one file attached to a content item: its indexing status and reason, its metadata, and the text + it is indexed by. + + `attachment_id` is the `id` of an entry in the item's attachment list. Use `start` and `end` to page + through long text. A file that was not indexed has no text. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + start (int | Unset): Default: 0. + end (int | Unset): Default: 5000. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | ContentAttachmentDetailResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + start=start, + end=end, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + start: int | Unset = 0, + end: int | Unset = 5000, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + Any + | ContentAttachmentDetailResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """Get a content attachment + + Get one file attached to a content item: its indexing status and reason, its metadata, and the text + it is indexed by. + + `attachment_id` is the `id` of an entry in the item's attachment list. Use `start` and `end` to page + through long text. A file that was not indexed has no text. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + start (int | Unset): Default: 0. + end (int | Unset): Default: 5000. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | ContentAttachmentDetailResponse | HTTPValidationError | ServiceUnavailableError + """ + + return ( + await asyncio_detailed( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + client=client, + start=start, + end=end, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + ).parsed diff --git a/seclai/_generated/api/contents/get_content_attachment_file_api_contents_source_connection_content_version_attachments_attachment_id_file_get.py b/seclai/_generated/api/contents/get_content_attachment_file_api_contents_source_connection_content_version_attachments_attachment_id_file_get.py new file mode 100644 index 0000000..6c1016b --- /dev/null +++ b/seclai/_generated/api/contents/get_content_attachment_file_api_contents_source_connection_content_version_attachments_attachment_id_file_get.py @@ -0,0 +1,278 @@ +from http import HTTPStatus +from io import BytesIO +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.service_unavailable_error import ServiceUnavailableError +from ...types import UNSET, File, Response, Unset + + +def _get_kwargs( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + if not isinstance(seclai_version, Unset): + headers["Seclai-Version"] = seclai_version + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/contents/{source_connection_content_version}/attachments/{attachment_id}/file".format( + source_connection_content_version=quote( + str(source_connection_content_version), safe="" + ), + attachment_id=quote(str(attachment_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | File | HTTPValidationError | ServiceUnavailableError | None: + if response.status_code == 200: + response_200 = File(payload=BytesIO(response.content)) + + return response_200 + + if response.status_code == 402: + response_402 = cast(Any, None) + return response_402 + + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if response.status_code == 503: + response_503 = ServiceUnavailableError.from_dict(response.json()) + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | File | HTTPValidationError | ServiceUnavailableError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[Any | File | HTTPValidationError | ServiceUnavailableError]: + """Download a content attachment + + Download an attached file's bytes. + + Images, audio, video, PDF and plain text are served with their own type; an SVG that cannot be + sanitized, and anything else, is served as `application/octet-stream`. + + Answers 403 when the file is withheld: a governance policy blocked or redacted it, or it arrived + from outside and is still being indexed. The attachment's `file_withheld` field says which before + you ask. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | File | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Any | File | HTTPValidationError | ServiceUnavailableError | None: + """Download a content attachment + + Download an attached file's bytes. + + Images, audio, video, PDF and plain text are served with their own type; an SVG that cannot be + sanitized, and anything else, is served as `application/octet-stream`. + + Answers 403 when the file is withheld: a governance policy blocked or redacted it, or it arrived + from outside and is still being indexed. The attachment's `file_withheld` field says which before + you ask. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | File | HTTPValidationError | ServiceUnavailableError + """ + + return sync_detailed( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + client=client, + x_account_id=x_account_id, + seclai_version=seclai_version, + ).parsed + + +async def asyncio_detailed( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[Any | File | HTTPValidationError | ServiceUnavailableError]: + """Download a content attachment + + Download an attached file's bytes. + + Images, audio, video, PDF and plain text are served with their own type; an SVG that cannot be + sanitized, and anything else, is served as `application/octet-stream`. + + Answers 403 when the file is withheld: a governance policy blocked or redacted it, or it arrived + from outside and is still being indexed. The attachment's `file_withheld` field says which before + you ask. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | File | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Any | File | HTTPValidationError | ServiceUnavailableError | None: + """Download a content attachment + + Download an attached file's bytes. + + Images, audio, video, PDF and plain text are served with their own type; an SVG that cannot be + sanitized, and anything else, is served as `application/octet-stream`. + + Answers 403 when the file is withheld: a governance policy blocked or redacted it, or it arrived + from outside and is still being indexed. The attachment's `file_withheld` field says which before + you ask. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | File | HTTPValidationError | ServiceUnavailableError + """ + + return ( + await asyncio_detailed( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + client=client, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + ).parsed diff --git a/seclai/_generated/api/contents/list_content_attachment_embeddings_api_contents_source_connection_content_version_attachments_attachment_id_embeddings_get.py b/seclai/_generated/api/contents/list_content_attachment_embeddings_api_contents_source_connection_content_version_attachments_attachment_id_embeddings_get.py new file mode 100644 index 0000000..9ff7a4f --- /dev/null +++ b/seclai/_generated/api/contents/list_content_attachment_embeddings_api_contents_source_connection_content_version_attachments_attachment_id_embeddings_get.py @@ -0,0 +1,309 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.content_embeddings_list_response import ContentEmbeddingsListResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.service_unavailable_error import ServiceUnavailableError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + if not isinstance(seclai_version, Unset): + headers["Seclai-Version"] = seclai_version + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/contents/{source_connection_content_version}/attachments/{attachment_id}/embeddings".format( + source_connection_content_version=quote( + str(source_connection_content_version), safe="" + ), + attachment_id=quote(str(attachment_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + Any + | ContentEmbeddingsListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + if response.status_code == 200: + response_200 = ContentEmbeddingsListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 402: + response_402 = cast(Any, None) + return response_402 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if response.status_code == 503: + response_503 = ServiceUnavailableError.from_dict(response.json()) + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError +]: + """List a content attachment's embeddings + + List the embeddings (chunk vectors) an attached file is indexed by, with pagination. The list is + empty for a file that has no completed index. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + Any + | ContentEmbeddingsListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """List a content attachment's embeddings + + List the embeddings (chunk vectors) an attached file is indexed by, with pagination. The list is + empty for a file that has no completed index. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError + """ + + return sync_detailed( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ).parsed + + +async def asyncio_detailed( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError +]: + """List a content attachment's embeddings + + List the embeddings (chunk vectors) an attached file is indexed by, with pagination. The list is + empty for a file that has no completed index. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_content_version: UUID, + attachment_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + Any + | ContentEmbeddingsListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """List a content attachment's embeddings + + List the embeddings (chunk vectors) an attached file is indexed by, with pagination. The list is + empty for a file that has no completed index. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (UUID): + attachment_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | ContentEmbeddingsListResponse | HTTPValidationError | ServiceUnavailableError + """ + + return ( + await asyncio_detailed( + source_connection_content_version=source_connection_content_version, + attachment_id=attachment_id, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + ).parsed diff --git a/seclai/_generated/api/contents/list_content_attachments_api_contents_source_connection_content_version_attachments_get.py b/seclai/_generated/api/contents/list_content_attachments_api_contents_source_connection_content_version_attachments_get.py new file mode 100644 index 0000000..db2ff6e --- /dev/null +++ b/seclai/_generated/api/contents/list_content_attachments_api_contents_source_connection_content_version_attachments_get.py @@ -0,0 +1,312 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.content_attachments_list_response import ContentAttachmentsListResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.service_unavailable_error import ServiceUnavailableError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_content_version: str, + *, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + if not isinstance(seclai_version, Unset): + headers["Seclai-Version"] = seclai_version + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/contents/{source_connection_content_version}/attachments".format( + source_connection_content_version=quote( + str(source_connection_content_version), safe="" + ), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + ContentAttachmentsListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + if response.status_code == 200: + response_200 = ContentAttachmentsListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if response.status_code == 503: + response_503 = ServiceUnavailableError.from_dict(response.json()) + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError +]: + """List content attachments + + List the files attached to a content item, with pagination. + + An agent's `write_content_attachment` step attaches a file, and an email content source attaches the + files sent with a message. An RSS source attaches the kinds of feed file chosen in its + `feed_attachments`. The images and video in a web page's main content are attached on a source with + media indexing on. The images inside a PDF, DOCX, PPTX or XLSX item or attachment are attached too, + on a source that indexes document images. Each entry says whether the file is indexed for search + and, when indexing failed, why. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + ContentAttachmentsListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """List content attachments + + List the files attached to a content item, with pagination. + + An agent's `write_content_attachment` step attaches a file, and an email content source attaches the + files sent with a message. An RSS source attaches the kinds of feed file chosen in its + `feed_attachments`. The images and video in a web page's main content are attached on a source with + media indexing on. The images inside a PDF, DOCX, PPTX or XLSX item or attachment are attached too, + on a source that indexes document images. Each entry says whether the file is indexed for search + and, when indexing failed, why. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError + """ + + return sync_detailed( + source_connection_content_version=source_connection_content_version, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ).parsed + + +async def asyncio_detailed( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError +]: + """List content attachments + + List the files attached to a content item, with pagination. + + An agent's `write_content_attachment` step attaches a file, and an email content source attaches the + files sent with a message. An RSS source attaches the kinds of feed file chosen in its + `feed_attachments`. The images and video in a web page's main content are attached on a source with + media indexing on. The images inside a PDF, DOCX, PPTX or XLSX item or attachment are attached too, + on a source that indexes document images. Each entry says whether the file is indexed for search + and, when indexing failed, why. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + ContentAttachmentsListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """List content attachments + + List the files attached to a content item, with pagination. + + An agent's `write_content_attachment` step attaches a file, and an email content source attaches the + files sent with a message. An RSS source attaches the kinds of feed file chosen in its + `feed_attachments`. The images and video in a web page's main content are attached on a source with + media indexing on. The images inside a PDF, DOCX, PPTX or XLSX item or attachment are attached too, + on a source that indexes document images. Each entry says whether the file is indexed for search + and, when indexing failed, why. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access attachments of content + belonging to your account. + + Args: + source_connection_content_version (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ContentAttachmentsListResponse | HTTPValidationError | ServiceUnavailableError + """ + + return ( + await asyncio_detailed( + source_connection_content_version=source_connection_content_version, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + ).parsed diff --git a/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py b/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py index cd8a7ef..4228709 100644 --- a/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py +++ b/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py @@ -103,22 +103,31 @@ def sync_detailed( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -126,14 +135,43 @@ def sync_detailed( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -202,22 +240,31 @@ def sync( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -225,14 +272,43 @@ def sync( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -296,22 +372,31 @@ async def asyncio_detailed( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -319,14 +404,43 @@ async def asyncio_detailed( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -393,22 +507,31 @@ async def asyncio( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -416,14 +539,43 @@ async def asyncio( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: diff --git a/seclai/_generated/api/models/cancel_experiment_endpoint_api_models_playground_experiments_experiment_id_cancel_post.py b/seclai/_generated/api/models/cancel_experiment_endpoint_api_models_playground_experiments_experiment_id_cancel_post.py index fc7efb5..1bee2e0 100644 --- a/seclai/_generated/api/models/cancel_experiment_endpoint_api_models_playground_experiments_experiment_id_cancel_post.py +++ b/seclai/_generated/api/models/cancel_experiment_endpoint_api_models_playground_experiments_experiment_id_cancel_post.py @@ -83,7 +83,11 @@ def sync_detailed( Cancel a running or pending model playground experiment. - Signals running model calls to abort and marks the experiment as canceled. + Marks the experiment as canceled. An experiment that has not started never runs. One that is running + starts no further model calls, and records each model it did not call with the error `Canceled`. A + model call or evaluation already in progress is not interrupted by the cancel: it continues and is + billed, and its result is recorded on the canceled experiment. Canceling may therefore not shorten + the run or reduce its cost. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. The experiment must belong to the caller's @@ -126,7 +130,11 @@ def sync( Cancel a running or pending model playground experiment. - Signals running model calls to abort and marks the experiment as canceled. + Marks the experiment as canceled. An experiment that has not started never runs. One that is running + starts no further model calls, and records each model it did not call with the error `Canceled`. A + model call or evaluation already in progress is not interrupted by the cancel: it continues and is + billed, and its result is recorded on the canceled experiment. Canceling may therefore not shorten + the run or reduce its cost. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. The experiment must belong to the caller's @@ -164,7 +172,11 @@ async def asyncio_detailed( Cancel a running or pending model playground experiment. - Signals running model calls to abort and marks the experiment as canceled. + Marks the experiment as canceled. An experiment that has not started never runs. One that is running + starts no further model calls, and records each model it did not call with the error `Canceled`. A + model call or evaluation already in progress is not interrupted by the cancel: it continues and is + billed, and its result is recorded on the canceled experiment. Canceling may therefore not shorten + the run or reduce its cost. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. The experiment must belong to the caller's @@ -205,7 +217,11 @@ async def asyncio( Cancel a running or pending model playground experiment. - Signals running model calls to abort and marks the experiment as canceled. + Marks the experiment as canceled. An experiment that has not started never runs. One that is running + starts no further model calls, and records each model it did not call with the error `Canceled`. A + model call or evaluation already in progress is not interrupted by the cancel: it continues and is + billed, and its result is recorded on the canceled experiment. Canceling may therefore not shorten + the run or reduce its cost. Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. The experiment must belong to the caller's diff --git a/seclai/_generated/api/models/list_embedding_models_api_models_embedders_get.py b/seclai/_generated/api/models/list_embedding_models_api_models_embedders_get.py index 11694f3..31bcae9 100644 --- a/seclai/_generated/api/models/list_embedding_models_api_models_embedders_get.py +++ b/seclai/_generated/api/models/list_embedding_models_api_models_embedders_get.py @@ -99,8 +99,8 @@ def sync_detailed( Each entry carries the `model_type` to pass as `embedding_model` when creating a source, the `dimensions` it supports, and — most importantly for multi-modal indexing — `supported_input_media`: the modalities that embedder can actually index. A source only honours a `media_types` entry its - embedder lists here; unsupported kinds are dropped at save time with an `embedder_warning`, so check - this before choosing an embedder for a knowledge base of images or video. + embedder lists here; a kind it does not list is stored and not indexed, so check this before + choosing an embedder for a knowledge base of images or video. Text-only embedders report `supported_input_media` as null. Pricing is reported as `credits` (per ~1,000 English words of text) plus `per_modality_rates` for the non-text modalities a multi-modal @@ -158,8 +158,8 @@ def sync( Each entry carries the `model_type` to pass as `embedding_model` when creating a source, the `dimensions` it supports, and — most importantly for multi-modal indexing — `supported_input_media`: the modalities that embedder can actually index. A source only honours a `media_types` entry its - embedder lists here; unsupported kinds are dropped at save time with an `embedder_warning`, so check - this before choosing an embedder for a knowledge base of images or video. + embedder lists here; a kind it does not list is stored and not indexed, so check this before + choosing an embedder for a knowledge base of images or video. Text-only embedders report `supported_input_media` as null. Pricing is reported as `credits` (per ~1,000 English words of text) plus `per_modality_rates` for the non-text modalities a multi-modal @@ -214,8 +214,8 @@ async def asyncio_detailed( Each entry carries the `model_type` to pass as `embedding_model` when creating a source, the `dimensions` it supports, and — most importantly for multi-modal indexing — `supported_input_media`: the modalities that embedder can actually index. A source only honours a `media_types` entry its - embedder lists here; unsupported kinds are dropped at save time with an `embedder_warning`, so check - this before choosing an embedder for a knowledge base of images or video. + embedder lists here; a kind it does not list is stored and not indexed, so check this before + choosing an embedder for a knowledge base of images or video. Text-only embedders report `supported_input_media` as null. Pricing is reported as `credits` (per ~1,000 English words of text) plus `per_modality_rates` for the non-text modalities a multi-modal @@ -271,8 +271,8 @@ async def asyncio( Each entry carries the `model_type` to pass as `embedding_model` when creating a source, the `dimensions` it supports, and — most importantly for multi-modal indexing — `supported_input_media`: the modalities that embedder can actually index. A source only honours a `media_types` entry its - embedder lists here; unsupported kinds are dropped at save time with an `embedder_warning`, so check - this before choosing an embedder for a knowledge base of images or video. + embedder lists here; a kind it does not list is stored and not indexed, so check this before + choosing an embedder for a knowledge base of images or video. Text-only embedders report `supported_input_media` as null. Pricing is reported as `credits` (per ~1,000 English words of text) plus `per_modality_rates` for the non-text modalities a multi-modal diff --git a/seclai/_generated/api/sources/create_source_api_sources_post.py b/seclai/_generated/api/sources/create_source_api_sources_post.py index 79a6cd6..6ca0fa0 100644 --- a/seclai/_generated/api/sources/create_source_api_sources_post.py +++ b/seclai/_generated/api/sources/create_source_api_sources_post.py @@ -89,11 +89,17 @@ def sync_detailed( Create a new content source. - Source types: `rss`, `website`, `custom_index`. + Source types: `rss_feed`, `website`, `custom_index`, `cloud_drive`, `email`. For RSS and website sources, provide the URL. For custom index sources, the URL is created automatically. + An `email` source takes no URL and requires `email_allowed_senders`; the response's `email_address` + is where to send mail. + + A `cloud_drive` source takes no URL and requires `cloud_drive_connection_id`, the id of a drive + connected in the app (`GET /cloud-drives` lists them). + For custom_index sources, you can optionally specify an `index_mode`: `fast_and_cheap` (default), `balanced`, `slow_and_thorough`, or `custom`. The legacy `file_uploads` source type is accepted as an alias for `custom_index` with `index_mode=fast_and_cheap`. @@ -135,11 +141,17 @@ def sync( Create a new content source. - Source types: `rss`, `website`, `custom_index`. + Source types: `rss_feed`, `website`, `custom_index`, `cloud_drive`, `email`. For RSS and website sources, provide the URL. For custom index sources, the URL is created automatically. + An `email` source takes no URL and requires `email_allowed_senders`; the response's `email_address` + is where to send mail. + + A `cloud_drive` source takes no URL and requires `cloud_drive_connection_id`, the id of a drive + connected in the app (`GET /cloud-drives` lists them). + For custom_index sources, you can optionally specify an `index_mode`: `fast_and_cheap` (default), `balanced`, `slow_and_thorough`, or `custom`. The legacy `file_uploads` source type is accepted as an alias for `custom_index` with `index_mode=fast_and_cheap`. @@ -176,11 +188,17 @@ async def asyncio_detailed( Create a new content source. - Source types: `rss`, `website`, `custom_index`. + Source types: `rss_feed`, `website`, `custom_index`, `cloud_drive`, `email`. For RSS and website sources, provide the URL. For custom index sources, the URL is created automatically. + An `email` source takes no URL and requires `email_allowed_senders`; the response's `email_address` + is where to send mail. + + A `cloud_drive` source takes no URL and requires `cloud_drive_connection_id`, the id of a drive + connected in the app (`GET /cloud-drives` lists them). + For custom_index sources, you can optionally specify an `index_mode`: `fast_and_cheap` (default), `balanced`, `slow_and_thorough`, or `custom`. The legacy `file_uploads` source type is accepted as an alias for `custom_index` with `index_mode=fast_and_cheap`. @@ -220,11 +238,17 @@ async def asyncio( Create a new content source. - Source types: `rss`, `website`, `custom_index`. + Source types: `rss_feed`, `website`, `custom_index`, `cloud_drive`, `email`. For RSS and website sources, provide the URL. For custom index sources, the URL is created automatically. + An `email` source takes no URL and requires `email_allowed_senders`; the response's `email_address` + is where to send mail. + + A `cloud_drive` source takes no URL and requires `cloud_drive_connection_id`, the id of a drive + connected in the app (`GET /cloud-drives` lists them). + For custom_index sources, you can optionally specify an `index_mode`: `fast_and_cheap` (default), `balanced`, `slow_and_thorough`, or `custom`. The legacy `file_uploads` source type is accepted as an alias for `custom_index` with `index_mode=fast_and_cheap`. diff --git a/seclai/_generated/api/sources/get_source_content_status_endpoint_api_sources_source_connection_id_contents_content_version_id_get.py b/seclai/_generated/api/sources/get_source_content_status_endpoint_api_sources_source_connection_id_contents_content_version_id_get.py index 6748cc4..6c14568 100644 --- a/seclai/_generated/api/sources/get_source_content_status_endpoint_api_sources_source_connection_id_contents_content_version_id_get.py +++ b/seclai/_generated/api/sources/get_source_content_status_endpoint_api_sources_source_connection_id_contents_content_version_id_get.py @@ -95,6 +95,10 @@ def sync_detailed( /sources/{id}/contents` with repeated `content_version_id` parameters instead of polling this endpoint per item. + An item held for review by an Enforce governance policy reports `held_for_review: true`. With + `Seclai-Version: 2026-10-05` or later its `content_status` is `completed`; earlier versions report + `failed` with the hold as the `error`. + Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account. @@ -144,6 +148,10 @@ def sync( /sources/{id}/contents` with repeated `content_version_id` parameters instead of polling this endpoint per item. + An item held for review by an Enforce governance policy reports `held_for_review: true`. With + `Seclai-Version: 2026-10-05` or later its `content_status` is `completed`; earlier versions report + `failed` with the hold as the `error`. + Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account. @@ -190,6 +198,10 @@ async def asyncio_detailed( /sources/{id}/contents` with repeated `content_version_id` parameters instead of polling this endpoint per item. + An item held for review by an Enforce governance policy reports `held_for_review: true`. With + `Seclai-Version: 2026-10-05` or later its `content_status` is `completed`; earlier versions report + `failed` with the hold as the `error`. + Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account. @@ -237,6 +249,10 @@ async def asyncio( /sources/{id}/contents` with repeated `content_version_id` parameters instead of polling this endpoint per item. + An item held for review by an Enforce governance policy reports `held_for_review: true`. With + `Seclai-Version: 2026-10-05` or later its `content_status` is `completed`; earlier versions report + `failed` with the hold as the `error`. + Auth & scoping: - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your account. diff --git a/seclai/_generated/api/sources/list_email_source_rejections_api_api_sources_source_connection_id_email_rejections_get.py b/seclai/_generated/api/sources/list_email_source_rejections_api_api_sources_source_connection_id_email_rejections_get.py new file mode 100644 index 0000000..6409c88 --- /dev/null +++ b/seclai/_generated/api/sources/list_email_source_rejections_api_api_sources_source_connection_id_email_rejections_get.py @@ -0,0 +1,304 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.email_source_rejection_list_response import ( + EmailSourceRejectionListResponse, +) +from ...models.http_validation_error import HTTPValidationError +from ...models.service_unavailable_error import ServiceUnavailableError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + if not isinstance(seclai_version, Unset): + headers["Seclai-Version"] = seclai_version + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/sources/{source_connection_id}/email-rejections".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + EmailSourceRejectionListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + if response.status_code == 200: + response_200 = EmailSourceRejectionListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if response.status_code == 503: + response_503 = ServiceUnavailableError.from_dict(response.json()) + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError +]: + """List mail an email source refused + + List mail that an email content source refused, newest first. Each entry says who sent the message + and why it was refused, never its subject or body. A message refused as `unsafe_content` also has a + prompt-scan record, which keeps the scanned text. + + To accept a refused sender, add its `from_address` or that address's domain to the source's + `email_allowed_senders`. That only helps when `authenticated` is true. A `repeat_*` reason marks a + message the source received before; allowing its sender does not store it. + + Requires an account owner or administrator: a key or token bound to another member gets 403. Returns + 404 for a source that is not an email source. + + Args: + source_connection_id (UUID): + page (int | Unset): Page number. Default: 1. + limit (int | Unset): Items per page. Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + EmailSourceRejectionListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """List mail an email source refused + + List mail that an email content source refused, newest first. Each entry says who sent the message + and why it was refused, never its subject or body. A message refused as `unsafe_content` also has a + prompt-scan record, which keeps the scanned text. + + To accept a refused sender, add its `from_address` or that address's domain to the source's + `email_allowed_senders`. That only helps when `authenticated` is true. A `repeat_*` reason marks a + message the source received before; allowing its sender does not store it. + + Requires an account owner or administrator: a key or token bound to another member gets 403. Returns + 404 for a source that is not an email source. + + Args: + source_connection_id (UUID): + page (int | Unset): Page number. Default: 1. + limit (int | Unset): Items per page. Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> Response[ + EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError +]: + """List mail an email source refused + + List mail that an email content source refused, newest first. Each entry says who sent the message + and why it was refused, never its subject or body. A message refused as `unsafe_content` also has a + prompt-scan record, which keeps the scanned text. + + To accept a refused sender, add its `from_address` or that address's domain to the source's + `email_allowed_senders`. That only helps when `authenticated` is true. A `repeat_*` reason marks a + message the source received before; allowing its sender does not store it. + + Requires an account owner or administrator: a key or token bound to another member gets 403. Returns + 404 for a source that is not an email source. + + Args: + source_connection_id (UUID): + page (int | Unset): Page number. Default: 1. + limit (int | Unset): Items per page. Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: UUID | Unset = UNSET, + seclai_version: str | Unset = UNSET, +) -> ( + EmailSourceRejectionListResponse + | HTTPValidationError + | ServiceUnavailableError + | None +): + """List mail an email source refused + + List mail that an email content source refused, newest first. Each entry says who sent the message + and why it was refused, never its subject or body. A message refused as `unsafe_content` also has a + prompt-scan record, which keeps the scanned text. + + To accept a refused sender, add its `from_address` or that address's domain to the source's + `email_allowed_senders`. That only helps when `authenticated` is true. A `repeat_*` reason marks a + message the source received before; allowing its sender does not store it. + + Requires an account owner or administrator: a key or token bound to another member gets 403. Returns + 404 for a source that is not an email source. + + Args: + source_connection_id (UUID): + page (int | Unset): Page number. Default: 1. + limit (int | Unset): Items per page. Default: 20. + x_account_id (UUID | Unset): + seclai_version (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EmailSourceRejectionListResponse | HTTPValidationError | ServiceUnavailableError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + seclai_version=seclai_version, + ) + ).parsed diff --git a/seclai/_generated/api/sources/list_source_contents_api_sources_source_connection_id_contents_get.py b/seclai/_generated/api/sources/list_source_contents_api_sources_source_connection_id_contents_get.py index e5ad496..1d20696 100644 --- a/seclai/_generated/api/sources/list_source_contents_api_sources_source_connection_id_contents_get.py +++ b/seclai/_generated/api/sources/list_source_contents_api_sources_source_connection_id_contents_get.py @@ -150,6 +150,11 @@ def sync_detailed( the id `GET /contents/{id}` takes. - `content_status` reaches `completed` on success and `failed` on error, with the reason in `error`. The intermediate values are `pending`, `fetching`, `transcribing`, `scanning`, and `indexing`. + - An item an Enforce governance policy blocked at import is held for review: `held_for_review` is + `true` and `source_connection_content_version_id` stays `null` until a reviewer releases it. With + `Seclai-Version: 2026-10-05` or later it reports `completed`; earlier versions report it as `failed` + with the hold as the `error`. The `status` filter matches the item under `completed` on every + version. Parameters: - Pagination: `page` and `limit`. @@ -239,6 +244,11 @@ def sync( the id `GET /contents/{id}` takes. - `content_status` reaches `completed` on success and `failed` on error, with the reason in `error`. The intermediate values are `pending`, `fetching`, `transcribing`, `scanning`, and `indexing`. + - An item an Enforce governance policy blocked at import is held for review: `held_for_review` is + `true` and `source_connection_content_version_id` stays `null` until a reviewer releases it. With + `Seclai-Version: 2026-10-05` or later it reports `completed`; earlier versions report it as `failed` + with the hold as the `error`. The `status` filter matches the item under `completed` on every + version. Parameters: - Pagination: `page` and `limit`. @@ -320,6 +330,11 @@ async def asyncio_detailed( the id `GET /contents/{id}` takes. - `content_status` reaches `completed` on success and `failed` on error, with the reason in `error`. The intermediate values are `pending`, `fetching`, `transcribing`, `scanning`, and `indexing`. + - An item an Enforce governance policy blocked at import is held for review: `held_for_review` is + `true` and `source_connection_content_version_id` stays `null` until a reviewer releases it. With + `Seclai-Version: 2026-10-05` or later it reports `completed`; earlier versions report it as `failed` + with the hold as the `error`. The `status` filter matches the item under `completed` on every + version. Parameters: - Pagination: `page` and `limit`. @@ -407,6 +422,11 @@ async def asyncio( the id `GET /contents/{id}` takes. - `content_status` reaches `completed` on success and `failed` on error, with the reason in `error`. The intermediate values are `pending`, `fetching`, `transcribing`, `scanning`, and `indexing`. + - An item an Enforce governance policy blocked at import is held for review: `held_for_review` is + `true` and `source_connection_content_version_id` stays `null` until a reviewer releases it. With + `Seclai-Version: 2026-10-05` or later it reports `completed`; earlier versions report it as `failed` + with the hold as the `error`. The `status` filter matches the item under `completed` on every + version. Parameters: - Pagination: `page` and `limit`. diff --git a/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py b/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py index e818d9b..9fad008 100644 --- a/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py +++ b/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py @@ -92,22 +92,31 @@ def sync_detailed( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -115,14 +124,43 @@ def sync_detailed( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -153,6 +191,8 @@ def sync_detailed( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (str): @@ -198,22 +238,31 @@ def sync( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -221,14 +270,43 @@ def sync( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -259,6 +337,8 @@ def sync( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (str): @@ -299,22 +379,31 @@ async def asyncio_detailed( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -322,14 +411,43 @@ async def asyncio_detailed( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -360,6 +478,8 @@ async def asyncio_detailed( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (str): @@ -403,22 +523,31 @@ async def asyncio( before it is stored). **Supported MIME types:** + - `application/atom+xml` - `application/epub+zip` - `application/json` - `application/pdf` + - `application/rss+xml` + - `application/rtf` - `application/vnd.ms-excel` - `application/vnd.ms-outlook` - `application/vnd.ms-powerpoint` - `application/vnd.openxmlformats-officedocument.presentationml.presentation` - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + - `application/x-ipynb+json` + - `application/xhtml+xml` - `application/xml` - `application/zip` + - `audio/aac` + - `audio/amr` - `audio/flac` - `audio/mp4` - `audio/mpeg` - `audio/ogg` + - `audio/opus` - `audio/wav` + - `audio/webm` - `image/bmp` - `image/gif` - `image/jpeg` @@ -426,14 +555,43 @@ async def asyncio( - `image/svg+xml` - `image/tiff` - `image/webp` + - `message/rfc822` + - `text/calendar` - `text/csv` - `text/html` + - `text/javascript` - `text/markdown` - `text/plain` + - `text/tab-separated-values` + - `text/vcard` + - `text/vtt` + - `text/x-c` + - `text/x-c++` + - `text/x-csharp` + - `text/x-go` + - `text/x-ini` + - `text/x-java` + - `text/x-log` - `text/x-markdown` + - `text/x-php` + - `text/x-python` + - `text/x-ruby` + - `text/x-rust` + - `text/x-shellscript` + - `text/x-sql` + - `text/x-subrip` + - `text/x-tex` + - `text/x-toml` + - `text/x-typescript` - `text/xml` + - `text/yaml` + - `video/3gpp` + - `video/mp2t` - `video/mp4` + - `video/mpeg` - `video/quicktime` + - `video/webm` + - `video/x-matroska` - `video/x-msvideo` Notes: @@ -464,6 +622,8 @@ async def asyncio( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (str): diff --git a/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py b/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py index 67220e5..4bbf625 100644 --- a/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py +++ b/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py @@ -118,6 +118,8 @@ def sync_detailed( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (UUID): @@ -189,6 +191,8 @@ def sync( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (UUID): @@ -255,6 +259,8 @@ async def asyncio_detailed( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (UUID): @@ -324,6 +330,8 @@ async def asyncio( a whole batch, to follow each item through to `completed` or `failed`. - On those status endpoints `source_connection_content_version_id` stays `null` until the item finishes indexing; that is the id `GET /contents/{id}` takes. + - An item that reports `held_for_review: true` was blocked by an Enforce governance policy. It is + not in the source and its id stays `null` unless a reviewer releases it, so stop polling. Args: source_connection_id (UUID): diff --git a/seclai/_generated/models/__init__.py b/seclai/_generated/models/__init__.py index 055d8a9..64fbf20 100644 --- a/seclai/_generated/models/__init__.py +++ b/seclai/_generated/models/__init__.py @@ -1,5 +1,7 @@ """Contains all the data models used in inputs/outputs""" +from .accepted_attachment_slot import AcceptedAttachmentSlot +from .accepted_attachments_response import AcceptedAttachmentsResponse from .add_comment_request import AddCommentRequest from .add_conversation_turn_request import AddConversationTurnRequest from .add_conversation_turn_request_actions_taken_type_0 import ( @@ -108,6 +110,13 @@ from .compaction_test_response_model import CompactionTestResponseModel from .compatible_run_list_response import CompatibleRunListResponse from .compatible_run_response import CompatibleRunResponse +from .content_attachment_detail_response import ContentAttachmentDetailResponse +from .content_attachment_detail_response_metadata import ( + ContentAttachmentDetailResponseMetadata, +) +from .content_attachment_response import ContentAttachmentResponse +from .content_attachment_response_metadata import ContentAttachmentResponseMetadata +from .content_attachments_list_response import ContentAttachmentsListResponse from .content_detail_response import ContentDetailResponse from .content_detail_response_metadata_type_0_item import ( ContentDetailResponseMetadataType0Item, @@ -151,6 +160,11 @@ from .effort_options_response import EffortOptionsResponse from .email_domain_response import EmailDomainResponse from .email_domains_list_response import EmailDomainsListResponse +from .email_source_rejection_list_response import EmailSourceRejectionListResponse +from .email_source_rejection_response import EmailSourceRejectionResponse +from .email_source_rejection_response_auth_verdicts import ( + EmailSourceRejectionResponseAuthVerdicts, +) from .email_trigger_config_response import EmailTriggerConfigResponse from .embedding_modality_rate_response import EmbeddingModalityRateResponse from .embedding_model_list_response import EmbeddingModelListResponse @@ -327,8 +341,11 @@ from .service_unavailable_error import ServiceUnavailableError from .service_unavailable_error_error import ServiceUnavailableErrorError from .service_unavailable_error_error_code import ServiceUnavailableErrorErrorCode +from .set_accepted_attachments_request import SetAcceptedAttachmentsRequest from .set_auto_block_mode_request import SetAutoBlockModeRequest from .set_email_trigger_config_request import SetEmailTriggerConfigRequest +from .skipped_attachment_reason import SkippedAttachmentReason +from .skipped_attachment_response import SkippedAttachmentResponse from .solution_agent_response import SolutionAgentResponse from .solution_conversation_response import SolutionConversationResponse from .solution_conversation_response_actions_taken_type_0 import ( @@ -392,6 +409,8 @@ from .variant_option_response import VariantOptionResponse __all__ = ( + "AcceptedAttachmentSlot", + "AcceptedAttachmentsResponse", "AddCommentRequest", "AddConversationTurnRequest", "AddConversationTurnRequestActionsTakenType0", @@ -474,6 +493,11 @@ "CompactionTestResponseModel", "CompatibleRunListResponse", "CompatibleRunResponse", + "ContentAttachmentDetailResponse", + "ContentAttachmentDetailResponseMetadata", + "ContentAttachmentResponse", + "ContentAttachmentResponseMetadata", + "ContentAttachmentsListResponse", "ContentDetailResponse", "ContentDetailResponseMetadataType0Item", "ContentEmbeddingResponse", @@ -505,6 +529,9 @@ "EffortOptionsResponse", "EmailDomainResponse", "EmailDomainsListResponse", + "EmailSourceRejectionListResponse", + "EmailSourceRejectionResponse", + "EmailSourceRejectionResponseAuthVerdicts", "EmailTriggerConfigResponse", "EmbeddingModalityRateResponse", "EmbeddingModelListResponse", @@ -625,8 +652,11 @@ "ServiceUnavailableError", "ServiceUnavailableErrorError", "ServiceUnavailableErrorErrorCode", + "SetAcceptedAttachmentsRequest", "SetAutoBlockModeRequest", "SetEmailTriggerConfigRequest", + "SkippedAttachmentReason", + "SkippedAttachmentResponse", "SolutionAgentResponse", "SolutionConversationResponse", "SolutionConversationResponseActionsTakenType0", diff --git a/seclai/_generated/models/accepted_attachment_slot.py b/seclai/_generated/models/accepted_attachment_slot.py new file mode 100644 index 0000000..61757ef --- /dev/null +++ b/seclai/_generated/models/accepted_attachment_slot.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AcceptedAttachmentSlot") + + +@_attrs_define +class AcceptedAttachmentSlot: + """ + Attributes: + name (str): Lowercase letters, digits and underscores, starting with a letter. Steps reference the files as + ``{{agent.attachments.}}``. + content_types (list[str] | Unset): Accepted types, e.g. ``application/pdf`` or ``image/*``; empty accepts any + type. + label (None | str | Unset): Shown to people. + max_ (int | None | Unset): Most files a run may include; empty is no limit. + min_ (int | Unset): Fewest files a run must include; fewer refuses the run, except on an email trigger set to + run anyway, which lists the shortfall. Default: 0. + name_pattern (None | str | Unset): Filename glob a file must also match, ignoring case. + """ + + name: str + content_types: list[str] | Unset = UNSET + label: None | str | Unset = UNSET + max_: int | None | Unset = UNSET + min_: int | Unset = 0 + name_pattern: None | str | Unset = UNSET + + def to_dict(self) -> dict[str, Any]: + name = self.name + + content_types: list[str] | Unset = UNSET + if not isinstance(self.content_types, Unset): + content_types = self.content_types + + label: None | str | Unset + if isinstance(self.label, Unset): + label = UNSET + else: + label = self.label + + max_: int | None | Unset + if isinstance(self.max_, Unset): + max_ = UNSET + else: + max_ = self.max_ + + min_ = self.min_ + + name_pattern: None | str | Unset + if isinstance(self.name_pattern, Unset): + name_pattern = UNSET + else: + name_pattern = self.name_pattern + + field_dict: dict[str, Any] = {} + + field_dict.update( + { + "name": name, + } + ) + if content_types is not UNSET: + field_dict["content_types"] = content_types + if label is not UNSET: + field_dict["label"] = label + if max_ is not UNSET: + field_dict["max"] = max_ + if min_ is not UNSET: + field_dict["min"] = min_ + if name_pattern is not UNSET: + field_dict["name_pattern"] = name_pattern + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + content_types = cast(list[str], d.pop("content_types", UNSET)) + + def _parse_label(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + label = _parse_label(d.pop("label", UNSET)) + + def _parse_max_(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_ = _parse_max_(d.pop("max", UNSET)) + + min_ = d.pop("min", UNSET) + + def _parse_name_pattern(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name_pattern = _parse_name_pattern(d.pop("name_pattern", UNSET)) + + accepted_attachment_slot = cls( + name=name, + content_types=content_types, + label=label, + max_=max_, + min_=min_, + name_pattern=name_pattern, + ) + + return accepted_attachment_slot diff --git a/seclai/_generated/models/accepted_attachments_response.py b/seclai/_generated/models/accepted_attachments_response.py new file mode 100644 index 0000000..cff7076 --- /dev/null +++ b/seclai/_generated/models/accepted_attachments_response.py @@ -0,0 +1,94 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot + + +T = TypeVar("T", bound="AcceptedAttachmentsResponse") + + +@_attrs_define +class AcceptedAttachmentsResponse: + """ + Attributes: + accepted_attachments (list[AcceptedAttachmentSlot]): + agent_id (UUID): + trigger_id (UUID): + """ + + accepted_attachments: list[AcceptedAttachmentSlot] + agent_id: UUID + trigger_id: UUID + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + accepted_attachments = [] + for accepted_attachments_item_data in self.accepted_attachments: + accepted_attachments_item = accepted_attachments_item_data.to_dict() + accepted_attachments.append(accepted_attachments_item) + + agent_id = str(self.agent_id) + + trigger_id = str(self.trigger_id) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted_attachments": accepted_attachments, + "agent_id": agent_id, + "trigger_id": trigger_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot + + d = dict(src_dict) + accepted_attachments = [] + _accepted_attachments = d.pop("accepted_attachments") + for accepted_attachments_item_data in _accepted_attachments: + accepted_attachments_item = AcceptedAttachmentSlot.from_dict( + accepted_attachments_item_data + ) + + accepted_attachments.append(accepted_attachments_item) + + agent_id = UUID(d.pop("agent_id")) + + trigger_id = UUID(d.pop("trigger_id")) + + accepted_attachments_response = cls( + accepted_attachments=accepted_attachments, + agent_id=agent_id, + trigger_id=trigger_id, + ) + + accepted_attachments_response.additional_properties = d + return accepted_attachments_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_attachment_refs_api_response.py b/seclai/_generated/models/agent_attachment_refs_api_response.py index 5df7f52..f7a9cf0 100644 --- a/seclai/_generated/models/agent_attachment_refs_api_response.py +++ b/seclai/_generated/models/agent_attachment_refs_api_response.py @@ -9,6 +9,7 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot from ..models.attachment_refs_source_api_summary import ( AttachmentRefsSourceApiSummary, ) @@ -19,27 +20,37 @@ @_attrs_define class AgentAttachmentRefsApiResponse: - """Static attachment-reference contract for an agent. + """The input attachments an agent's trigger declares. - Mirrors the MCP ``get_agent_attachment_references`` tool: returns - what files (if any) an agent's templates expect on a run so API - consumers can stage uploads correctly before calling + Mirrors the MCP ``get_agent_attachment_references`` tool, so API + consumers can stage uploads that fit before calling ``POST /agents/{id}/runs``. Attributes: - requires_uploads (bool): When ``false`` the agent's definition does NOT reference any uploaded attachments — - ``POST /agents/{id}/upload-input`` will reject with HTTP 400. When ``true`` the ``agent`` block lists the - specific selectors a run-time batch must satisfy. + requires_uploads (bool): When ``false`` the agent takes no files through the API — it has no ``dynamic_input`` + trigger, or that trigger declares no attachments — and ``POST /agents/{id}/upload-input`` will reject with HTTP + 400. When ``true`` ``accepted_attachments`` lists what a run's files must fit. + accepted_attachments (list[AcceptedAttachmentSlot] | Unset): The attachments the agent's trigger declares. A + run's files are each assigned to one; a file none accepts, or an attachment with fewer files than its ``min``, + rejects the run with HTTP 400. Steps reference one as ``{{agent.attachments.}}``. agent (AttachmentRefsSourceApiSummary | Unset): Per-source attachment-reference summary. """ requires_uploads: bool + accepted_attachments: list[AcceptedAttachmentSlot] | Unset = UNSET agent: AttachmentRefsSourceApiSummary | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: requires_uploads = self.requires_uploads + accepted_attachments: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.accepted_attachments, Unset): + accepted_attachments = [] + for accepted_attachments_item_data in self.accepted_attachments: + accepted_attachments_item = accepted_attachments_item_data.to_dict() + accepted_attachments.append(accepted_attachments_item) + agent: dict[str, Any] | Unset = UNSET if not isinstance(self.agent, Unset): agent = self.agent.to_dict() @@ -51,6 +62,8 @@ def to_dict(self) -> dict[str, Any]: "requires_uploads": requires_uploads, } ) + if accepted_attachments is not UNSET: + field_dict["accepted_attachments"] = accepted_attachments if agent is not UNSET: field_dict["agent"] = agent @@ -58,6 +71,7 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot from ..models.attachment_refs_source_api_summary import ( AttachmentRefsSourceApiSummary, ) @@ -65,6 +79,17 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) requires_uploads = d.pop("requires_uploads") + _accepted_attachments = d.pop("accepted_attachments", UNSET) + accepted_attachments: list[AcceptedAttachmentSlot] | Unset = UNSET + if _accepted_attachments is not UNSET: + accepted_attachments = [] + for accepted_attachments_item_data in _accepted_attachments: + accepted_attachments_item = AcceptedAttachmentSlot.from_dict( + accepted_attachments_item_data + ) + + accepted_attachments.append(accepted_attachments_item) + _agent = d.pop("agent", UNSET) agent: AttachmentRefsSourceApiSummary | Unset if isinstance(_agent, Unset): @@ -74,6 +99,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: agent_attachment_refs_api_response = cls( requires_uploads=requires_uploads, + accepted_attachments=accepted_attachments, agent=agent, ) diff --git a/seclai/_generated/models/agent_run_request.py b/seclai/_generated/models/agent_run_request.py index 7c11e7b..8ca3910 100644 --- a/seclai/_generated/models/agent_run_request.py +++ b/seclai/_generated/models/agent_run_request.py @@ -23,25 +23,24 @@ class AgentRunRequest: input_ (None | str | Unset): Input to provide to the agent upon running for agents with dynamic triggers. input_upload_id (None | Unset | UUID): ID of a previously uploaded file (via POST /{agent_id}/upload-input) to use as the run input for dynamic-input triggers. Mutually exclusive with ``input_upload_ids`` — use that field - to attach multiple files. May be combined with ``input``: the prompt text leads and the file's extracted text - follows under a ``# {filename}`` heading. - - **Attachment visibility:** a step only sees the upload when its template references the input — via - ``{{input}}`` / ``{{agent.input}}`` / ``{{step..input|output}}`` (implicit, all attachments) or the - ``{{attachments[…]}}`` family (explicit narrowing — e.g. ``{{attachments[0]}}``, ``{{attachments[*.pdf]}}``). - - **Per-batch validation:** every selector the agent's definition declares must be satisfied or the run is - rejected with HTTP 400. Exact-name selectors require that filename to be present; indexed selectors require at - least N+1 files; glob patterns require at least one matching filename. - input_upload_ids (list[UUID] | None | Unset): IDs of multiple previously uploaded files. Each upload's extracted - text is concatenated under a heading; each upload's binary is surfaced as a separate ``MediaAttachment`` so - multi-modal prompt steps reason over all files at once. Steps narrow visibility via ``{{attachments[…]}}`` - selectors (by index, filename, or fnmatch glob). The batch must satisfy every selector the agent declares — - exact names, indexed references (length must exceed the highest index), and glob patterns (each pattern needs at - least one match). Mismatches return HTTP 400 with the unmet requirements listed. Mutually exclusive with - ``input_upload_id`` (two spellings of the same batch), but may be combined with ``input`` — the prompt text - leads and the per-file sections follow, so "a photo plus a sentence about it" needs no synthetic text upload. - Max 20 uploads per run. + to attach multiple files. May be combined with ``input``: the prompt text leads and the file follows under a ``# + {filename}`` heading (before ``Seclai-Version: 2026-10-16``, followed by its extracted text). + + **Which steps receive it:** a step that sends or stores files takes the files its ``attachments`` field selects. + An LLM step (``prompt_call``, ``extract_data``, ``evaluate_step``) takes the files its ``attachments`` field + names, or else the files its plain-text templates reference: ``{{agent.attachments.}}`` for one attachment + the trigger declares, or ``{{agent.input}}`` for every upload unless a template also names an agent attachment. + + **Per-batch validation:** the batch must fit the trigger's ``accepted_attachments`` — every file fits one + declared attachment and each attachment gets at least its ``min`` files — or the run is rejected with HTTP 400. + input_upload_ids (list[UUID] | None | Unset): IDs of multiple previously uploaded files. Each upload gets a + heading in ``input`` (before ``Seclai-Version: 2026-10-16``, followed by its extracted text); each upload + reaches steps as a separate file (before ``Seclai-Version: 2026-10-16``, a text upload in the open ``files`` + attachment is written into ``input`` instead). Steps choose files as described under ``input_upload_id``. The + batch must fit the trigger's ``accepted_attachments``; a mismatch returns HTTP 400 listing what does not fit. + Mutually exclusive with ``input_upload_id`` (two spellings of the same batch), but may be combined with + ``input`` — the prompt text leads and the per-file sections follow, so "a photo plus a sentence about it" needs + no synthetic text upload. Max 20 uploads per run. metadata (AgentRunRequestMetadataType0 | None | Unset): Metadata to make available for string substitution expressions in agent tasks. priority (bool | Unset): If true, the agent run will be treated as priority execution. Default: False. @@ -49,7 +48,7 @@ class AgentRunRequest: are re-resolved server-side from the source run (which must belong to this account and agent) — you do not re- upload them. Combine with ``input`` to change the text while keeping the files. A fresh upload batch (``input_upload_id(s)``) takes precedence and disables replay. Binaries swept by retention fall back to their - extracted text. + extracted text. Files the trigger's ``accepted_attachments`` no longer accepts are left out. """ input_: None | str | Unset = UNSET diff --git a/seclai/_generated/models/agent_run_response.py b/seclai/_generated/models/agent_run_response.py index 10f95ba..7842585 100644 --- a/seclai/_generated/models/agent_run_response.py +++ b/seclai/_generated/models/agent_run_response.py @@ -34,7 +34,7 @@ class AgentRunResponse: input_ (None | str): Input provided to the agent for this run. output (None | str): The run's output text; its files are in `attachments`. Below `Seclai-Version: 2026-09-30` an output that has files is instead the manifest JSON `{schema, text, attachments: [{storage_key, mime, name, - label, bytes}]}`; `bytes` is absent on runs made before that version shipped. + label, bytes}]}`; `bytes` can be `null` on runs made before that version shipped. priority (bool): Indicates if the run was treated as a priority execution. run_id (str): Unique identifier for the agent run. status (PendingProcessingCompletedFailedStatus): @@ -61,7 +61,8 @@ class AgentRunResponse: requested. trace_purged_at (datetime.datetime | None | Unset): When this run's trace content was deleted under the account's agent-trace retention window. Non-null means `input`, `output` and every step's and tool call's I/O - are null **by design** and will never be available again — the run aged out, it did not fail. Branch on this + are null **by design** and will never be available again — the run aged out, it did not fail. A tool call's + `error` may be null as well, so a failed tool call can report its status without a message. Branch on this rather than on a null `output`: a run that genuinely produced nothing looks identical. Status, timing and credits remain accurate. wait_ms (int | None | Unset): Cumulative milliseconds the run was parked on standard-mode wait steps. diff --git a/seclai/_generated/models/agent_run_step_response.py b/seclai/_generated/models/agent_run_step_response.py index 74a7327..0617c86 100644 --- a/seclai/_generated/models/agent_run_step_response.py +++ b/seclai/_generated/models/agent_run_step_response.py @@ -41,8 +41,8 @@ class AgentRunStepResponse: produced none, for steps run before files were listed here, and once the run's trace is purged. tool_calls (list[AgentRunToolCallResponse] | Unset): LLM tool calls made during this step (prompt_call steps only), ordered by execution. Empty for steps that invoked no tools. - warnings (list[str] | None | Unset): Authoring problems the step ran into, whether or not it then failed, such - as a file name selector that matched none of its source's files. + warnings (list[str] | None | Unset): Problems the step ran into, whether or not it then failed, such as a file + name selector that matched none of its source's files, or a model that returned no answer. """ agent_step_id: str diff --git a/seclai/_generated/models/agent_run_stream_request.py b/seclai/_generated/models/agent_run_stream_request.py index 003fb80..2178bec 100644 --- a/seclai/_generated/models/agent_run_stream_request.py +++ b/seclai/_generated/models/agent_run_stream_request.py @@ -22,21 +22,25 @@ class AgentRunStreamRequest: """ Attributes: + include_reasoning (bool | Unset): Receive `stream_reasoning` events carrying the model's reasoning while it + thinks. They are sent only for a `streaming_result` step whose author enabled `show_reasoning`, and never when a + governance policy redacts that step. Default: False. input_ (None | str | Unset): Input to provide to the agent upon running for agents with dynamic triggers. input_upload_id (None | Unset | UUID): ID of a previously uploaded file (via POST /{agent_id}/upload-input) to use as the run input for dynamic-input triggers. Mutually exclusive with ``input_upload_ids`` — use that field - to attach multiple files. May be combined with ``input``. Subject to the same per-batch attachment-selector - validation as the non-streaming endpoint. + to attach multiple files. May be combined with ``input``. Must fit the trigger's ``accepted_attachments``, as on + the non-streaming endpoint. input_upload_ids (list[UUID] | None | Unset): IDs of multiple previously uploaded files. See the non-streaming - endpoint for full semantics, including per-batch selector validation (exact names, indexed references, and glob - patterns must all be satisfied or the run is rejected with HTTP 400) and combining the batch with ``input`` - prompt text. Max 20. + endpoint for full semantics, including fitting the trigger's ``accepted_attachments`` (else HTTP 400) and + combining the batch with ``input`` prompt text. Max 20. metadata (AgentRunStreamRequestMetadataType0 | None | Unset): Metadata to make available for string substitution expressions in agent tasks. replay_of_run_id (None | Unset | UUID): Re-run reusing a prior run's uploaded input files (re-resolved server- side from the source run, which must belong to this account and agent). A fresh upload batch takes precedence. + Files the trigger's ``accepted_attachments`` no longer accepts are left out. """ + include_reasoning: bool | Unset = False input_: None | str | Unset = UNSET input_upload_id: None | Unset | UUID = UNSET input_upload_ids: list[UUID] | None | Unset = UNSET @@ -49,6 +53,8 @@ def to_dict(self) -> dict[str, Any]: AgentRunStreamRequestMetadataType0, ) + include_reasoning = self.include_reasoning + input_: None | str | Unset if isinstance(self.input_, Unset): input_ = UNSET @@ -94,6 +100,8 @@ def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) + if include_reasoning is not UNSET: + field_dict["include_reasoning"] = include_reasoning if input_ is not UNSET: field_dict["input"] = input_ if input_upload_id is not UNSET: @@ -114,6 +122,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: ) d = dict(src_dict) + include_reasoning = d.pop("include_reasoning", UNSET) def _parse_input_(data: object) -> None | str | Unset: if data is None: @@ -202,6 +211,7 @@ def _parse_replay_of_run_id(data: object) -> None | Unset | UUID: replay_of_run_id = _parse_replay_of_run_id(d.pop("replay_of_run_id", UNSET)) agent_run_stream_request = cls( + include_reasoning=include_reasoning, input_=input_, input_upload_id=input_upload_id, input_upload_ids=input_upload_ids, diff --git a/seclai/_generated/models/agent_summary_response.py b/seclai/_generated/models/agent_summary_response.py index ed8789b..52a6f0a 100644 --- a/seclai/_generated/models/agent_summary_response.py +++ b/seclai/_generated/models/agent_summary_response.py @@ -46,6 +46,8 @@ class AgentSummaryResponse: retry_on_failure (bool | Unset): Whether to retry on evaluation failure. Default: True. sampling_config (AgentSummaryResponseSamplingConfigType0 | None | Unset): Sampling configuration for sample_and_flag mode. + trigger_id (None | str | Unset): ID of the agent's trigger, for the `/agents/{agent_id}/triggers/{trigger_id}/…` + endpoints such as `accepted-attachments` and `email-config`. trigger_type (None | str | Unset): Trigger type for the agent. """ @@ -66,6 +68,7 @@ class AgentSummaryResponse: prompt_model_auto_upgrade_strategy: str | Unset = "none" retry_on_failure: bool | Unset = True sampling_config: AgentSummaryResponseSamplingConfigType0 | None | Unset = UNSET + trigger_id: None | str | Unset = UNSET trigger_type: None | str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -148,6 +151,12 @@ def to_dict(self) -> dict[str, Any]: else: sampling_config = self.sampling_config + trigger_id: None | str | Unset + if isinstance(self.trigger_id, Unset): + trigger_id = UNSET + else: + trigger_id = self.trigger_id + trigger_type: None | str | Unset if isinstance(self.trigger_type, Unset): trigger_type = UNSET @@ -195,6 +204,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["retry_on_failure"] = retry_on_failure if sampling_config is not UNSET: field_dict["sampling_config"] = sampling_config + if trigger_id is not UNSET: + field_dict["trigger_id"] = trigger_id if trigger_type is not UNSET: field_dict["trigger_type"] = trigger_type @@ -338,6 +349,15 @@ def _parse_sampling_config( sampling_config = _parse_sampling_config(d.pop("sampling_config", UNSET)) + def _parse_trigger_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + trigger_id = _parse_trigger_id(d.pop("trigger_id", UNSET)) + def _parse_trigger_type(data: object) -> None | str | Unset: if data is None: return data @@ -365,6 +385,7 @@ def _parse_trigger_type(data: object) -> None | str | Unset: prompt_model_auto_upgrade_strategy=prompt_model_auto_upgrade_strategy, retry_on_failure=retry_on_failure, sampling_config=sampling_config, + trigger_id=trigger_id, trigger_type=trigger_type, ) diff --git a/seclai/_generated/models/content_attachment_detail_response.py b/seclai/_generated/models/content_attachment_detail_response.py new file mode 100644 index 0000000..2d95ff0 --- /dev/null +++ b/seclai/_generated/models/content_attachment_detail_response.py @@ -0,0 +1,216 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.content_attachment_detail_response_metadata import ( + ContentAttachmentDetailResponseMetadata, + ) + + +T = TypeVar("T", bound="ContentAttachmentDetailResponse") + + +@_attrs_define +class ContentAttachmentDetailResponse: + """One attached file, with the text indexed from it. + + Attributes: + content_type (str): MIME type of the attached file. + created_at (str): When the file was first attached. + file_withheld (None | str): Why the file's bytes are not served, or null when they are: + `blocked_by_governance_policy`, `redacted_by_governance_policy` (any text below is the redacted text), or + `pending_screening`. + id (str): The attachment's id, which the single-attachment endpoints take. + indexed (bool): Whether indexing the file for search was asked for. + indexing_error (None | str): Why the file was not indexed, when `indexing_status` is `failed`. + indexing_status (None | str): `pending`, `completed` or `failed`; null when indexing was not asked for. Search + finds the file only when `completed`. + key (str): The attachment's key, unique within the item. + metadata (ContentAttachmentDetailResponseMetadata): What is known about the file beyond its bytes. An image + extracted from a PDF carries its `page_number`, and `page_render: true` when it is a render of the whole page. + An image or video from a web page carries `source_url` (the address it was fetched from), `position` (its place + among the media the page listed, from 0) and, when the page gave one, `alt_text`. Empty for most files. A + retrieval metadata filter matches these keys, except `alt_text`, which is indexed as the attachment's text. + size_bytes (int): Size of the attached file in bytes. + text_content (None | str): The requested range of the text the file is indexed by; null when the file has no + completed index or was indexed without text. + text_content_end (int): + text_content_start (int): + text_content_total_length (int): + updated_at (str): When the attachment last changed. + """ + + content_type: str + created_at: str + file_withheld: None | str + id: str + indexed: bool + indexing_error: None | str + indexing_status: None | str + key: str + metadata: ContentAttachmentDetailResponseMetadata + size_bytes: int + text_content: None | str + text_content_end: int + text_content_start: int + text_content_total_length: int + updated_at: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + content_type = self.content_type + + created_at = self.created_at + + file_withheld: None | str + file_withheld = self.file_withheld + + id = self.id + + indexed = self.indexed + + indexing_error: None | str + indexing_error = self.indexing_error + + indexing_status: None | str + indexing_status = self.indexing_status + + key = self.key + + metadata = self.metadata.to_dict() + + size_bytes = self.size_bytes + + text_content: None | str + text_content = self.text_content + + text_content_end = self.text_content_end + + text_content_start = self.text_content_start + + text_content_total_length = self.text_content_total_length + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "content_type": content_type, + "created_at": created_at, + "file_withheld": file_withheld, + "id": id, + "indexed": indexed, + "indexing_error": indexing_error, + "indexing_status": indexing_status, + "key": key, + "metadata": metadata, + "size_bytes": size_bytes, + "text_content": text_content, + "text_content_end": text_content_end, + "text_content_start": text_content_start, + "text_content_total_length": text_content_total_length, + "updated_at": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.content_attachment_detail_response_metadata import ( + ContentAttachmentDetailResponseMetadata, + ) + + d = dict(src_dict) + content_type = d.pop("content_type") + + created_at = d.pop("created_at") + + def _parse_file_withheld(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + file_withheld = _parse_file_withheld(d.pop("file_withheld")) + + id = d.pop("id") + + indexed = d.pop("indexed") + + def _parse_indexing_error(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + indexing_error = _parse_indexing_error(d.pop("indexing_error")) + + def _parse_indexing_status(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + indexing_status = _parse_indexing_status(d.pop("indexing_status")) + + key = d.pop("key") + + metadata = ContentAttachmentDetailResponseMetadata.from_dict(d.pop("metadata")) + + size_bytes = d.pop("size_bytes") + + def _parse_text_content(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + text_content = _parse_text_content(d.pop("text_content")) + + text_content_end = d.pop("text_content_end") + + text_content_start = d.pop("text_content_start") + + text_content_total_length = d.pop("text_content_total_length") + + updated_at = d.pop("updated_at") + + content_attachment_detail_response = cls( + content_type=content_type, + created_at=created_at, + file_withheld=file_withheld, + id=id, + indexed=indexed, + indexing_error=indexing_error, + indexing_status=indexing_status, + key=key, + metadata=metadata, + size_bytes=size_bytes, + text_content=text_content, + text_content_end=text_content_end, + text_content_start=text_content_start, + text_content_total_length=text_content_total_length, + updated_at=updated_at, + ) + + content_attachment_detail_response.additional_properties = d + return content_attachment_detail_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/content_attachment_detail_response_metadata.py b/seclai/_generated/models/content_attachment_detail_response_metadata.py new file mode 100644 index 0000000..a741bc3 --- /dev/null +++ b/seclai/_generated/models/content_attachment_detail_response_metadata.py @@ -0,0 +1,52 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ContentAttachmentDetailResponseMetadata") + + +@_attrs_define +class ContentAttachmentDetailResponseMetadata: + """What is known about the file beyond its bytes. An image extracted from a PDF carries its `page_number`, and + `page_render: true` when it is a render of the whole page. An image or video from a web page carries `source_url` + (the address it was fetched from), `position` (its place among the media the page listed, from 0) and, when the page + gave one, `alt_text`. Empty for most files. A retrieval metadata filter matches these keys, except `alt_text`, which + is indexed as the attachment's text. + + """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + content_attachment_detail_response_metadata = cls() + + content_attachment_detail_response_metadata.additional_properties = d + return content_attachment_detail_response_metadata + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/content_attachment_response.py b/seclai/_generated/models/content_attachment_response.py new file mode 100644 index 0000000..3353681 --- /dev/null +++ b/seclai/_generated/models/content_attachment_response.py @@ -0,0 +1,161 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.content_attachment_response_metadata import ( + ContentAttachmentResponseMetadata, + ) + + +T = TypeVar("T", bound="ContentAttachmentResponse") + + +@_attrs_define +class ContentAttachmentResponse: + """A file attached to a content item. + + Attributes: + content_type (str): MIME type of the attached file. + created_at (str): When the file was first attached. + id (str): The attachment's id, which the single-attachment endpoints take. + indexed (bool): Whether indexing the file for search was asked for. + indexing_error (None | str): Why the file was not indexed, when `indexing_status` is `failed`. + indexing_status (None | str): `pending`, `completed` or `failed`; null when indexing was not asked for. Search + finds the file only when `completed`. + key (str): The attachment's key, unique within the item. + metadata (ContentAttachmentResponseMetadata): What is known about the file beyond its bytes. An image extracted + from a PDF carries its `page_number`, and `page_render: true` when it is a render of the whole page. An image or + video from a web page carries `source_url` (the address it was fetched from), `position` (its place among the + media the page listed, from 0) and, when the page gave one, `alt_text`. Empty for most files. A retrieval + metadata filter matches these keys, except `alt_text`, which is indexed as the attachment's text. + size_bytes (int): Size of the attached file in bytes. + updated_at (str): When the attachment last changed. + """ + + content_type: str + created_at: str + id: str + indexed: bool + indexing_error: None | str + indexing_status: None | str + key: str + metadata: ContentAttachmentResponseMetadata + size_bytes: int + updated_at: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + content_type = self.content_type + + created_at = self.created_at + + id = self.id + + indexed = self.indexed + + indexing_error: None | str + indexing_error = self.indexing_error + + indexing_status: None | str + indexing_status = self.indexing_status + + key = self.key + + metadata = self.metadata.to_dict() + + size_bytes = self.size_bytes + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "content_type": content_type, + "created_at": created_at, + "id": id, + "indexed": indexed, + "indexing_error": indexing_error, + "indexing_status": indexing_status, + "key": key, + "metadata": metadata, + "size_bytes": size_bytes, + "updated_at": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.content_attachment_response_metadata import ( + ContentAttachmentResponseMetadata, + ) + + d = dict(src_dict) + content_type = d.pop("content_type") + + created_at = d.pop("created_at") + + id = d.pop("id") + + indexed = d.pop("indexed") + + def _parse_indexing_error(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + indexing_error = _parse_indexing_error(d.pop("indexing_error")) + + def _parse_indexing_status(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + indexing_status = _parse_indexing_status(d.pop("indexing_status")) + + key = d.pop("key") + + metadata = ContentAttachmentResponseMetadata.from_dict(d.pop("metadata")) + + size_bytes = d.pop("size_bytes") + + updated_at = d.pop("updated_at") + + content_attachment_response = cls( + content_type=content_type, + created_at=created_at, + id=id, + indexed=indexed, + indexing_error=indexing_error, + indexing_status=indexing_status, + key=key, + metadata=metadata, + size_bytes=size_bytes, + updated_at=updated_at, + ) + + content_attachment_response.additional_properties = d + return content_attachment_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/content_attachment_response_metadata.py b/seclai/_generated/models/content_attachment_response_metadata.py new file mode 100644 index 0000000..dcbf0b5 --- /dev/null +++ b/seclai/_generated/models/content_attachment_response_metadata.py @@ -0,0 +1,52 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ContentAttachmentResponseMetadata") + + +@_attrs_define +class ContentAttachmentResponseMetadata: + """What is known about the file beyond its bytes. An image extracted from a PDF carries its `page_number`, and + `page_render: true` when it is a render of the whole page. An image or video from a web page carries `source_url` + (the address it was fetched from), `position` (its place among the media the page listed, from 0) and, when the page + gave one, `alt_text`. Empty for most files. A retrieval metadata filter matches these keys, except `alt_text`, which + is indexed as the attachment's text. + + """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + content_attachment_response_metadata = cls() + + content_attachment_response_metadata.additional_properties = d + return content_attachment_response_metadata + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/content_attachments_list_response.py b/seclai/_generated/models/content_attachments_list_response.py new file mode 100644 index 0000000..51ea952 --- /dev/null +++ b/seclai/_generated/models/content_attachments_list_response.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.content_attachment_response import ContentAttachmentResponse + from ..models.pagination_response import PaginationResponse + + +T = TypeVar("T", bound="ContentAttachmentsListResponse") + + +@_attrs_define +class ContentAttachmentsListResponse: + """Response model for a content item's attachments. + + Attributes: + data (list[ContentAttachmentResponse]): + pagination (PaginationResponse): Pagination information. + """ + + data: list[ContentAttachmentResponse] + pagination: PaginationResponse + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.content_attachment_response import ContentAttachmentResponse + from ..models.pagination_response import PaginationResponse + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = ContentAttachmentResponse.from_dict(data_item_data) + + data.append(data_item) + + pagination = PaginationResponse.from_dict(d.pop("pagination")) + + content_attachments_list_response = cls( + data=data, + pagination=pagination, + ) + + content_attachments_list_response.additional_properties = d + return content_attachments_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/content_detail_response.py b/seclai/_generated/models/content_detail_response.py index ea34be0..82afb98 100644 --- a/seclai/_generated/models/content_detail_response.py +++ b/seclai/_generated/models/content_detail_response.py @@ -12,6 +12,7 @@ from ..models.content_detail_response_metadata_type_0_item import ( ContentDetailResponseMetadataType0Item, ) + from ..models.skipped_attachment_response import SkippedAttachmentResponse T = TypeVar("T", bound="ContentDetailResponse") @@ -45,17 +46,22 @@ class ContentDetailResponse: text_content_total_length (int): Total length of the text content. title (None | str): Title of the content. extracted_media_capped (bool | Unset): True when extraction stopped with media still unread, so the item - references more media than was indexed and media search will not match anything past the cut. Two causes: a web - page that ran out of the budget for fetching remote assets, or a container that could not be read to the end (a - truncated or hostile archive). An uploaded document that reads cleanly is never capped, however much media it - holds — there is no limit on that. Default: False. - extracted_media_count (int | None | Unset): Number of embedded images / videos extracted from inside this item - and indexed as their own chunks. There is no limit on this — a document contributes as many as it holds. Null - when there is no media record for the item: the extraction pass has not run, does not apply to this container, - or found nothing. Treat null as 'unknown', never as zero. + references more media than was attached and media search will not match anything past the cut. The cause is a + web page that ran out of the budget for fetching remote assets or listed more media than is recorded, or a web + page or document that could not be read to the end. Default: False. + extracted_media_count (int | None | Unset): Number of images / videos in this web page's main content, or of + images inside this PDF or Office document, that were attached to the item on this source; a file over the per- + file size limit, listed as a failed attachment, is not counted. Null when there is no media record for the item: + the extraction pass has not run, does not apply to this container or this source's settings, or found nothing. + Treat null as 'unknown', never as zero. extracted_media_limit (int | None | Unset): The bound that was reached, when extracted_media_capped is true and - the stop was a bound — a number of fetch attempts, or a number of seconds. Null when extraction was not capped, - or when it stopped because the container could not be read rather than because a bound fired. + the stop was a bound — a number of fetch attempts, of seconds, of bytes, or of media listed. Null when + extraction was not capped, or when it stopped because the container could not be read rather than because a + bound fired. + skipped_attachments (list[SkippedAttachmentResponse] | Unset): Parts of an email delivered to an email content + source that were not stored as attachments of this item, each with the reason: displayed_in_body (an image the + message body shows, such as a signature logo), over_cap (beyond the per-message attachment limit), no_filename, + or undecodable. size_bytes is null for a part that was never decoded. Empty for every other item. """ content_duration: int | None @@ -83,6 +89,7 @@ class ContentDetailResponse: extracted_media_capped: bool | Unset = False extracted_media_count: int | None | Unset = UNSET extracted_media_limit: int | None | Unset = UNSET + skipped_attachments: list[SkippedAttachmentResponse] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -160,6 +167,13 @@ def to_dict(self) -> dict[str, Any]: else: extracted_media_limit = self.extracted_media_limit + skipped_attachments: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.skipped_attachments, Unset): + skipped_attachments = [] + for skipped_attachments_item_data in self.skipped_attachments: + skipped_attachments_item = skipped_attachments_item_data.to_dict() + skipped_attachments.append(skipped_attachments_item) + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -194,6 +208,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["extracted_media_count"] = extracted_media_count if extracted_media_limit is not UNSET: field_dict["extracted_media_limit"] = extracted_media_limit + if skipped_attachments is not UNSET: + field_dict["skipped_attachments"] = skipped_attachments return field_dict @@ -202,6 +218,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.content_detail_response_metadata_type_0_item import ( ContentDetailResponseMetadataType0Item, ) + from ..models.skipped_attachment_response import SkippedAttachmentResponse d = dict(src_dict) @@ -341,6 +358,17 @@ def _parse_extracted_media_limit(data: object) -> int | None | Unset: d.pop("extracted_media_limit", UNSET) ) + _skipped_attachments = d.pop("skipped_attachments", UNSET) + skipped_attachments: list[SkippedAttachmentResponse] | Unset = UNSET + if _skipped_attachments is not UNSET: + skipped_attachments = [] + for skipped_attachments_item_data in _skipped_attachments: + skipped_attachments_item = SkippedAttachmentResponse.from_dict( + skipped_attachments_item_data + ) + + skipped_attachments.append(skipped_attachments_item) + content_detail_response = cls( content_duration=content_duration, content_duration_display=content_duration_display, @@ -367,6 +395,7 @@ def _parse_extracted_media_limit(data: object) -> int | None | Unset: extracted_media_capped=extracted_media_capped, extracted_media_count=extracted_media_count, extracted_media_limit=extracted_media_limit, + skipped_attachments=skipped_attachments, ) content_detail_response.additional_properties = d diff --git a/seclai/_generated/models/create_agent_request.py b/seclai/_generated/models/create_agent_request.py index 53a08c1..a7635bb 100644 --- a/seclai/_generated/models/create_agent_request.py +++ b/seclai/_generated/models/create_agent_request.py @@ -9,6 +9,7 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot from ..models.create_agent_request_agent_definition_type_0 import ( CreateAgentRequestAgentDefinitionType0, ) @@ -25,6 +26,10 @@ class CreateAgentRequest: """ Attributes: name (str): Name for the new agent. + accepted_attachments (list[AcceptedAttachmentSlot] | None | Unset): The input attachments the trigger accepts. + Omitted, the ``agent_definition`` trigger's declaration is kept when the export carries one and both trigger + types take files; otherwise a dynamic_input or email_received trigger accepts any files (one attachment named + ``files``), and any other trigger none. agent_definition (CreateAgentRequestAgentDefinitionType0 | None | Unset): Optional payload in the same format produced by GET /agents/{id}/export. When provided, replaces any template-derived workflow and pre-fills metadata/trigger fields the request does not specify explicitly. Validation errors include line/column @@ -41,6 +46,7 @@ class CreateAgentRequest: """ name: str + accepted_attachments: list[AcceptedAttachmentSlot] | None | Unset = UNSET agent_definition: CreateAgentRequestAgentDefinitionType0 | None | Unset = UNSET agent_template: None | str | Unset = UNSET description: None | str | Unset = UNSET @@ -58,6 +64,20 @@ def to_dict(self) -> dict[str, Any]: name = self.name + accepted_attachments: list[dict[str, Any]] | None | Unset + if isinstance(self.accepted_attachments, Unset): + accepted_attachments = UNSET + elif isinstance(self.accepted_attachments, list): + accepted_attachments = [] + for accepted_attachments_type_0_item_data in self.accepted_attachments: + accepted_attachments_type_0_item = ( + accepted_attachments_type_0_item_data.to_dict() + ) + accepted_attachments.append(accepted_attachments_type_0_item) + + else: + accepted_attachments = self.accepted_attachments + agent_definition: dict[str, Any] | None | Unset if isinstance(self.agent_definition, Unset): agent_definition = UNSET @@ -95,6 +115,8 @@ def to_dict(self) -> dict[str, Any]: "name": name, } ) + if accepted_attachments is not UNSET: + field_dict["accepted_attachments"] = accepted_attachments if agent_definition is not UNSET: field_dict["agent_definition"] = agent_definition if agent_template is not UNSET: @@ -110,6 +132,7 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot from ..models.create_agent_request_agent_definition_type_0 import ( CreateAgentRequestAgentDefinitionType0, ) @@ -120,6 +143,36 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) name = d.pop("name") + def _parse_accepted_attachments( + data: object, + ) -> list[AcceptedAttachmentSlot] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + accepted_attachments_type_0 = [] + _accepted_attachments_type_0 = data + for ( + accepted_attachments_type_0_item_data + ) in _accepted_attachments_type_0: + accepted_attachments_type_0_item = AcceptedAttachmentSlot.from_dict( + accepted_attachments_type_0_item_data + ) + + accepted_attachments_type_0.append(accepted_attachments_type_0_item) + + return accepted_attachments_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[AcceptedAttachmentSlot] | None | Unset, data) + + accepted_attachments = _parse_accepted_attachments( + d.pop("accepted_attachments", UNSET) + ) + def _parse_agent_definition( data: object, ) -> CreateAgentRequestAgentDefinitionType0 | None | Unset: @@ -182,6 +235,7 @@ def _parse_entity_remap( create_agent_request = cls( name=name, + accepted_attachments=accepted_attachments, agent_definition=agent_definition, agent_template=agent_template, description=description, diff --git a/seclai/_generated/models/create_source_body.py b/seclai/_generated/models/create_source_body.py index 1c14469..31a8cc3 100644 --- a/seclai/_generated/models/create_source_body.py +++ b/seclai/_generated/models/create_source_body.py @@ -18,24 +18,49 @@ class CreateSourceBody: Attributes: name (str): Source name. - source_type (str): Source type: rss, website, or custom_index. The legacy value 'file_uploads' is accepted as an - alias for custom_index. + source_type (str): Source type: rss_feed, website, custom_index, cloud_drive or email. The legacy value + 'file_uploads' is accepted as an alias for custom_index. chunk_overlap (int | None | Unset): Chunk overlap for content processing. chunk_size (int | None | Unset): Chunk size for content processing. + cloud_drive_connection_id (None | str | Unset): Required for a cloud_drive source, and ignored on any other: the + id of a connected drive, from GET /cloud-drives. + cloud_drive_content_types (None | str | Unset): For a cloud_drive source: comma-separated MIME types a file must + have to be indexed. Omit for no filter. + cloud_drive_folder_path (None | str | Unset): For a cloud_drive source: the folder to index, as a path inside + the drive. Omit to index the connected drive's own folder. + cloud_drive_max_file_mb (int | None | Unset): For a cloud_drive source: files larger than this many megabytes + are skipped. Omit for no limit of the source's own. + cloud_drive_path_pattern (None | str | Unset): For a cloud_drive source: a glob a file's path must match to be + indexed, such as `**/*.pdf` or `/reports/*`. Omit for no filter. content_filter (None | str | Unset): Content filter type. dimensions (int | None | Unset): Embedding dimensions override. + document_images (bool | None | Unset): Whether the images inside PDF, DOCX, PPTX and XLSX files are attached to + the item and indexed; on a text-only embedder, by the text in each image. Applies to documents added after it + changes. Defaults to true; below Seclai-Version 2026-10-18 it defaults to false on a text-only embedder. On a + website or RSS source it is ignored: `media_types` decides. + email_allowed_senders (list[str] | None | Unset): Required for an email source, and only valid there: the + senders whose mail is stored. Each entry is a full address (news@example.com) or a bare domain (example.com), + which also matches its sub-domains. Matched against the message's From address, which must pass DMARC. embedding_model (None | str | Unset): Embedding model override — a `model_type` from `GET /models/embedders`, which also reports each embedder's `supported_input_media`. Defaults to the platform embedder (`default_model_type` on that endpoint) when omitted. Indexing images or video requires an embedder that lists that modality. + feed_attachments (list[str] | None | Unset): Kinds of file listed beside a feed item's content to attach to the + item and index, on an RSS source. Subset of ['enclosures', 'item_image', 'media_rss']; any other value is + refused. None are attached unless chosen. index_mode (None | SourceIndexMode | Unset): Index mode for custom_index sources: fast_and_cheap (default), balanced, slow_and_thorough, or custom. - media_types (list[str] | None | Unset): Media kinds to extract from indexed content and embed as multi-modal KB - chunks. Subset of ['images', 'video']. Only kinds the source's embedder can index are honored (see - `supported_input_media` on GET /models/embedders); unsupported values are dropped. Omit / [] for text-only. + media_types (list[str] | None | Unset): Media kinds in a web page's main content to attach to the page's item + and index, on a website or RSS source. Subset of ['images', 'video']. From `Seclai-Version: 2026-10-13` any + other value, and any kind on another source type, is refused with a 400; older versions drop an unknown value + and store the rest. A kind the source's embedder cannot index is stored and not indexed (see + `supported_input_media` on GET /models/embedders). 'images' also covers the images inside PDF, DOCX, PPTX and + XLSX files. Applies to pages and documents added after it is set. polling (None | str | Unset): Polling interval (e.g. hourly, daily). polling_action (None | str | Unset): Polling action. - polling_max_items (int | None | Unset): Max items per poll. + polling_max_items (int | None | Unset): The most new feed items a scheduled poll takes. Read for RSS feeds only: + from Seclai-Version 2026-10-19 any other source type rejects it with 400. Earlier versions store it there. An + email source rejects it at every version. retention (int | None | Unset): Retention period in days. url_id (None | str | Unset): URL record ID (required for rss/website sources). """ @@ -44,9 +69,17 @@ class CreateSourceBody: source_type: str chunk_overlap: int | None | Unset = UNSET chunk_size: int | None | Unset = UNSET + cloud_drive_connection_id: None | str | Unset = UNSET + cloud_drive_content_types: None | str | Unset = UNSET + cloud_drive_folder_path: None | str | Unset = UNSET + cloud_drive_max_file_mb: int | None | Unset = UNSET + cloud_drive_path_pattern: None | str | Unset = UNSET content_filter: None | str | Unset = UNSET dimensions: int | None | Unset = UNSET + document_images: bool | None | Unset = UNSET + email_allowed_senders: list[str] | None | Unset = UNSET embedding_model: None | str | Unset = UNSET + feed_attachments: list[str] | None | Unset = UNSET index_mode: None | SourceIndexMode | Unset = UNSET media_types: list[str] | None | Unset = UNSET polling: None | str | Unset = UNSET @@ -73,6 +106,36 @@ def to_dict(self) -> dict[str, Any]: else: chunk_size = self.chunk_size + cloud_drive_connection_id: None | str | Unset + if isinstance(self.cloud_drive_connection_id, Unset): + cloud_drive_connection_id = UNSET + else: + cloud_drive_connection_id = self.cloud_drive_connection_id + + cloud_drive_content_types: None | str | Unset + if isinstance(self.cloud_drive_content_types, Unset): + cloud_drive_content_types = UNSET + else: + cloud_drive_content_types = self.cloud_drive_content_types + + cloud_drive_folder_path: None | str | Unset + if isinstance(self.cloud_drive_folder_path, Unset): + cloud_drive_folder_path = UNSET + else: + cloud_drive_folder_path = self.cloud_drive_folder_path + + cloud_drive_max_file_mb: int | None | Unset + if isinstance(self.cloud_drive_max_file_mb, Unset): + cloud_drive_max_file_mb = UNSET + else: + cloud_drive_max_file_mb = self.cloud_drive_max_file_mb + + cloud_drive_path_pattern: None | str | Unset + if isinstance(self.cloud_drive_path_pattern, Unset): + cloud_drive_path_pattern = UNSET + else: + cloud_drive_path_pattern = self.cloud_drive_path_pattern + content_filter: None | str | Unset if isinstance(self.content_filter, Unset): content_filter = UNSET @@ -85,12 +148,36 @@ def to_dict(self) -> dict[str, Any]: else: dimensions = self.dimensions + document_images: bool | None | Unset + if isinstance(self.document_images, Unset): + document_images = UNSET + else: + document_images = self.document_images + + email_allowed_senders: list[str] | None | Unset + if isinstance(self.email_allowed_senders, Unset): + email_allowed_senders = UNSET + elif isinstance(self.email_allowed_senders, list): + email_allowed_senders = self.email_allowed_senders + + else: + email_allowed_senders = self.email_allowed_senders + embedding_model: None | str | Unset if isinstance(self.embedding_model, Unset): embedding_model = UNSET else: embedding_model = self.embedding_model + feed_attachments: list[str] | None | Unset + if isinstance(self.feed_attachments, Unset): + feed_attachments = UNSET + elif isinstance(self.feed_attachments, list): + feed_attachments = self.feed_attachments + + else: + feed_attachments = self.feed_attachments + index_mode: None | str | Unset if isinstance(self.index_mode, Unset): index_mode = UNSET @@ -150,12 +237,28 @@ def to_dict(self) -> dict[str, Any]: field_dict["chunk_overlap"] = chunk_overlap if chunk_size is not UNSET: field_dict["chunk_size"] = chunk_size + if cloud_drive_connection_id is not UNSET: + field_dict["cloud_drive_connection_id"] = cloud_drive_connection_id + if cloud_drive_content_types is not UNSET: + field_dict["cloud_drive_content_types"] = cloud_drive_content_types + if cloud_drive_folder_path is not UNSET: + field_dict["cloud_drive_folder_path"] = cloud_drive_folder_path + if cloud_drive_max_file_mb is not UNSET: + field_dict["cloud_drive_max_file_mb"] = cloud_drive_max_file_mb + if cloud_drive_path_pattern is not UNSET: + field_dict["cloud_drive_path_pattern"] = cloud_drive_path_pattern if content_filter is not UNSET: field_dict["content_filter"] = content_filter if dimensions is not UNSET: field_dict["dimensions"] = dimensions + if document_images is not UNSET: + field_dict["document_images"] = document_images + if email_allowed_senders is not UNSET: + field_dict["email_allowed_senders"] = email_allowed_senders if embedding_model is not UNSET: field_dict["embedding_model"] = embedding_model + if feed_attachments is not UNSET: + field_dict["feed_attachments"] = feed_attachments if index_mode is not UNSET: field_dict["index_mode"] = index_mode if media_types is not UNSET: @@ -198,6 +301,61 @@ def _parse_chunk_size(data: object) -> int | None | Unset: chunk_size = _parse_chunk_size(d.pop("chunk_size", UNSET)) + def _parse_cloud_drive_connection_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_connection_id = _parse_cloud_drive_connection_id( + d.pop("cloud_drive_connection_id", UNSET) + ) + + def _parse_cloud_drive_content_types(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_content_types = _parse_cloud_drive_content_types( + d.pop("cloud_drive_content_types", UNSET) + ) + + def _parse_cloud_drive_folder_path(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_folder_path = _parse_cloud_drive_folder_path( + d.pop("cloud_drive_folder_path", UNSET) + ) + + def _parse_cloud_drive_max_file_mb(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + cloud_drive_max_file_mb = _parse_cloud_drive_max_file_mb( + d.pop("cloud_drive_max_file_mb", UNSET) + ) + + def _parse_cloud_drive_path_pattern(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_path_pattern = _parse_cloud_drive_path_pattern( + d.pop("cloud_drive_path_pattern", UNSET) + ) + def _parse_content_filter(data: object) -> None | str | Unset: if data is None: return data @@ -216,6 +374,34 @@ def _parse_dimensions(data: object) -> int | None | Unset: dimensions = _parse_dimensions(d.pop("dimensions", UNSET)) + def _parse_document_images(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + document_images = _parse_document_images(d.pop("document_images", UNSET)) + + def _parse_email_allowed_senders(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + email_allowed_senders_type_0 = cast(list[str], data) + + return email_allowed_senders_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + email_allowed_senders = _parse_email_allowed_senders( + d.pop("email_allowed_senders", UNSET) + ) + def _parse_embedding_model(data: object) -> None | str | Unset: if data is None: return data @@ -225,6 +411,23 @@ def _parse_embedding_model(data: object) -> None | str | Unset: embedding_model = _parse_embedding_model(d.pop("embedding_model", UNSET)) + def _parse_feed_attachments(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + feed_attachments_type_0 = cast(list[str], data) + + return feed_attachments_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + feed_attachments = _parse_feed_attachments(d.pop("feed_attachments", UNSET)) + def _parse_index_mode(data: object) -> None | SourceIndexMode | Unset: if data is None: return data @@ -309,9 +512,17 @@ def _parse_url_id(data: object) -> None | str | Unset: source_type=source_type, chunk_overlap=chunk_overlap, chunk_size=chunk_size, + cloud_drive_connection_id=cloud_drive_connection_id, + cloud_drive_content_types=cloud_drive_content_types, + cloud_drive_folder_path=cloud_drive_folder_path, + cloud_drive_max_file_mb=cloud_drive_max_file_mb, + cloud_drive_path_pattern=cloud_drive_path_pattern, content_filter=content_filter, dimensions=dimensions, + document_images=document_images, + email_allowed_senders=email_allowed_senders, embedding_model=embedding_model, + feed_attachments=feed_attachments, index_mode=index_mode, media_types=media_types, polling=polling, diff --git a/seclai/_generated/models/email_source_rejection_list_response.py b/seclai/_generated/models/email_source_rejection_list_response.py new file mode 100644 index 0000000..360c864 --- /dev/null +++ b/seclai/_generated/models/email_source_rejection_list_response.py @@ -0,0 +1,88 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.email_source_rejection_response import EmailSourceRejectionResponse + from ..models.pagination_response import PaginationResponse + + +T = TypeVar("T", bound="EmailSourceRejectionListResponse") + + +@_attrs_define +class EmailSourceRejectionListResponse: + """A page of mail an email content source refused. + + Attributes: + data (list[EmailSourceRejectionResponse]): + pagination (PaginationResponse): Pagination information. + """ + + data: list[EmailSourceRejectionResponse] + pagination: PaginationResponse + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.email_source_rejection_response import ( + EmailSourceRejectionResponse, + ) + from ..models.pagination_response import PaginationResponse + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = EmailSourceRejectionResponse.from_dict(data_item_data) + + data.append(data_item) + + pagination = PaginationResponse.from_dict(d.pop("pagination")) + + email_source_rejection_list_response = cls( + data=data, + pagination=pagination, + ) + + email_source_rejection_list_response.additional_properties = d + return email_source_rejection_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/email_source_rejection_response.py b/seclai/_generated/models/email_source_rejection_response.py new file mode 100644 index 0000000..b786c14 --- /dev/null +++ b/seclai/_generated/models/email_source_rejection_response.py @@ -0,0 +1,174 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.email_source_rejection_response_auth_verdicts import ( + EmailSourceRejectionResponseAuthVerdicts, + ) + + +T = TypeVar("T", bound="EmailSourceRejectionResponse") + + +@_attrs_define +class EmailSourceRejectionResponse: + """Mail an email content source refused: who sent it and why, never what + it said. + + Attributes: + authenticated (bool): Whether the message passed DMARC, which is what authenticates its From address. Adding an + unauthenticated sender to the allowed senders does not let its mail in. + created_at (str): When the mail was refused. + id (str): Unique identifier of the refusal. + reason (str): Why it was refused: sender_not_allowed, unauthenticated_sender, unreadable_from, sender_blocked, + spam, virus, unsafe_content, rate_limited, account_not_chargeable or empty_message; or, for a message the source + received before, what became of the earlier one: repeat_stored, repeat_held, repeat_deleted or + repeat_in_progress. + recipient (str): The source address it was sent to. + sender (str): The envelope sender. For bulk mail this is the delivery provider's bounce address, not the From + address. + sender_ip (None | str): IP address the mail came from. + auth_verdicts (EmailSourceRejectionResponseAuthVerdicts | Unset): The SPF, DKIM and DMARC verdicts reported for + the message. + from_address (None | str | Unset): The address in the message's From line, which the source's allowed senders + are matched against. Null when no single From address could be read from the message unambiguously. + """ + + authenticated: bool + created_at: str + id: str + reason: str + recipient: str + sender: str + sender_ip: None | str + auth_verdicts: EmailSourceRejectionResponseAuthVerdicts | Unset = UNSET + from_address: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + authenticated = self.authenticated + + created_at = self.created_at + + id = self.id + + reason = self.reason + + recipient = self.recipient + + sender = self.sender + + sender_ip: None | str + sender_ip = self.sender_ip + + auth_verdicts: dict[str, Any] | Unset = UNSET + if not isinstance(self.auth_verdicts, Unset): + auth_verdicts = self.auth_verdicts.to_dict() + + from_address: None | str | Unset + if isinstance(self.from_address, Unset): + from_address = UNSET + else: + from_address = self.from_address + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "authenticated": authenticated, + "created_at": created_at, + "id": id, + "reason": reason, + "recipient": recipient, + "sender": sender, + "sender_ip": sender_ip, + } + ) + if auth_verdicts is not UNSET: + field_dict["auth_verdicts"] = auth_verdicts + if from_address is not UNSET: + field_dict["from_address"] = from_address + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.email_source_rejection_response_auth_verdicts import ( + EmailSourceRejectionResponseAuthVerdicts, + ) + + d = dict(src_dict) + authenticated = d.pop("authenticated") + + created_at = d.pop("created_at") + + id = d.pop("id") + + reason = d.pop("reason") + + recipient = d.pop("recipient") + + sender = d.pop("sender") + + def _parse_sender_ip(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + sender_ip = _parse_sender_ip(d.pop("sender_ip")) + + _auth_verdicts = d.pop("auth_verdicts", UNSET) + auth_verdicts: EmailSourceRejectionResponseAuthVerdicts | Unset + if isinstance(_auth_verdicts, Unset): + auth_verdicts = UNSET + else: + auth_verdicts = EmailSourceRejectionResponseAuthVerdicts.from_dict( + _auth_verdicts + ) + + def _parse_from_address(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + from_address = _parse_from_address(d.pop("from_address", UNSET)) + + email_source_rejection_response = cls( + authenticated=authenticated, + created_at=created_at, + id=id, + reason=reason, + recipient=recipient, + sender=sender, + sender_ip=sender_ip, + auth_verdicts=auth_verdicts, + from_address=from_address, + ) + + email_source_rejection_response.additional_properties = d + return email_source_rejection_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/email_source_rejection_response_auth_verdicts.py b/seclai/_generated/models/email_source_rejection_response_auth_verdicts.py new file mode 100644 index 0000000..ce8665d --- /dev/null +++ b/seclai/_generated/models/email_source_rejection_response_auth_verdicts.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EmailSourceRejectionResponseAuthVerdicts") + + +@_attrs_define +class EmailSourceRejectionResponseAuthVerdicts: + """The SPF, DKIM and DMARC verdicts reported for the message.""" + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + email_source_rejection_response_auth_verdicts = cls() + + email_source_rejection_response_auth_verdicts.additional_properties = d + return email_source_rejection_response_auth_verdicts + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/email_trigger_config_response.py b/seclai/_generated/models/email_trigger_config_response.py index b2996e6..68b63bf 100644 --- a/seclai/_generated/models/email_trigger_config_response.py +++ b/seclai/_generated/models/email_trigger_config_response.py @@ -26,6 +26,7 @@ class EmailTriggerConfigResponse: email_ignore_auto_generated (bool | Unset): Default: True. email_queue_on_quota (bool | Unset): Default: False. email_require_sender_auth (bool | Unset): Default: True. + email_run_on_attachment_mismatch (bool | Unset): Default: False. """ agent_id: UUID @@ -37,6 +38,7 @@ class EmailTriggerConfigResponse: email_ignore_auto_generated: bool | Unset = True email_queue_on_quota: bool | Unset = False email_require_sender_auth: bool | Unset = True + email_run_on_attachment_mismatch: bool | Unset = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -71,6 +73,8 @@ def to_dict(self) -> dict[str, Any]: email_require_sender_auth = self.email_require_sender_auth + email_run_on_attachment_mismatch = self.email_run_on_attachment_mismatch + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -92,6 +96,10 @@ def to_dict(self) -> dict[str, Any]: field_dict["email_queue_on_quota"] = email_queue_on_quota if email_require_sender_auth is not UNSET: field_dict["email_require_sender_auth"] = email_require_sender_auth + if email_run_on_attachment_mismatch is not UNSET: + field_dict["email_run_on_attachment_mismatch"] = ( + email_run_on_attachment_mismatch + ) return field_dict @@ -140,6 +148,10 @@ def _parse_email_allowed_senders(data: object) -> list[str] | None | Unset: email_require_sender_auth = d.pop("email_require_sender_auth", UNSET) + email_run_on_attachment_mismatch = d.pop( + "email_run_on_attachment_mismatch", UNSET + ) + email_trigger_config_response = cls( agent_id=agent_id, trigger_id=trigger_id, @@ -150,6 +162,7 @@ def _parse_email_allowed_senders(data: object) -> list[str] | None | Unset: email_ignore_auto_generated=email_ignore_auto_generated, email_queue_on_quota=email_queue_on_quota, email_require_sender_auth=email_require_sender_auth, + email_run_on_attachment_mismatch=email_run_on_attachment_mismatch, ) email_trigger_config_response.additional_properties = d diff --git a/seclai/_generated/models/evaluation_result_summary_response.py b/seclai/_generated/models/evaluation_result_summary_response.py index da5ef4e..3134ab3 100644 --- a/seclai/_generated/models/evaluation_result_summary_response.py +++ b/seclai/_generated/models/evaluation_result_summary_response.py @@ -21,7 +21,8 @@ class EvaluationResultSummaryResponse: flagged (int): passed (int): total (int): - average_score (float | None | Unset): Mean score across all evaluated results, or null if none. + average_score (float | None | Unset): Mean score of the final passed and failed results, or null if none. On + /api before Seclai-Version 2026-10-21 it averages every final result's stored score, `error` included. """ error: int diff --git a/seclai/_generated/models/generate_agent_steps_response.py b/seclai/_generated/models/generate_agent_steps_response.py index 3989e73..b05da5f 100644 --- a/seclai/_generated/models/generate_agent_steps_response.py +++ b/seclai/_generated/models/generate_agent_steps_response.py @@ -30,7 +30,10 @@ class GenerateAgentStepsResponse: steps (list[GenerateAgentStepsResponseStepsItem]): Generated agent steps. success (bool): Whether steps were successfully generated. agent_config (GenerateAgentStepsResponseAgentConfigType0 | None | Unset): Suggested agent-level configuration, - if any. + if any. For an email_received agent it may carry `email_run_on_attachment_mismatch`, which the caller applies + through the trigger's email-config endpoint. For a dynamic_input or email_received agent it may carry + `accepted_attachments`, which the caller passes with the steps to `PUT /agents/{agent_id}/definition` so both + save together. example_prompts (list[ExamplePrompt] | Unset): Example natural-language prompts that demonstrate the capabilities of this AI assistant for the given mode. intent_assessment (None | str | Unset): How the assistant interpreted the request: 'clear' when steps were diff --git a/seclai/_generated/models/insufficient_credits_detail.py b/seclai/_generated/models/insufficient_credits_detail.py index ad64030..6edc8b3 100644 --- a/seclai/_generated/models/insufficient_credits_detail.py +++ b/seclai/_generated/models/insufficient_credits_detail.py @@ -11,23 +11,23 @@ @_attrs_define class InsufficientCreditsDetail: - """``detail`` body for a 402 ``insufficient_credits`` response. + """``error`` body of a 402 ``insufficient_credits`` response. Attributes: account_id (str): UUID of the account that ran out of credits. - error (Literal['insufficient_credits']): Stable machine-readable error code. + code (Literal['insufficient_credits']): Stable machine-readable error code. message (str): Human-readable explanation. """ account_id: str - error: Literal["insufficient_credits"] + code: Literal["insufficient_credits"] message: str additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: account_id = self.account_id - error = self.error + code = self.code message = self.message @@ -36,7 +36,7 @@ def to_dict(self) -> dict[str, Any]: field_dict.update( { "account_id": account_id, - "error": error, + "code": code, "message": message, } ) @@ -48,17 +48,17 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) account_id = d.pop("account_id") - error = cast(Literal["insufficient_credits"], d.pop("error")) - if error != "insufficient_credits": + code = cast(Literal["insufficient_credits"], d.pop("code")) + if code != "insufficient_credits": raise ValueError( - f"error must match const 'insufficient_credits', got '{error}'" + f"code must match const 'insufficient_credits', got '{code}'" ) message = d.pop("message") insufficient_credits_detail = cls( account_id=account_id, - error=error, + code=code, message=message, ) diff --git a/seclai/_generated/models/insufficient_credits_response.py b/seclai/_generated/models/insufficient_credits_response.py index da8b9cb..958cad9 100644 --- a/seclai/_generated/models/insufficient_credits_response.py +++ b/seclai/_generated/models/insufficient_credits_response.py @@ -17,21 +17,23 @@ class InsufficientCreditsResponse: """402 envelope returned when the account has exhausted its credits. - Attributes: - detail (InsufficientCreditsDetail): ``detail`` body for a 402 ``insufficient_credits`` response. + The wire shape ``http_exception_handler`` and ``insufficient_credits_exception_handler`` send. + + Attributes: + error (InsufficientCreditsDetail): ``error`` body of a 402 ``insufficient_credits`` response. """ - detail: InsufficientCreditsDetail + error: InsufficientCreditsDetail additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - detail = self.detail.to_dict() + error = self.error.to_dict() field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { - "detail": detail, + "error": error, } ) @@ -42,10 +44,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.insufficient_credits_detail import InsufficientCreditsDetail d = dict(src_dict) - detail = InsufficientCreditsDetail.from_dict(d.pop("detail")) + error = InsufficientCreditsDetail.from_dict(d.pop("error")) insufficient_credits_response = cls( - detail=detail, + error=error, ) insufficient_credits_response.additional_properties = d diff --git a/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py b/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py index e811d5f..11b07a5 100644 --- a/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py +++ b/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py @@ -14,6 +14,7 @@ class NonManualEvaluationModeStatResponse: """Per-mode rollup for evaluation activity. Attributes: + error (int): Results whose evaluator returned no verdict. failed (int): failure_rate (float): flagged (int): @@ -23,6 +24,7 @@ class NonManualEvaluationModeStatResponse: total (int): """ + error: int failed: int failure_rate: float flagged: int @@ -33,6 +35,8 @@ class NonManualEvaluationModeStatResponse: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + error = self.error + failed = self.failed failure_rate = self.failure_rate @@ -51,6 +55,7 @@ def to_dict(self) -> dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { + "error": error, "failed": failed, "failure_rate": failure_rate, "flagged": flagged, @@ -66,6 +71,8 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) + error = d.pop("error") + failed = d.pop("failed") failure_rate = d.pop("failure_rate") @@ -81,6 +88,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: total = d.pop("total") non_manual_evaluation_mode_stat_response = cls( + error=error, failed=failed, failure_rate=failure_rate, flagged=flagged, diff --git a/seclai/_generated/models/non_manual_evaluation_summary_response.py b/seclai/_generated/models/non_manual_evaluation_summary_response.py index d760e08..8511c5c 100644 --- a/seclai/_generated/models/non_manual_evaluation_summary_response.py +++ b/seclai/_generated/models/non_manual_evaluation_summary_response.py @@ -21,6 +21,7 @@ class NonManualEvaluationSummaryResponse: Attributes: by_mode (list[NonManualEvaluationModeStatResponse]): + error (int): Results whose evaluator returned no verdict. failed (int): failure_rate (float): flagged (int): @@ -30,6 +31,7 @@ class NonManualEvaluationSummaryResponse: """ by_mode: list[NonManualEvaluationModeStatResponse] + error: int failed: int failure_rate: float flagged: int @@ -44,6 +46,8 @@ def to_dict(self) -> dict[str, Any]: by_mode_item = by_mode_item_data.to_dict() by_mode.append(by_mode_item) + error = self.error + failed = self.failed failure_rate = self.failure_rate @@ -61,6 +65,7 @@ def to_dict(self) -> dict[str, Any]: field_dict.update( { "by_mode": by_mode, + "error": error, "failed": failed, "failure_rate": failure_rate, "flagged": flagged, @@ -88,6 +93,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: by_mode.append(by_mode_item) + error = d.pop("error") + failed = d.pop("failed") failure_rate = d.pop("failure_rate") @@ -102,6 +109,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: non_manual_evaluation_summary_response = cls( by_mode=by_mode, + error=error, failed=failed, failure_rate=failure_rate, flagged=flagged, diff --git a/seclai/_generated/models/set_accepted_attachments_request.py b/seclai/_generated/models/set_accepted_attachments_request.py new file mode 100644 index 0000000..f968db2 --- /dev/null +++ b/seclai/_generated/models/set_accepted_attachments_request.py @@ -0,0 +1,106 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot + + +T = TypeVar("T", bound="SetAcceptedAttachmentsRequest") + + +@_attrs_define +class SetAcceptedAttachmentsRequest: + """ + Attributes: + accepted_attachments (list[AcceptedAttachmentSlot] | None): The input attachments the trigger accepts; ``null`` + accepts any files (one attachment named ``files``). Only ``dynamic_input`` and ``email_received`` triggers take + files. + """ + + accepted_attachments: list[AcceptedAttachmentSlot] | None + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + accepted_attachments: list[dict[str, Any]] | None + if isinstance(self.accepted_attachments, list): + accepted_attachments = [] + for accepted_attachments_type_0_item_data in self.accepted_attachments: + accepted_attachments_type_0_item = ( + accepted_attachments_type_0_item_data.to_dict() + ) + accepted_attachments.append(accepted_attachments_type_0_item) + + else: + accepted_attachments = self.accepted_attachments + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted_attachments": accepted_attachments, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot + + d = dict(src_dict) + + def _parse_accepted_attachments( + data: object, + ) -> list[AcceptedAttachmentSlot] | None: + if data is None: + return data + try: + if not isinstance(data, list): + raise TypeError() + accepted_attachments_type_0 = [] + _accepted_attachments_type_0 = data + for ( + accepted_attachments_type_0_item_data + ) in _accepted_attachments_type_0: + accepted_attachments_type_0_item = AcceptedAttachmentSlot.from_dict( + accepted_attachments_type_0_item_data + ) + + accepted_attachments_type_0.append(accepted_attachments_type_0_item) + + return accepted_attachments_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[AcceptedAttachmentSlot] | None, data) + + accepted_attachments = _parse_accepted_attachments( + d.pop("accepted_attachments") + ) + + set_accepted_attachments_request = cls( + accepted_attachments=accepted_attachments, + ) + + set_accepted_attachments_request.additional_properties = d + return set_accepted_attachments_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/set_email_trigger_config_request.py b/seclai/_generated/models/set_email_trigger_config_request.py index 056b04c..d0ea593 100644 --- a/seclai/_generated/models/set_email_trigger_config_request.py +++ b/seclai/_generated/models/set_email_trigger_config_request.py @@ -34,6 +34,9 @@ class SetEmailTriggerConfigRequest: require_sender_auth (bool | None | Unset): When true (default for new triggers), the envelope sender must pass SPF or DMARC even on an open inbox (no allowlist); unauthenticated, spoofable mail is rejected. Set false to accept fully unauthenticated mail on an open inbox. + run_on_attachment_mismatch (bool | None | Unset): When true (default false), an email whose attachments don't + fit what the agent expects still runs: files the agent can't take are left out and the problems are listed in + the `email_attachment_issues` run metadata. When false, the run fails. """ alias: None | str | Unset = UNSET @@ -41,6 +44,7 @@ class SetEmailTriggerConfigRequest: ignore_auto_generated: bool | None | Unset = UNSET queue_on_quota: bool | None | Unset = UNSET require_sender_auth: bool | None | Unset = UNSET + run_on_attachment_mismatch: bool | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -77,6 +81,12 @@ def to_dict(self) -> dict[str, Any]: else: require_sender_auth = self.require_sender_auth + run_on_attachment_mismatch: bool | None | Unset + if isinstance(self.run_on_attachment_mismatch, Unset): + run_on_attachment_mismatch = UNSET + else: + run_on_attachment_mismatch = self.run_on_attachment_mismatch + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) @@ -90,6 +100,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["queue_on_quota"] = queue_on_quota if require_sender_auth is not UNSET: field_dict["require_sender_auth"] = require_sender_auth + if run_on_attachment_mismatch is not UNSET: + field_dict["run_on_attachment_mismatch"] = run_on_attachment_mismatch return field_dict @@ -154,12 +166,24 @@ def _parse_require_sender_auth(data: object) -> bool | None | Unset: d.pop("require_sender_auth", UNSET) ) + def _parse_run_on_attachment_mismatch(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + run_on_attachment_mismatch = _parse_run_on_attachment_mismatch( + d.pop("run_on_attachment_mismatch", UNSET) + ) + set_email_trigger_config_request = cls( alias=alias, allowed_senders=allowed_senders, ignore_auto_generated=ignore_auto_generated, queue_on_quota=queue_on_quota, require_sender_auth=require_sender_auth, + run_on_attachment_mismatch=run_on_attachment_mismatch, ) set_email_trigger_config_request.additional_properties = d diff --git a/seclai/_generated/models/skipped_attachment_reason.py b/seclai/_generated/models/skipped_attachment_reason.py new file mode 100644 index 0000000..bc0c2d6 --- /dev/null +++ b/seclai/_generated/models/skipped_attachment_reason.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class SkippedAttachmentReason(str, Enum): + DISPLAYED_IN_BODY = "displayed_in_body" + NO_FILENAME = "no_filename" + OVER_CAP = "over_cap" + UNDECODABLE = "undecodable" + + def __str__(self) -> str: + return str(self.value) diff --git a/seclai/_generated/models/skipped_attachment_response.py b/seclai/_generated/models/skipped_attachment_response.py new file mode 100644 index 0000000..691c7cf --- /dev/null +++ b/seclai/_generated/models/skipped_attachment_response.py @@ -0,0 +1,100 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.skipped_attachment_reason import SkippedAttachmentReason + +T = TypeVar("T", bound="SkippedAttachmentResponse") + + +@_attrs_define +class SkippedAttachmentResponse: + """A part of an email that was not stored as an attachment. + + Attributes: + content_type (str): The part's declared media type. + filename (None | str): The file name the part is listed under; null when it had none. + reason (SkippedAttachmentReason): + size_bytes (int | None): Decoded size in bytes. + """ + + content_type: str + filename: None | str + reason: SkippedAttachmentReason + size_bytes: int | None + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + content_type = self.content_type + + filename: None | str + filename = self.filename + + reason = self.reason.value + + size_bytes: int | None + size_bytes = self.size_bytes + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "content_type": content_type, + "filename": filename, + "reason": reason, + "size_bytes": size_bytes, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + content_type = d.pop("content_type") + + def _parse_filename(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + filename = _parse_filename(d.pop("filename")) + + reason = SkippedAttachmentReason(d.pop("reason")) + + def _parse_size_bytes(data: object) -> int | None: + if data is None: + return data + return cast(int | None, data) + + size_bytes = _parse_size_bytes(d.pop("size_bytes")) + + skipped_attachment_response = cls( + content_type=content_type, + filename=filename, + reason=reason, + size_bytes=size_bytes, + ) + + skipped_attachment_response.additional_properties = d + return skipped_attachment_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/source_content_status_response.py b/seclai/_generated/models/source_content_status_response.py index 3e8033d..891a3f8 100644 --- a/seclai/_generated/models/source_content_status_response.py +++ b/seclai/_generated/models/source_content_status_response.py @@ -43,17 +43,21 @@ class SourceContentStatusResponse: sweep to drain. The re-embedding is not charged to your account: nothing you did caused it, so Seclai absorbs the cost. Never true for an item that is simply still indexing; content_status covers that. Default: False. extracted_media_capped (bool | Unset): True when extraction stopped with media still unread, so the item - references more media than was indexed and media search will not match anything past the cut. Two causes: a web - page that ran out of the budget for fetching remote assets, or a container that could not be read to the end (a - truncated or hostile archive). An uploaded document that reads cleanly is never capped, however much media it - holds — there is no limit on that. Default: False. - extracted_media_count (int | None | Unset): Number of embedded images / videos extracted from inside this item - and indexed as their own chunks. There is no limit on this — a document contributes as many as it holds. Null - when there is no media record for the item: the extraction pass has not run, does not apply to this container, - or found nothing. Treat null as 'unknown', never as zero. + references more media than was attached and media search will not match anything past the cut. The cause is a + web page that ran out of the budget for fetching remote assets or listed more media than is recorded, or a web + page or document that could not be read to the end. Default: False. + extracted_media_count (int | None | Unset): Number of images / videos in this web page's main content, or of + images inside this PDF or Office document, that were attached to the item on this source; a file over the per- + file size limit, listed as a failed attachment, is not counted. Null when there is no media record for the item: + the extraction pass has not run, does not apply to this container or this source's settings, or found nothing. + Treat null as 'unknown', never as zero. extracted_media_limit (int | None | Unset): The bound that was reached, when extracted_media_capped is true and - the stop was a bound — a number of fetch attempts, or a number of seconds. Null when extraction was not capped, - or when it stopped because the container could not be read rather than because a bound fired. + the stop was a bound — a number of fetch attempts, of seconds, of bytes, or of media listed. Null when + extraction was not capped, or when it stopped because the container could not be read rather than because a + bound fired. + held_for_review (bool | Unset): An ENFORCE governance policy blocked this item at import. It is held for review + and is not retrievable: resolving its blocking evaluations releases it into the source, and it is purged when + the hold window ends. Default: False. """ content_status: str @@ -73,6 +77,7 @@ class SourceContentStatusResponse: extracted_media_capped: bool | Unset = False extracted_media_count: int | None | Unset = UNSET extracted_media_limit: int | None | Unset = UNSET + held_for_review: bool | Unset = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -127,6 +132,8 @@ def to_dict(self) -> dict[str, Any]: else: extracted_media_limit = self.extracted_media_limit + held_for_review = self.held_for_review + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -154,6 +161,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["extracted_media_count"] = extracted_media_count if extracted_media_limit is not UNSET: field_dict["extracted_media_limit"] = extracted_media_limit + if held_for_review is not UNSET: + field_dict["held_for_review"] = held_for_review return field_dict @@ -261,6 +270,8 @@ def _parse_extracted_media_limit(data: object) -> int | None | Unset: d.pop("extracted_media_limit", UNSET) ) + held_for_review = d.pop("held_for_review", UNSET) + source_content_status_response = cls( content_status=content_status, content_token_count=content_token_count, @@ -279,6 +290,7 @@ def _parse_extracted_media_limit(data: object) -> int | None | Unset: extracted_media_capped=extracted_media_capped, extracted_media_count=extracted_media_count, extracted_media_limit=extracted_media_limit, + held_for_review=held_for_review, ) source_content_status_response.additional_properties = d diff --git a/seclai/_generated/models/source_response.py b/seclai/_generated/models/source_response.py index 41dd46f..adb4146 100644 --- a/seclai/_generated/models/source_response.py +++ b/seclai/_generated/models/source_response.py @@ -26,7 +26,7 @@ class SourceResponse: next_poll_at (None | str): Timestamp for the next scheduled poll. polling (None | str): Polling configuration for the source connection. polling_action (None | str): Polling action for the source connection. - polling_max_items (int | None): Maximum items to poll for the source connection. + polling_max_items (int | None): The most new feed items a scheduled poll takes. Read for RSS feeds only. pulled_at (None | str): Timestamp when content was last pulled. retention (int | None): Retention period for the source connection. source_type (str): Type of the source connection. @@ -39,16 +39,37 @@ class SourceResponse: chunk_regex_separators (bool | None | Unset): Indicates if chunk separators are regex patterns. chunk_separators (None | str | Unset): Chunk separators used for content processing. chunk_size (int | None | Unset): Chunk size for content processing. + cloud_drive_connection_id (None | str | Unset): For a cloud_drive source: the id of the connected drive it + indexes. Null for every other source type. + cloud_drive_content_types (None | str | Unset): For a cloud_drive source: the comma-separated MIME types a file + must have to be indexed. Null when there is no filter. + cloud_drive_folder_path (None | str | Unset): For a cloud_drive source: the folder it indexes. Null when it + indexes the connected drive's own folder. + cloud_drive_max_file_mb (int | None | Unset): For a cloud_drive source: the size in megabytes above which a file + is skipped. Null when the source sets no limit of its own. + cloud_drive_path_pattern (None | str | Unset): For a cloud_drive source: the glob a file's path must match to be + indexed. Null when there is none. content_count (int | Unset): Number of content items associated with the source connection. Default: 0. dimensions (int | None | Unset): Dimensions of the embedding model. + document_images (bool | Unset): Whether the images inside PDF, DOCX, PPTX and XLSX files are attached to the + item and indexed; on a source that follows no web pages and has a text-only embedder, by the text in each image. + Applies to documents added after it changes. On a website or RSS source it reports whether `media_types` holds + 'images', and the images are attached only when the source's embedder indexes images. Default: True. + email_address (None | str | Unset): For an email source: the address to send mail to. Null for every other + source type. + email_allowed_senders (list[str] | None | Unset): For an email source: the addresses and domains whose mail is + stored. Null for every other source type. embedding_model (None | str | Unset): Embedding model used for the source connection. embedding_model_type (None | str | Unset): Type of the embedding model. + feed_attachments (list[str] | Unset): Kinds of file listed beside a feed item's content that an RSS source + attaches to the item and indexes (subset of ['enclosures', 'item_image', 'media_rss']). free_retention_days (int | None | Unset): Number of days content is stored for free before billing applies. has_historical_data (bool | Unset): Indicates if the source connection has historical data. Default: False. index_mode (None | SourceIndexMode | Unset): Index mode for custom_index sources: fast_and_cheap, balanced, slow_and_thorough, or custom. - media_types (list[str] | Unset): Media kinds extracted from indexed content and embedded as multi-modal KB - chunks (subset of ['images', 'video']). Empty = text-only. + media_types (list[str] | Unset): Media kinds in a web page's main content that are attached to the page's item + and indexed (subset of ['images', 'video']). On a website or RSS source 'images' also covers the images inside + PDF, DOCX, PPTX and XLSX files. readonly (bool | Unset): Indicates if the source connection is read-only. Default: False. system_managed (bool | Unset): Indicates if this source is automatically managed by the system (e.g., agent traces). Default: False. @@ -75,10 +96,19 @@ class SourceResponse: chunk_regex_separators: bool | None | Unset = UNSET chunk_separators: None | str | Unset = UNSET chunk_size: int | None | Unset = UNSET + cloud_drive_connection_id: None | str | Unset = UNSET + cloud_drive_content_types: None | str | Unset = UNSET + cloud_drive_folder_path: None | str | Unset = UNSET + cloud_drive_max_file_mb: int | None | Unset = UNSET + cloud_drive_path_pattern: None | str | Unset = UNSET content_count: int | Unset = 0 dimensions: int | None | Unset = UNSET + document_images: bool | Unset = True + email_address: None | str | Unset = UNSET + email_allowed_senders: list[str] | None | Unset = UNSET embedding_model: None | str | Unset = UNSET embedding_model_type: None | str | Unset = UNSET + feed_attachments: list[str] | Unset = UNSET free_retention_days: int | None | Unset = UNSET has_historical_data: bool | Unset = False index_mode: None | SourceIndexMode | Unset = UNSET @@ -165,6 +195,36 @@ def to_dict(self) -> dict[str, Any]: else: chunk_size = self.chunk_size + cloud_drive_connection_id: None | str | Unset + if isinstance(self.cloud_drive_connection_id, Unset): + cloud_drive_connection_id = UNSET + else: + cloud_drive_connection_id = self.cloud_drive_connection_id + + cloud_drive_content_types: None | str | Unset + if isinstance(self.cloud_drive_content_types, Unset): + cloud_drive_content_types = UNSET + else: + cloud_drive_content_types = self.cloud_drive_content_types + + cloud_drive_folder_path: None | str | Unset + if isinstance(self.cloud_drive_folder_path, Unset): + cloud_drive_folder_path = UNSET + else: + cloud_drive_folder_path = self.cloud_drive_folder_path + + cloud_drive_max_file_mb: int | None | Unset + if isinstance(self.cloud_drive_max_file_mb, Unset): + cloud_drive_max_file_mb = UNSET + else: + cloud_drive_max_file_mb = self.cloud_drive_max_file_mb + + cloud_drive_path_pattern: None | str | Unset + if isinstance(self.cloud_drive_path_pattern, Unset): + cloud_drive_path_pattern = UNSET + else: + cloud_drive_path_pattern = self.cloud_drive_path_pattern + content_count = self.content_count dimensions: int | None | Unset @@ -173,6 +233,23 @@ def to_dict(self) -> dict[str, Any]: else: dimensions = self.dimensions + document_images = self.document_images + + email_address: None | str | Unset + if isinstance(self.email_address, Unset): + email_address = UNSET + else: + email_address = self.email_address + + email_allowed_senders: list[str] | None | Unset + if isinstance(self.email_allowed_senders, Unset): + email_allowed_senders = UNSET + elif isinstance(self.email_allowed_senders, list): + email_allowed_senders = self.email_allowed_senders + + else: + email_allowed_senders = self.email_allowed_senders + embedding_model: None | str | Unset if isinstance(self.embedding_model, Unset): embedding_model = UNSET @@ -185,6 +262,10 @@ def to_dict(self) -> dict[str, Any]: else: embedding_model_type = self.embedding_model_type + feed_attachments: list[str] | Unset = UNSET + if not isinstance(self.feed_attachments, Unset): + feed_attachments = self.feed_attachments + free_retention_days: int | None | Unset if isinstance(self.free_retention_days, Unset): free_retention_days = UNSET @@ -243,14 +324,32 @@ def to_dict(self) -> dict[str, Any]: field_dict["chunk_separators"] = chunk_separators if chunk_size is not UNSET: field_dict["chunk_size"] = chunk_size + if cloud_drive_connection_id is not UNSET: + field_dict["cloud_drive_connection_id"] = cloud_drive_connection_id + if cloud_drive_content_types is not UNSET: + field_dict["cloud_drive_content_types"] = cloud_drive_content_types + if cloud_drive_folder_path is not UNSET: + field_dict["cloud_drive_folder_path"] = cloud_drive_folder_path + if cloud_drive_max_file_mb is not UNSET: + field_dict["cloud_drive_max_file_mb"] = cloud_drive_max_file_mb + if cloud_drive_path_pattern is not UNSET: + field_dict["cloud_drive_path_pattern"] = cloud_drive_path_pattern if content_count is not UNSET: field_dict["content_count"] = content_count if dimensions is not UNSET: field_dict["dimensions"] = dimensions + if document_images is not UNSET: + field_dict["document_images"] = document_images + if email_address is not UNSET: + field_dict["email_address"] = email_address + if email_allowed_senders is not UNSET: + field_dict["email_allowed_senders"] = email_allowed_senders if embedding_model is not UNSET: field_dict["embedding_model"] = embedding_model if embedding_model_type is not UNSET: field_dict["embedding_model_type"] = embedding_model_type + if feed_attachments is not UNSET: + field_dict["feed_attachments"] = feed_attachments if free_retention_days is not UNSET: field_dict["free_retention_days"] = free_retention_days if has_historical_data is not UNSET: @@ -401,6 +500,61 @@ def _parse_chunk_size(data: object) -> int | None | Unset: chunk_size = _parse_chunk_size(d.pop("chunk_size", UNSET)) + def _parse_cloud_drive_connection_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_connection_id = _parse_cloud_drive_connection_id( + d.pop("cloud_drive_connection_id", UNSET) + ) + + def _parse_cloud_drive_content_types(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_content_types = _parse_cloud_drive_content_types( + d.pop("cloud_drive_content_types", UNSET) + ) + + def _parse_cloud_drive_folder_path(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_folder_path = _parse_cloud_drive_folder_path( + d.pop("cloud_drive_folder_path", UNSET) + ) + + def _parse_cloud_drive_max_file_mb(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + cloud_drive_max_file_mb = _parse_cloud_drive_max_file_mb( + d.pop("cloud_drive_max_file_mb", UNSET) + ) + + def _parse_cloud_drive_path_pattern(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_path_pattern = _parse_cloud_drive_path_pattern( + d.pop("cloud_drive_path_pattern", UNSET) + ) + content_count = d.pop("content_count", UNSET) def _parse_dimensions(data: object) -> int | None | Unset: @@ -412,6 +566,36 @@ def _parse_dimensions(data: object) -> int | None | Unset: dimensions = _parse_dimensions(d.pop("dimensions", UNSET)) + document_images = d.pop("document_images", UNSET) + + def _parse_email_address(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + email_address = _parse_email_address(d.pop("email_address", UNSET)) + + def _parse_email_allowed_senders(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + email_allowed_senders_type_0 = cast(list[str], data) + + return email_allowed_senders_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + email_allowed_senders = _parse_email_allowed_senders( + d.pop("email_allowed_senders", UNSET) + ) + def _parse_embedding_model(data: object) -> None | str | Unset: if data is None: return data @@ -432,6 +616,8 @@ def _parse_embedding_model_type(data: object) -> None | str | Unset: d.pop("embedding_model_type", UNSET) ) + feed_attachments = cast(list[str], d.pop("feed_attachments", UNSET)) + def _parse_free_retention_days(data: object) -> int | None | Unset: if data is None: return data @@ -490,10 +676,19 @@ def _parse_index_mode(data: object) -> None | SourceIndexMode | Unset: chunk_regex_separators=chunk_regex_separators, chunk_separators=chunk_separators, chunk_size=chunk_size, + cloud_drive_connection_id=cloud_drive_connection_id, + cloud_drive_content_types=cloud_drive_content_types, + cloud_drive_folder_path=cloud_drive_folder_path, + cloud_drive_max_file_mb=cloud_drive_max_file_mb, + cloud_drive_path_pattern=cloud_drive_path_pattern, content_count=content_count, dimensions=dimensions, + document_images=document_images, + email_address=email_address, + email_allowed_senders=email_allowed_senders, embedding_model=embedding_model, embedding_model_type=embedding_model_type, + feed_attachments=feed_attachments, free_retention_days=free_retention_days, has_historical_data=has_historical_data, index_mode=index_mode, diff --git a/seclai/_generated/models/test_draft_evaluation_response.py b/seclai/_generated/models/test_draft_evaluation_response.py index 6b294fc..942bfa6 100644 --- a/seclai/_generated/models/test_draft_evaluation_response.py +++ b/seclai/_generated/models/test_draft_evaluation_response.py @@ -6,6 +6,8 @@ from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..models.evaluation_status import EvaluationStatus + T = TypeVar("T", bound="TestDraftEvaluationResponse") @@ -17,11 +19,13 @@ class TestDraftEvaluationResponse: explanation (None | str): passed (bool): score (float): + status (EvaluationStatus): Result status of a single evaluation run. """ explanation: None | str passed: bool score: float + status: EvaluationStatus additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -32,6 +36,8 @@ def to_dict(self) -> dict[str, Any]: score = self.score + status = self.status.value + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -39,6 +45,7 @@ def to_dict(self) -> dict[str, Any]: "explanation": explanation, "passed": passed, "score": score, + "status": status, } ) @@ -59,10 +66,13 @@ def _parse_explanation(data: object) -> None | str: score = d.pop("score") + status = EvaluationStatus(d.pop("status")) + test_draft_evaluation_response = cls( explanation=explanation, passed=passed, score=score, + status=status, ) test_draft_evaluation_response.additional_properties = d diff --git a/seclai/_generated/models/update_agent_definition_request.py b/seclai/_generated/models/update_agent_definition_request.py index b259795..5f83001 100644 --- a/seclai/_generated/models/update_agent_definition_request.py +++ b/seclai/_generated/models/update_agent_definition_request.py @@ -1,12 +1,15 @@ from __future__ import annotations from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..types import UNSET, Unset + if TYPE_CHECKING: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot from ..models.update_agent_definition_request_definition import ( UpdateAgentDefinitionRequestDefinition, ) @@ -24,10 +27,14 @@ class UpdateAgentDefinitionRequest: enrichment steps (write_metadata, write_content_attachment, load_content_attachment, load_content) require content-triggered agents. expected_change_id (str): The change_id from the last GET, for optimistic locking. + accepted_attachments (list[AcceptedAttachmentSlot] | None | Unset): When given, declared on the main branch's + file-taking triggers in the same save, so the steps may read its slots as `{{agent.attachments.}}`; + omitted, the triggers keep theirs. """ definition: UpdateAgentDefinitionRequestDefinition expected_change_id: str + accepted_attachments: list[AcceptedAttachmentSlot] | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -35,6 +42,20 @@ def to_dict(self) -> dict[str, Any]: expected_change_id = self.expected_change_id + accepted_attachments: list[dict[str, Any]] | None | Unset + if isinstance(self.accepted_attachments, Unset): + accepted_attachments = UNSET + elif isinstance(self.accepted_attachments, list): + accepted_attachments = [] + for accepted_attachments_type_0_item_data in self.accepted_attachments: + accepted_attachments_type_0_item = ( + accepted_attachments_type_0_item_data.to_dict() + ) + accepted_attachments.append(accepted_attachments_type_0_item) + + else: + accepted_attachments = self.accepted_attachments + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -43,11 +64,14 @@ def to_dict(self) -> dict[str, Any]: "expected_change_id": expected_change_id, } ) + if accepted_attachments is not UNSET: + field_dict["accepted_attachments"] = accepted_attachments return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.accepted_attachment_slot import AcceptedAttachmentSlot from ..models.update_agent_definition_request_definition import ( UpdateAgentDefinitionRequestDefinition, ) @@ -59,9 +83,40 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: expected_change_id = d.pop("expected_change_id") + def _parse_accepted_attachments( + data: object, + ) -> list[AcceptedAttachmentSlot] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + accepted_attachments_type_0 = [] + _accepted_attachments_type_0 = data + for ( + accepted_attachments_type_0_item_data + ) in _accepted_attachments_type_0: + accepted_attachments_type_0_item = AcceptedAttachmentSlot.from_dict( + accepted_attachments_type_0_item_data + ) + + accepted_attachments_type_0.append(accepted_attachments_type_0_item) + + return accepted_attachments_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[AcceptedAttachmentSlot] | None | Unset, data) + + accepted_attachments = _parse_accepted_attachments( + d.pop("accepted_attachments", UNSET) + ) + update_agent_definition_request = cls( definition=definition, expected_change_id=expected_change_id, + accepted_attachments=accepted_attachments, ) update_agent_definition_request.additional_properties = d diff --git a/seclai/_generated/models/update_source_body.py b/seclai/_generated/models/update_source_body.py index f946686..844e072 100644 --- a/seclai/_generated/models/update_source_body.py +++ b/seclai/_generated/models/update_source_body.py @@ -16,10 +16,28 @@ class UpdateSourceBody: """Request body for updating a content source. Attributes: - media_types (list[str] | None | Unset): Media kinds to extract from indexed content and embed as multi-modal KB - chunks. Subset of ['images', 'video']. Only kinds the source's embedder can index are honored (see - `supported_input_media` on GET /models/embedders); unsupported values are dropped. [] disables media extraction - (text-only). + cloud_drive_content_types (None | str | Unset): For a cloud_drive source: comma-separated MIME types a file must + have to be indexed. Send an empty string to clear it; omit to leave it unchanged. + cloud_drive_folder_path (None | str | Unset): For a cloud_drive source: the folder to index, as a path inside + the drive. Send an empty string to index the connected drive's own folder; omit to leave it unchanged. + cloud_drive_max_file_mb (int | None | Unset): For a cloud_drive source: files larger than this many megabytes + are skipped. Send 0 to clear the source's own limit; omit to leave it unchanged. + cloud_drive_path_pattern (None | str | Unset): For a cloud_drive source: a glob a file's path must match to be + indexed, such as `**/*.pdf` or `/reports/*`. Send an empty string to clear it; omit to leave it unchanged. + document_images (bool | None | Unset): Whether the images inside PDF, DOCX, PPTX and XLSX files are attached to + the item and indexed; on a text-only embedder, by the text in each image. Applies to documents added after it + changes. Omit the field to leave it unchanged. On a website or RSS source it is ignored: `media_types` decides. + email_allowed_senders (list[str] | None | Unset): For an email source: replaces the allowed senders. Each entry + is a full address or a bare domain. The list cannot be emptied. Omit to leave it unchanged. + feed_attachments (list[str] | None | Unset): Kinds of file listed beside a feed item's content to attach to the + item and index, on an RSS source. Subset of ['enclosures', 'item_image', 'media_rss']; any other value is + refused. [] attaches none. Applies to items added after it changes. Omit the field to leave it unchanged. + media_types (list[str] | None | Unset): Media kinds in a web page's main content to attach to the page's item + and index, on a website or RSS source. Subset of ['images', 'video']. From `Seclai-Version: 2026-10-13` any + other value, and any kind on another source type, is refused with a 400; older versions drop an unknown value + and store the rest. A kind the source's embedder cannot index is stored and not indexed (see + `supported_input_media` on GET /models/embedders). [] attaches no media from web pages. 'images' also covers the + images inside PDF, DOCX, PPTX and XLSX files. Applies to pages and documents added after it changes. name (None | str | Unset): New name. polling (None | str | Unset): New polling interval. retention_days (int | None | Unset): New retention period in days — content older than this is deleted @@ -27,6 +45,13 @@ class UpdateSourceBody: unchanged. """ + cloud_drive_content_types: None | str | Unset = UNSET + cloud_drive_folder_path: None | str | Unset = UNSET + cloud_drive_max_file_mb: int | None | Unset = UNSET + cloud_drive_path_pattern: None | str | Unset = UNSET + document_images: bool | None | Unset = UNSET + email_allowed_senders: list[str] | None | Unset = UNSET + feed_attachments: list[str] | None | Unset = UNSET media_types: list[str] | None | Unset = UNSET name: None | str | Unset = UNSET polling: None | str | Unset = UNSET @@ -34,6 +59,54 @@ class UpdateSourceBody: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + cloud_drive_content_types: None | str | Unset + if isinstance(self.cloud_drive_content_types, Unset): + cloud_drive_content_types = UNSET + else: + cloud_drive_content_types = self.cloud_drive_content_types + + cloud_drive_folder_path: None | str | Unset + if isinstance(self.cloud_drive_folder_path, Unset): + cloud_drive_folder_path = UNSET + else: + cloud_drive_folder_path = self.cloud_drive_folder_path + + cloud_drive_max_file_mb: int | None | Unset + if isinstance(self.cloud_drive_max_file_mb, Unset): + cloud_drive_max_file_mb = UNSET + else: + cloud_drive_max_file_mb = self.cloud_drive_max_file_mb + + cloud_drive_path_pattern: None | str | Unset + if isinstance(self.cloud_drive_path_pattern, Unset): + cloud_drive_path_pattern = UNSET + else: + cloud_drive_path_pattern = self.cloud_drive_path_pattern + + document_images: bool | None | Unset + if isinstance(self.document_images, Unset): + document_images = UNSET + else: + document_images = self.document_images + + email_allowed_senders: list[str] | None | Unset + if isinstance(self.email_allowed_senders, Unset): + email_allowed_senders = UNSET + elif isinstance(self.email_allowed_senders, list): + email_allowed_senders = self.email_allowed_senders + + else: + email_allowed_senders = self.email_allowed_senders + + feed_attachments: list[str] | None | Unset + if isinstance(self.feed_attachments, Unset): + feed_attachments = UNSET + elif isinstance(self.feed_attachments, list): + feed_attachments = self.feed_attachments + + else: + feed_attachments = self.feed_attachments + media_types: list[str] | None | Unset if isinstance(self.media_types, Unset): media_types = UNSET @@ -64,6 +137,20 @@ def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) + if cloud_drive_content_types is not UNSET: + field_dict["cloud_drive_content_types"] = cloud_drive_content_types + if cloud_drive_folder_path is not UNSET: + field_dict["cloud_drive_folder_path"] = cloud_drive_folder_path + if cloud_drive_max_file_mb is not UNSET: + field_dict["cloud_drive_max_file_mb"] = cloud_drive_max_file_mb + if cloud_drive_path_pattern is not UNSET: + field_dict["cloud_drive_path_pattern"] = cloud_drive_path_pattern + if document_images is not UNSET: + field_dict["document_images"] = document_images + if email_allowed_senders is not UNSET: + field_dict["email_allowed_senders"] = email_allowed_senders + if feed_attachments is not UNSET: + field_dict["feed_attachments"] = feed_attachments if media_types is not UNSET: field_dict["media_types"] = media_types if name is not UNSET: @@ -79,6 +166,95 @@ def to_dict(self) -> dict[str, Any]: def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) + def _parse_cloud_drive_content_types(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_content_types = _parse_cloud_drive_content_types( + d.pop("cloud_drive_content_types", UNSET) + ) + + def _parse_cloud_drive_folder_path(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_folder_path = _parse_cloud_drive_folder_path( + d.pop("cloud_drive_folder_path", UNSET) + ) + + def _parse_cloud_drive_max_file_mb(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + cloud_drive_max_file_mb = _parse_cloud_drive_max_file_mb( + d.pop("cloud_drive_max_file_mb", UNSET) + ) + + def _parse_cloud_drive_path_pattern(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + cloud_drive_path_pattern = _parse_cloud_drive_path_pattern( + d.pop("cloud_drive_path_pattern", UNSET) + ) + + def _parse_document_images(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + document_images = _parse_document_images(d.pop("document_images", UNSET)) + + def _parse_email_allowed_senders(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + email_allowed_senders_type_0 = cast(list[str], data) + + return email_allowed_senders_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + email_allowed_senders = _parse_email_allowed_senders( + d.pop("email_allowed_senders", UNSET) + ) + + def _parse_feed_attachments(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + feed_attachments_type_0 = cast(list[str], data) + + return feed_attachments_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + feed_attachments = _parse_feed_attachments(d.pop("feed_attachments", UNSET)) + def _parse_media_types(data: object) -> list[str] | None | Unset: if data is None: return data @@ -124,6 +300,13 @@ def _parse_retention_days(data: object) -> int | None | Unset: retention_days = _parse_retention_days(d.pop("retention_days", UNSET)) update_source_body = cls( + cloud_drive_content_types=cloud_drive_content_types, + cloud_drive_folder_path=cloud_drive_folder_path, + cloud_drive_max_file_mb=cloud_drive_max_file_mb, + cloud_drive_path_pattern=cloud_drive_path_pattern, + document_images=document_images, + email_allowed_senders=email_allowed_senders, + feed_attachments=feed_attachments, media_types=media_types, name=name, polling=polling, diff --git a/seclai/seclai.py b/seclai/seclai.py index 3c2b425..8688433 100644 --- a/seclai/seclai.py +++ b/seclai/seclai.py @@ -47,18 +47,40 @@ from http import HTTPStatus from io import BytesIO from pathlib import Path -from typing import Any, BinaryIO, Literal, Self, TypedDict, TypeVar, cast, overload +from typing import ( + Any, + BinaryIO, + Literal, + NotRequired, + Self, + TypedDict, + TypeVar, + cast, + overload, +) import httpx from seclai._generated.client import Client as GeneratedClient +from seclai._generated.models.accepted_attachments_response import ( + AcceptedAttachmentsResponse, +) from seclai._generated.models.agent_run_list_response import AgentRunListResponse from seclai._generated.models.agent_run_request import AgentRunRequest from seclai._generated.models.agent_run_response import AgentRunResponse +from seclai._generated.models.content_attachment_detail_response import ( + ContentAttachmentDetailResponse, +) +from seclai._generated.models.content_attachments_list_response import ( + ContentAttachmentsListResponse, +) from seclai._generated.models.content_detail_response import ContentDetailResponse from seclai._generated.models.content_embeddings_list_response import ( ContentEmbeddingsListResponse, ) +from seclai._generated.models.email_source_rejection_list_response import ( + EmailSourceRejectionListResponse, +) from seclai._generated.models.file_upload_response import FileUploadResponse from seclai._generated.models.http_validation_error import HTTPValidationError from seclai._generated.models.source_list_response import SourceListResponse @@ -83,11 +105,22 @@ class AgentRunStreamRequest(TypedDict): """Request body for streaming agent runs. - This matches the API schema for POST /agents/{agent_id}/runs/stream. + This matches the API schema for POST /agents/{agent_id}/runs/stream. Every + key is optional, as in the schema: a run on an uploaded file can send only + ``input_upload_id``. """ - input: str | None - metadata: dict[str, JSONValue] + input: NotRequired[str | None] + metadata: NotRequired[dict[str, JSONValue] | None] + #: Receive ``stream_reasoning`` events carrying the model's reasoning, for a + #: ``streaming_result`` step whose author enabled ``show_reasoning``. Only + #: :meth:`Seclai.run_streaming_agent` yields them; + #: :meth:`Seclai.run_streaming_agent_and_wait` removes this key before + #: sending, since it keeps only the ``init`` and ``done`` events. + include_reasoning: NotRequired[bool] + input_upload_id: NotRequired[str | None] + input_upload_ids: NotRequired[list[str] | None] + replay_of_run_id: NotRequired[str | None] #: Default API base URL. Override via the ``SECLAI_API_URL`` environment variable. @@ -272,6 +305,11 @@ def _empty_page(*, page: int, limit: int) -> dict[str, Any]: } +def _without_reasoning(body: AgentRunStreamRequest) -> dict[str, Any]: + """Return ``body`` without ``include_reasoning``, for a caller that drops reasoning events.""" + return {k: v for k, v in body.items() if k != "include_reasoning"} + + def _strip_none(params: dict[str, Any]) -> dict[str, Any]: """Remove keys with ``None`` values from a parameter dictionary.""" return {k: v for k, v in params.items() if v is not None} @@ -293,6 +331,26 @@ def _expect_model(parsed: object, model: type[_ModelT]) -> _ModelT: return parsed +def _parse_model(payload: object, model: type[_ModelT]) -> _ModelT: + """Decode a JSON response body returned by ``request`` into ``model``. + + A body that is not a JSON object, or does not fit the model, raises + `SeclaiError` rather than the ``KeyError``/``TypeError`` the generated + ``from_dict`` would, so ``except SeclaiError`` handlers still catch it. + Its callers use ``request`` rather than the generated ``sync_detailed`` for + that reason. + """ + if not isinstance(payload, dict): + raise SeclaiError( + f"Expected a JSON object for {model.__name__}, got {type(payload).__name__}." + ) + try: + # Every generated model has a ``from_dict`` classmethod. + return cast(_ModelT, cast(Any, model).from_dict(payload)) + except (KeyError, TypeError, ValueError, AttributeError) as e: + raise SeclaiError(f"Could not decode {model.__name__}: {e!r}") from e + + class SeclaiError(Exception): """Base error for the Seclai SDK.""" @@ -583,6 +641,54 @@ def _raise_for_status(response: httpx.Response) -> None: ) +def _raise_for_unread_status(response: httpx.Response) -> None: + """Raise on an error status of a streamed response whose body is unread. + + The body is read for the error text and the response closed before + raising. A transport error while reading that body still raises the status + error, without response text and with the transport error as its + ``__cause__``, so the status a caller sees does not depend on whether the + error body arrived. + """ + if not response.is_error: + return + read_error: httpx.HTTPError | None = None + try: + response.read() + except httpx.HTTPError as e: + read_error = e + finally: + response.close() + _raise_for_read_status(response, read_error) + + +async def _araise_for_unread_status(response: httpx.Response) -> None: + """Async twin of :func:`_raise_for_unread_status`.""" + if not response.is_error: + return + read_error: httpx.HTTPError | None = None + try: + await response.aread() + except httpx.HTTPError as e: + read_error = e + finally: + await response.aclose() + _raise_for_read_status(response, read_error) + + +def _raise_for_read_status( + response: httpx.Response, read_error: httpx.HTTPError | None +) -> None: + """Raise the status error, chained to ``read_error`` when the body read failed.""" + if read_error is None: + _raise_for_status(response) + return + try: + _raise_for_status(response) + except SeclaiError as e: + raise e from read_error + + def _send_url(client: httpx.Client | httpx.AsyncClient, path: str) -> str: """Return ``path`` for a client with a base URL, else the absolute API URL.""" return path if str(client.base_url) else f"{SECLAI_API_URL.rstrip('/')}{path}" @@ -1021,6 +1127,29 @@ def request( return cast(JSONValue, response.json()) return response.text + def _stream_get( + self, path: str, *, params: Mapping[str, Any] | None = None + ) -> httpx.Response: + """Send a GET and return the response unread, for the caller to stream. + + On an error status the body is read for the error message and the + connection released before raising; see + :func:`_raise_for_unread_status`. + """ + request = self._client.build_request( + "GET", + path, + params=params, + headers=_merge_request_headers( + options=self._options, + client_headers=self._client.headers, + request_headers=None, + ), + ) + response = self._client.send(request, stream=True) + _raise_for_unread_status(response) + return response + def run_agent(self, agent_id: str, body: AgentRunRequest) -> AgentRunResponse: """Run an agent. @@ -1083,7 +1212,11 @@ def run_streaming_agent_and_wait( """Run an agent via SSE streaming and block until completion. This uses POST /agents/{agent_id}/runs/stream and consumes Server-Sent Events (SSE). - The method returns when an `event: done` message is received. + The method returns when an `event: done` message is received. Every event + but `init` and `done` is discarded, so `include_reasoning` is removed + from the body before it is sent: reasoning events would only add + traffic and count against `timeout`. Use `run_streaming_agent` to + receive `stream_reasoning` events. Args: agent_id: Agent identifier. @@ -1119,15 +1252,13 @@ def run_streaming_agent_and_wait( with self._client.stream( "POST", path, - json=body, + json=_without_reasoning(body), headers=merged_headers, timeout=timeout_seconds, ) as response: - if response.status_code >= 400: - # Lazy body inside `stream()`; read it so the error carries - # its text and a 422 its field-level detail. - response.read() - _raise_for_status(response) + # Lazy body inside `stream()`; read it so the error carries + # its text and a 422 its field-level detail. + _raise_for_unread_status(response) current_event: str | None = None data_lines: list[str] = [] @@ -1527,6 +1658,158 @@ def list_content_embeddings( ) return _expect_model(parsed, ContentEmbeddingsListResponse) + def list_content_attachments( + self, + source_connection_content_version: str, + *, + page: int | None = None, + limit: int | None = None, + ) -> ContentAttachmentsListResponse: + """List the files attached to a content item. + + An agent's ``write_content_attachment`` step attaches a file, an email + source attaches the files sent with a message, an RSS source the feed + files chosen in its ``feed_attachments``, and a source that indexes + media or document images attaches those images and videos. + + Args: + source_connection_content_version: Content version identifier. + page: Page number (1-indexed, default 1). + limit: Items per page (default 20). + + Returns: + The attachments under ``data``, each with its indexing status, and + ``pagination``. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code. + SeclaiError: If the response body does not decode as the model. + """ + payload = self.request( + "GET", + f"/contents/{source_connection_content_version}/attachments", + params=_strip_none({"page": page, "limit": limit}), + ) + return _parse_model(payload, ContentAttachmentsListResponse) + + def get_content_attachment( + self, + source_connection_content_version: str, + attachment_id: str, + *, + start: int | None = None, + end: int | None = None, + ) -> ContentAttachmentDetailResponse: + """Get one file attached to a content item. + + Args: + source_connection_content_version: Content version identifier. + attachment_id: The ``id`` of an entry in + :meth:`list_content_attachments`. + start: Start offset of the returned text. Omitted, the API + uses 0. + end: End offset of the returned text. Omitted, the API uses 5000. + Any value from 0, the API's minimum, is sent as given, so + ``end=0`` asks for the status and metadata without the text. + Unlike :meth:`get_content_detail`, which defaults to + ``start=0`` and ``end=5000`` and always sends both, this sends + ``start`` and ``end`` only when given. + + Returns: + The attachment's indexing status and reason, its metadata, and the + text it is indexed by. A file that was not indexed has no text. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code, + including 402 when the account has no credits left. + SeclaiError: If the response body does not decode as the model. + """ + payload = self.request( + "GET", + f"/contents/{source_connection_content_version}/attachments/{attachment_id}", + params=_strip_none({"start": start, "end": end}), + ) + return _parse_model(payload, ContentAttachmentDetailResponse) + + def list_content_attachment_embeddings( + self, + source_connection_content_version: str, + attachment_id: str, + *, + page: int | None = None, + limit: int | None = None, + ) -> ContentEmbeddingsListResponse: + """List the embeddings an attached file is indexed by. + + Args: + source_connection_content_version: Content version identifier. + attachment_id: Attachment identifier. + page: Page number (1-indexed, default 1). + limit: Items per page (1-100, default 20). + + Returns: + A page of embeddings, the same model as + :meth:`list_content_embeddings`; empty for a file with no completed + index. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code, + including 402 when the account has no credits left. + SeclaiError: If the response body does not decode as the model. + """ + payload = self.request( + "GET", + f"/contents/{source_connection_content_version}/attachments/{attachment_id}/embeddings", + params=_strip_none({"page": page, "limit": limit}), + ) + return _parse_model(payload, ContentEmbeddingsListResponse) + + def download_content_attachment( + self, + source_connection_content_version: str, + attachment_id: str, + ) -> httpx.Response: + """Download the bytes of a file attached to a content item. + + Returns a **streaming** response. The caller is responsible for + consuming and closing the response:: + + response = client.download_content_attachment("content", "att") + try: + for chunk in response.iter_bytes(): + f.write(chunk) + finally: + response.close() + + Images, audio, video, PDF and plain text are served with their own + content type; anything else as ``application/octet-stream``. A file + withheld by a governance policy, or still being indexed after arriving + from outside, answers 403 — the attachment's ``file_withheld`` field + says which beforehand. An account with no credits left gets 402. + + The client's ``timeout`` bounds connecting and each read, not the whole + transfer, so a large file is not cut off while bytes keep arriving. + Closing the response stops a download early. + + Args: + source_connection_content_version: Content version identifier. + attachment_id: Attachment identifier. + + Returns: + A streaming ``httpx.Response``. Must be closed by the caller. + + Raises: + SeclaiAPIStatusError: If the API returns a non-success status code: + 403 for a withheld file, 402 when the account has no credits + left. + """ + return self._stream_get( + f"/contents/{source_connection_content_version}/attachments/{attachment_id}/file" + ) + def list_sources( self, *, @@ -2182,6 +2465,16 @@ def upload_agent_input( ) -> dict[str, Any]: """Upload a file as input for an agent run. + Only a ``dynamic_input`` agent takes uploads; any other agent answers + 400. The limit is 200 MB per file. + + From ``Seclai-Version: 2026-10-16`` a file of any type is accepted and + is ``ready`` at once, so pass its ``upload_id`` as ``input_upload_id`` + to a run straight away. Earlier versions accept only a fixed list of + extensions and extract each file's text into ``input``: poll + :meth:`get_agent_input_upload_status` until ``status`` is ``ready`` + before running. + Args: agent_id: Agent identifier. file: File payload (bytes, path, or file-like). @@ -2241,7 +2534,8 @@ def get_agent_attachment_references(self, agent_id: str) -> dict[str, Any]: agent_id: Agent identifier. Returns: - The agent's attachment-reference contract. + The agent's attachment-reference contract, including the + ``accepted_attachments`` its trigger declares. """ return cast( dict[str, Any], @@ -2264,9 +2558,11 @@ def download_agent_run_attachment( consuming and closing the response:: response = client.download_agent_run_attachment("run", "att") - with response: + try: for chunk in response.iter_bytes(): f.write(chunk) + finally: + response.close() Args: run_id: Run identifier. @@ -2278,25 +2574,10 @@ def download_agent_run_attachment( Returns: A streaming ``httpx.Response``. Must be closed by the caller. """ - request = self._client.build_request( - "GET", + return self._stream_get( f"/v2/agent-runs/{run_id}/attachments/{attachment_id}", params=_strip_none({"download_name": download_name}), - headers=_merge_request_headers( - options=self._options, - client_headers=self._client.headers, - request_headers=None, - ), ) - response = self._client.send(request, stream=True) - if response.is_error: - # Read the body for a useful error message, then release the - # connection before raising — the caller never receives the - # streaming response on the error path. - response.read() - response.close() - _raise_for_status(response) - return response # ── Agent AI Assistant ──────────────────────────────────────────────────── @@ -2626,7 +2907,9 @@ def test_draft_evaluation( body: Draft evaluation criteria and test run. Returns: - Test evaluation result. + Test evaluation result. ``status`` is ``"error"`` when the evaluator + returned no verdict; from ``2026-10-21`` ``score`` and ``passed`` are + then ``None``, and earlier versions return ``0.5`` and ``False``. """ return cast( dict[str, Any], @@ -2749,7 +3032,8 @@ def get_non_manual_evaluation_summary(self, agent_id: str) -> dict[str, Any]: Summary of automated evaluation results — for ``agent_id`` when the client has opted in, account-wide otherwise. The two are indistinguishable in the payload, so check the client's - ``api_version`` rather than the response. + ``api_version`` rather than the response. From ``2026-10-21``, + ``failed`` and the rates leave out results counted in ``error``. """ return cast( dict[str, Any], @@ -2944,7 +3228,8 @@ def set_email_trigger_config( agent_id: Agent identifier. trigger_id: Trigger identifier. body: Fields to set (alias, allowed_senders, ignore_auto_generated, - require_sender_auth, queue_on_quota). Omitted fields are unchanged. + require_sender_auth, queue_on_quota, run_on_attachment_mismatch). + Omitted fields are unchanged. Returns: The trigger's resolved email address(es) and config. @@ -2959,6 +3244,45 @@ def set_email_trigger_config( ), ) + def set_accepted_attachments( + self, + agent_id: str, + trigger_id: str, + accepted_attachments: list[dict[str, Any]] | None, + ) -> AcceptedAttachmentsResponse: + """Declare the input attachments a trigger accepts. + + Replaces the trigger's declaration. A run's files are each assigned to + one declared attachment before any step runs, and steps reference one as + ``{{agent.attachments.}}``. Only ``dynamic_input`` and + ``email_received`` triggers take files. The API answers 400 when the + agent references an attachment the new declaration leaves out. + + Args: + agent_id: Agent identifier. + trigger_id: Trigger identifier, as :meth:`get_agent` returns it. + accepted_attachments: The attachments, each with a ``name`` and + optional ``label``, ``content_types``, ``name_pattern``, ``min`` + and ``max``. ``None`` accepts any files, as one attachment named + ``files``. Sent as given, so ``None`` is sent as ``null``. + + Returns: + The trigger's ``accepted_attachments`` with its ``agent_id`` and + ``trigger_id``. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code. + SeclaiError: If the response body does not decode as the model. + """ + body: dict[str, Any] = {"accepted_attachments": accepted_attachments} + payload = self.request( + "PUT", + f"/agents/{agent_id}/triggers/{trigger_id}/accepted-attachments", + json=body, + ) + return _parse_model(payload, AcceptedAttachmentsResponse) + # ── Knowledge Bases ─────────────────────────────────────────────────────── def list_knowledge_bases( @@ -3328,6 +3652,42 @@ def update_source(self, source_id: str, body: dict[str, Any]) -> dict[str, Any]: ), ) + def list_email_source_rejections( + self, + source_id: str, + *, + page: int | None = None, + limit: int | None = None, + ) -> EmailSourceRejectionListResponse: + """List mail an email content source refused, newest first. + + Each entry says who sent the message and why it was refused, never its + subject or body. To accept a refused sender, add its ``from_address`` or + that address's domain to the source's ``email_allowed_senders`` — which + only helps when ``authenticated`` is true. Requires an account owner or + administrator; the API answers 404 for a source that is not an email + source. + + Args: + source_id: Source identifier. + page: Page number (1-indexed, default 1). + limit: Items per page (1-100, default 20). + + Returns: + The refusals under ``data``, and ``pagination``. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code. + SeclaiError: If the response body does not decode as the model. + """ + payload = self.request( + "GET", + f"/sources/{source_id}/email-rejections", + params=_strip_none({"page": page, "limit": limit}), + ) + return _parse_model(payload, EmailSourceRejectionListResponse) + def delete_source(self, source_id: str) -> None: """Delete a source. @@ -3524,9 +3884,11 @@ def download_source_export(self, source_id: str, export_id: str) -> httpx.Respon consuming and closing the response:: response = client.download_source_export("src", "exp") - with response: + try: for chunk in response.iter_bytes(): f.write(chunk) + finally: + response.close() Args: source_id: Source identifier. @@ -3535,24 +3897,7 @@ def download_source_export(self, source_id: str, export_id: str) -> httpx.Respon Returns: A streaming ``httpx.Response``. Must be closed by the caller. """ - request = self._client.build_request( - "GET", - f"/sources/{source_id}/exports/{export_id}/download", - headers=_merge_request_headers( - options=self._options, - client_headers=self._client.headers, - request_headers=None, - ), - ) - response = self._client.send(request, stream=True) - if response.is_error: - # Read the body for a useful error message, then release the - # connection before raising — the caller never receives the - # streaming response on the error path. - response.read() - response.close() - _raise_for_status(response) - return response + return self._stream_get(f"/sources/{source_id}/exports/{export_id}/download") def estimate_source_export( self, source_id: str, body: dict[str, Any] @@ -5082,11 +5427,9 @@ def run_streaming_agent( headers=merged_headers, timeout=timeout_seconds, ) as response: - if response.status_code >= 400: - # Lazy body inside `stream()`; read it so a 422's field-level - # detail survives into SeclaiAPIValidationError. - response.read() - _raise_for_status(response) + # Lazy body inside `stream()`; read it so a 422's field-level + # detail survives into SeclaiAPIValidationError. + _raise_for_unread_status(response) current_event: str | None = None data_lines: list[str] = [] @@ -5326,6 +5669,29 @@ async def request( return cast(JSONValue, response.json()) return response.text + async def _stream_get( + self, path: str, *, params: Mapping[str, Any] | None = None + ) -> httpx.Response: + """Send a GET and return the response unread, for the caller to stream. + + On an error status the body is read for the error message and the + connection released before raising; see + :func:`_raise_for_unread_status`. + """ + request = self._client.build_request( + "GET", + path, + params=params, + headers=await _merge_request_headers_async( + options=self._options, + client_headers=self._client.headers, + request_headers=None, + ), + ) + response = await self._client.send(request, stream=True) + await _araise_for_unread_status(response) + return response + async def run_agent(self, agent_id: str, body: AgentRunRequest) -> AgentRunResponse: """Run an agent. @@ -5390,7 +5756,11 @@ async def run_streaming_agent_and_wait( """Run an agent via SSE streaming and block until completion (async). This uses POST /agents/{agent_id}/runs/stream and consumes Server-Sent Events (SSE). - The method returns when an `event: done` message is received. + The method returns when an `event: done` message is received. Every event + but `init` and `done` is discarded, so `include_reasoning` is removed + from the body before it is sent: reasoning events would only add + traffic and count against `timeout`. Use `run_streaming_agent` to + receive `stream_reasoning` events. """ import json as _json import time as _time @@ -5411,15 +5781,13 @@ async def run_streaming_agent_and_wait( async with self._client.stream( "POST", path, - json=body, + json=_without_reasoning(body), headers=merged_headers, timeout=timeout_seconds, ) as response: - if response.status_code >= 400: - # Lazy body inside `stream()`; read it so the error carries - # its text and a 422 its field-level detail. - await response.aread() - _raise_for_status(response) + # Lazy body inside `stream()`; read it so the error carries + # its text and a 422 its field-level detail. + await _araise_for_unread_status(response) current_event: str | None = None data_lines: list[str] = [] @@ -5824,6 +6192,158 @@ async def list_content_embeddings( ) return _expect_model(parsed, ContentEmbeddingsListResponse) + async def list_content_attachments( + self, + source_connection_content_version: str, + *, + page: int | None = None, + limit: int | None = None, + ) -> ContentAttachmentsListResponse: + """List the files attached to a content item. + + An agent's ``write_content_attachment`` step attaches a file, an email + source attaches the files sent with a message, an RSS source the feed + files chosen in its ``feed_attachments``, and a source that indexes + media or document images attaches those images and videos. + + Args: + source_connection_content_version: Content version identifier. + page: Page number (1-indexed, default 1). + limit: Items per page (default 20). + + Returns: + The attachments under ``data``, each with its indexing status, and + ``pagination``. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code. + SeclaiError: If the response body does not decode as the model. + """ + payload = await self.request( + "GET", + f"/contents/{source_connection_content_version}/attachments", + params=_strip_none({"page": page, "limit": limit}), + ) + return _parse_model(payload, ContentAttachmentsListResponse) + + async def get_content_attachment( + self, + source_connection_content_version: str, + attachment_id: str, + *, + start: int | None = None, + end: int | None = None, + ) -> ContentAttachmentDetailResponse: + """Get one file attached to a content item. + + Args: + source_connection_content_version: Content version identifier. + attachment_id: The ``id`` of an entry in + :meth:`list_content_attachments`. + start: Start offset of the returned text. Omitted, the API + uses 0. + end: End offset of the returned text. Omitted, the API uses 5000. + Any value from 0, the API's minimum, is sent as given, so + ``end=0`` asks for the status and metadata without the text. + Unlike :meth:`get_content_detail`, which defaults to + ``start=0`` and ``end=5000`` and always sends both, this sends + ``start`` and ``end`` only when given. + + Returns: + The attachment's indexing status and reason, its metadata, and the + text it is indexed by. A file that was not indexed has no text. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code, + including 402 when the account has no credits left. + SeclaiError: If the response body does not decode as the model. + """ + payload = await self.request( + "GET", + f"/contents/{source_connection_content_version}/attachments/{attachment_id}", + params=_strip_none({"start": start, "end": end}), + ) + return _parse_model(payload, ContentAttachmentDetailResponse) + + async def list_content_attachment_embeddings( + self, + source_connection_content_version: str, + attachment_id: str, + *, + page: int | None = None, + limit: int | None = None, + ) -> ContentEmbeddingsListResponse: + """List the embeddings an attached file is indexed by. + + Args: + source_connection_content_version: Content version identifier. + attachment_id: Attachment identifier. + page: Page number (1-indexed, default 1). + limit: Items per page (1-100, default 20). + + Returns: + A page of embeddings, the same model as + :meth:`list_content_embeddings`; empty for a file with no completed + index. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code, + including 402 when the account has no credits left. + SeclaiError: If the response body does not decode as the model. + """ + payload = await self.request( + "GET", + f"/contents/{source_connection_content_version}/attachments/{attachment_id}/embeddings", + params=_strip_none({"page": page, "limit": limit}), + ) + return _parse_model(payload, ContentEmbeddingsListResponse) + + async def download_content_attachment( + self, + source_connection_content_version: str, + attachment_id: str, + ) -> httpx.Response: + """Download the bytes of a file attached to a content item. + + Returns a **streaming** response. The caller is responsible for + consuming and closing the response:: + + response = await client.download_content_attachment("content", "att") + try: + async for chunk in response.aiter_bytes(): + f.write(chunk) + finally: + await response.aclose() + + Images, audio, video, PDF and plain text are served with their own + content type; anything else as ``application/octet-stream``. A file + withheld by a governance policy, or still being indexed after arriving + from outside, answers 403 — the attachment's ``file_withheld`` field + says which beforehand. An account with no credits left gets 402. + + The client's ``timeout`` bounds connecting and each read, not the whole + transfer, so a large file is not cut off while bytes keep arriving. + Closing the response stops a download early. + + Args: + source_connection_content_version: Content version identifier. + attachment_id: Attachment identifier. + + Returns: + A streaming ``httpx.Response``. Must be closed by the caller. + + Raises: + SeclaiAPIStatusError: If the API returns a non-success status code: + 403 for a withheld file, 402 when the account has no credits + left. + """ + return await self._stream_get( + f"/contents/{source_connection_content_version}/attachments/{attachment_id}/file" + ) + async def list_sources( self, *, @@ -6486,6 +7006,16 @@ async def upload_agent_input( ) -> dict[str, Any]: """Upload a file as input for an agent run. + Only a ``dynamic_input`` agent takes uploads; any other agent answers + 400. The limit is 200 MB per file. + + From ``Seclai-Version: 2026-10-16`` a file of any type is accepted and + is ``ready`` at once, so pass its ``upload_id`` as ``input_upload_id`` + to a run straight away. Earlier versions accept only a fixed list of + extensions and extract each file's text into ``input``: poll + :meth:`get_agent_input_upload_status` until ``status`` is ``ready`` + before running. + Args: agent_id: Agent identifier. file: File payload (bytes, path, or file-like). @@ -6550,7 +7080,8 @@ async def get_agent_attachment_references(self, agent_id: str) -> dict[str, Any] agent_id: Agent identifier. Returns: - The agent's attachment-reference contract. + The agent's attachment-reference contract, including the + ``accepted_attachments`` its trigger declares. """ return cast( dict[str, Any], @@ -6573,9 +7104,11 @@ async def download_agent_run_attachment( consuming and closing the response:: response = await client.download_agent_run_attachment("run", "att") - async with response: + try: async for chunk in response.aiter_bytes(): f.write(chunk) + finally: + await response.aclose() Args: run_id: Run identifier. @@ -6587,26 +7120,10 @@ async def download_agent_run_attachment( Returns: A streaming ``httpx.Response``. Must be closed by the caller. """ - headers = await _merge_request_headers_async( - options=self._options, - client_headers=self._client.headers, - request_headers=None, - ) - request = self._client.build_request( - "GET", + return await self._stream_get( f"/v2/agent-runs/{run_id}/attachments/{attachment_id}", params=_strip_none({"download_name": download_name}), - headers=headers, ) - response = await self._client.send(request, stream=True) - if response.is_error: - # Read the body for a useful error message, then release the - # connection before raising — the caller never receives the - # streaming response on the error path. - await response.aread() - await response.aclose() - _raise_for_status(response) - return response # ── Agent AI Assistant ──────────────────────────────────────────────────── @@ -6936,7 +7453,9 @@ async def test_draft_evaluation( body: Draft evaluation criteria and test run. Returns: - Test evaluation result. + Test evaluation result. ``status`` is ``"error"`` when the evaluator + returned no verdict; from ``2026-10-21`` ``score`` and ``passed`` are + then ``None``, and earlier versions return ``0.5`` and ``False``. """ return cast( dict[str, Any], @@ -7059,7 +7578,8 @@ async def get_non_manual_evaluation_summary(self, agent_id: str) -> dict[str, An Summary of automated evaluation results — for ``agent_id`` when the client has opted in, account-wide otherwise. The two are indistinguishable in the payload, so check the client's - ``api_version`` rather than the response. + ``api_version`` rather than the response. From ``2026-10-21``, + ``failed`` and the rates leave out results counted in ``error``. """ return cast( dict[str, Any], @@ -7257,7 +7777,8 @@ async def set_email_trigger_config( agent_id: Agent identifier. trigger_id: Trigger identifier. body: Fields to set (alias, allowed_senders, ignore_auto_generated, - require_sender_auth, queue_on_quota). Omitted fields are unchanged. + require_sender_auth, queue_on_quota, run_on_attachment_mismatch). + Omitted fields are unchanged. Returns: The trigger's resolved email address(es) and config. @@ -7272,6 +7793,45 @@ async def set_email_trigger_config( ), ) + async def set_accepted_attachments( + self, + agent_id: str, + trigger_id: str, + accepted_attachments: list[dict[str, Any]] | None, + ) -> AcceptedAttachmentsResponse: + """Declare the input attachments a trigger accepts. + + Replaces the trigger's declaration. A run's files are each assigned to + one declared attachment before any step runs, and steps reference one as + ``{{agent.attachments.}}``. Only ``dynamic_input`` and + ``email_received`` triggers take files. The API answers 400 when the + agent references an attachment the new declaration leaves out. + + Args: + agent_id: Agent identifier. + trigger_id: Trigger identifier, as :meth:`get_agent` returns it. + accepted_attachments: The attachments, each with a ``name`` and + optional ``label``, ``content_types``, ``name_pattern``, ``min`` + and ``max``. ``None`` accepts any files, as one attachment named + ``files``. Sent as given, so ``None`` is sent as ``null``. + + Returns: + The trigger's ``accepted_attachments`` with its ``agent_id`` and + ``trigger_id``. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code. + SeclaiError: If the response body does not decode as the model. + """ + body: dict[str, Any] = {"accepted_attachments": accepted_attachments} + payload = await self.request( + "PUT", + f"/agents/{agent_id}/triggers/{trigger_id}/accepted-attachments", + json=body, + ) + return _parse_model(payload, AcceptedAttachmentsResponse) + # ── Knowledge Bases ─────────────────────────────────────────────────────── async def list_knowledge_bases( @@ -7652,6 +8212,42 @@ async def update_source( ), ) + async def list_email_source_rejections( + self, + source_id: str, + *, + page: int | None = None, + limit: int | None = None, + ) -> EmailSourceRejectionListResponse: + """List mail an email content source refused, newest first. + + Each entry says who sent the message and why it was refused, never its + subject or body. To accept a refused sender, add its ``from_address`` or + that address's domain to the source's ``email_allowed_senders`` — which + only helps when ``authenticated`` is true. Requires an account owner or + administrator; the API answers 404 for a source that is not an email + source. + + Args: + source_id: Source identifier. + page: Page number (1-indexed, default 1). + limit: Items per page (1-100, default 20). + + Returns: + The refusals under ``data``, and ``pagination``. + + Raises: + SeclaiAPIValidationError: If the API returns a validation error. + SeclaiAPIStatusError: If the API returns a non-success status code. + SeclaiError: If the response body does not decode as the model. + """ + payload = await self.request( + "GET", + f"/sources/{source_id}/email-rejections", + params=_strip_none({"page": page, "limit": limit}), + ) + return _parse_model(payload, EmailSourceRejectionListResponse) + async def delete_source(self, source_id: str) -> None: """Delete a source. @@ -7854,9 +8450,11 @@ async def download_source_export( consuming and closing the response:: response = await client.download_source_export("src", "exp") - async with response: + try: async for chunk in response.aiter_bytes(): f.write(chunk) + finally: + await response.aclose() Args: source_id: Source identifier. @@ -7865,25 +8463,9 @@ async def download_source_export( Returns: A streaming ``httpx.Response``. Must be closed by the caller. """ - headers = await _merge_request_headers_async( - options=self._options, - client_headers=self._client.headers, - request_headers=None, + return await self._stream_get( + f"/sources/{source_id}/exports/{export_id}/download" ) - request = self._client.build_request( - "GET", - f"/sources/{source_id}/exports/{export_id}/download", - headers=headers, - ) - response = await self._client.send(request, stream=True) - if response.is_error: - # Read the body for a useful error message, then release the - # connection before raising — the caller never receives the - # streaming response on the error path. - await response.aread() - await response.aclose() - _raise_for_status(response) - return response async def estimate_source_export( self, source_id: str, body: dict[str, Any] @@ -9440,11 +10022,9 @@ async def run_streaming_agent( headers=merged_headers, timeout=timeout_seconds, ) as response: - if response.status_code >= 400: - # Lazy body inside `stream()`; read it so a 422's field-level - # detail survives into SeclaiAPIValidationError. - await response.aread() - _raise_for_status(response) + # Lazy body inside `stream()`; read it so a 422's field-level + # detail survives into SeclaiAPIValidationError. + await _araise_for_unread_status(response) current_event: str | None = None data_lines: list[str] = [] diff --git a/seclai/versions.py b/seclai/versions.py index 7ebfb70..e839dfb 100644 --- a/seclai/versions.py +++ b/seclai/versions.py @@ -25,13 +25,19 @@ class ApiVersion(StrEnum): V2026_09_28 = "2026-09-28" V2026_09_30 = "2026-09-30" V2026_10_03 = "2026-10-03" + V2026_10_05 = "2026-10-05" + V2026_10_13 = "2026-10-13" + V2026_10_16 = "2026-10-16" + V2026_10_18 = "2026-10-18" + V2026_10_19 = "2026-10-19" + V2026_10_21 = "2026-10-21" #: Baseline applied to an unpinned, header-less caller. DEFAULT_API_VERSION = ApiVersion.V2026_07_01 #: Newest version known to this SDK release. May lag the server. -LATEST_API_VERSION = ApiVersion.V2026_10_03 +LATEST_API_VERSION = ApiVersion.V2026_10_21 def validate_api_version(version: str | None, *, allow_unknown: bool) -> str | None: diff --git a/tests/test_new_methods.py b/tests/test_new_methods.py index da39c5a..1b8349a 100644 --- a/tests/test_new_methods.py +++ b/tests/test_new_methods.py @@ -16,6 +16,19 @@ import seclai from seclai import AgentRunStreamRequest, AsyncSeclai, Seclai from seclai import versions as seclai_versions +from seclai._generated.models import ( + AcceptedAttachmentsResponse, + ContentAttachmentDetailResponse, + ContentAttachmentsListResponse, + ContentEmbeddingsListResponse, + EmailSourceRejectionListResponse, + EvaluationStatus, + InsufficientCreditsResponse, + NonManualEvaluationSummaryResponse, +) +from seclai._generated.models import ( + TestDraftEvaluationResponse as DraftEvaluationResponse, +) # --------------------------------------------------------------------------- # Helpers @@ -4197,3 +4210,705 @@ async def test_async_parity(self) -> None: async for item in client.paginate("GET", "/agents/a1/evaluation-criteria") ] assert items == [{"id": "ec1"}] + + +# --------------------------------------------------------------------------- +# 2026-10-19: content attachments, accepted attachments, email-source refusals +# --------------------------------------------------------------------------- + +_SLOTS = [ + {"name": "invoice", "content_types": ["application/pdf"], "min": 1, "max": 1}, + {"name": "photos", "content_types": ["image/*"], "name_pattern": "*.jpg"}, +] + +# (method, args, kwargs, verb, path, query, body). One table drives the sync and +# async tests, so the two classes cannot be asserted against different +# expectations. +_SYNC_2026_10_19_CALLS: list[ + tuple[str, tuple[Any, ...], dict[str, Any], str, str, list[tuple[str, str]], Any] +] = [ + ( + "list_content_attachments", + ("cv1",), + {"page": 2, "limit": 5}, + "GET", + "/contents/cv1/attachments", + [("page", "2"), ("limit", "5")], + None, + ), + ( + "list_content_attachments", + ("cv1",), + {}, + "GET", + "/contents/cv1/attachments", + [], + None, + ), + ( + "get_content_attachment", + ("cv1", "att1"), + {"start": 100, "end": 200}, + "GET", + "/contents/cv1/attachments/att1", + [("start", "100"), ("end", "200")], + None, + ), + ( + "get_content_attachment", + ("cv1", "att1"), + {}, + "GET", + "/contents/cv1/attachments/att1", + [], + None, + ), + ( + # 0 is the spec's minimum for both, so it must be sent, not dropped. + "get_content_attachment", + ("cv1", "att1"), + {"start": 0, "end": 0}, + "GET", + "/contents/cv1/attachments/att1", + [("start", "0"), ("end", "0")], + None, + ), + ( + "list_content_attachment_embeddings", + ("cv1", "att1"), + {"page": 3, "limit": 50}, + "GET", + "/contents/cv1/attachments/att1/embeddings", + [("page", "3"), ("limit", "50")], + None, + ), + ( + "list_content_attachment_embeddings", + ("cv1", "att1"), + {}, + "GET", + "/contents/cv1/attachments/att1/embeddings", + [], + None, + ), + ( + "set_accepted_attachments", + ("a1", "t1", _SLOTS), + {}, + "PUT", + "/agents/a1/triggers/t1/accepted-attachments", + [], + {"accepted_attachments": _SLOTS}, + ), + ( + # None means "accept any files" and must reach the API as an explicit null. + "set_accepted_attachments", + ("a1", "t1", None), + {}, + "PUT", + "/agents/a1/triggers/t1/accepted-attachments", + [], + {"accepted_attachments": None}, + ), + ( + "list_email_source_rejections", + ("s1",), + {"page": 2, "limit": 100}, + "GET", + "/sources/s1/email-rejections", + [("page", "2"), ("limit", "100")], + None, + ), + ( + "list_email_source_rejections", + ("s1",), + {}, + "GET", + "/sources/s1/email-rejections", + [], + None, + ), +] + +_ATTACHMENT = { + "id": "att1", + "key": "invoice.pdf", + "content_type": "application/pdf", + "size_bytes": 1024, + "indexed": True, + "indexing_status": "completed", + "indexing_error": None, + "created_at": "2026-10-19T00:00:00Z", + "updated_at": "2026-10-19T00:00:00Z", + "metadata": {"page_count": 2}, +} + +# A schema-valid 200 body for each method, and the generated model it decodes +# into. Bodies use only fields and values the spec defines. +_2026_10_19_RESPONSES: dict[str, tuple[dict[str, Any], type[Any]]] = { + "list_content_attachments": ( + {"data": [_ATTACHMENT], "pagination": _ENVELOPE_PAGINATION}, + ContentAttachmentsListResponse, + ), + "get_content_attachment": ( + { + **_ATTACHMENT, + "file_withheld": None, + "text_content": "Invoice 42", + "text_content_start": 0, + "text_content_end": 10, + "text_content_total_length": 10, + }, + ContentAttachmentDetailResponse, + ), + "list_content_attachment_embeddings": ( + { + "data": [ + { + "id": "e1", + "text_start": 0, + "text_end": 10, + "text": "Invoice 42", + "vector": [0.1, 0.2], + "batch_size": 1, + "batch_duration": 0.5, + } + ], + "pagination": _ENVELOPE_PAGINATION, + }, + ContentEmbeddingsListResponse, + ), + "set_accepted_attachments": ( + { + "agent_id": "0b6f2a4e-3c1d-4e5f-8a9b-1c2d3e4f5a6b", + "trigger_id": "7d8e9f0a-1b2c-4d3e-9f4a-5b6c7d8e9f0a", + "accepted_attachments": [ + { + "name": "invoice", + "label": None, + "content_types": ["application/pdf"], + "name_pattern": None, + "min": 1, + "max": 1, + } + ], + }, + AcceptedAttachmentsResponse, + ), + "list_email_source_rejections": ( + { + "data": [ + { + "id": "r1", + "created_at": "2026-10-19T00:00:00Z", + "recipient": "inbox@example.com", + "sender": "bounce@mailer.example.net", + "from_address": "alice@example.org", + "sender_ip": "192.0.2.1", + "reason": "sender_not_allowed", + "authenticated": True, + "auth_verdicts": {"spf": "pass", "dmarc": "pass"}, + } + ], + "pagination": _ENVELOPE_PAGINATION, + }, + EmailSourceRejectionListResponse, + ), +} + + +class TestAttachmentsAndEmailSourceRejections: + @pytest.mark.parametrize( + ("name", "args", "kwargs", "verb", "path", "query", "body"), + _SYNC_2026_10_19_CALLS, + ) + def test_request( + self, + name: str, + args: tuple[Any, ...], + kwargs: dict[str, Any], + verb: str, + path: str, + query: list[tuple[str, str]], + body: Any, + ) -> None: + seen: dict[str, Any] = {} + response, model = _2026_10_19_RESPONSES[name] + client = _sync_client(_recording_handler(seen, response)) + result = getattr(client, name)(*args, **kwargs) + assert seen == {"method": verb, "path": path, "query": query, "body": body} + assert isinstance(result, model) + assert result.to_dict() == response + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("name", "args", "kwargs", "verb", "path", "query", "body"), + _SYNC_2026_10_19_CALLS, + ) + async def test_request_async( + self, + name: str, + args: tuple[Any, ...], + kwargs: dict[str, Any], + verb: str, + path: str, + query: list[tuple[str, str]], + body: Any, + ) -> None: + seen: dict[str, Any] = {} + response, model = _2026_10_19_RESPONSES[name] + client = _async_client(_recording_handler(seen, response)) + result = await getattr(client, name)(*args, **kwargs) + assert seen == {"method": verb, "path": path, "query": query, "body": body} + assert isinstance(result, model) + assert result.to_dict() == response + + def test_download_content_attachment(self) -> None: + seen: dict[str, Any] = {} + + def handler(req: httpx.Request) -> httpx.Response: + seen["method"] = req.method + seen["path"] = req.url.path + seen["query"] = list(req.url.params.multi_items()) + return httpx.Response( + status_code=200, + content=b"%PDF-bytes", + headers={"content-type": "application/pdf"}, + ) + + client = _sync_client(handler) + resp = client.download_content_attachment("cv1", "att1") + assert seen == { + "method": "GET", + "path": "/contents/cv1/attachments/att1/file", + "query": [], + } + try: + assert resp.read() == b"%PDF-bytes" + finally: + resp.close() + assert resp.headers["content-type"] == "application/pdf" + + def test_download_content_attachment_withheld_closes_stream(self) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=403, json={"detail": "withheld"}) + captured["resp"] = resp + return resp + + client = _sync_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + client.download_content_attachment("cv1", "att1") + assert exc.value.status_code == 403 + assert "withheld" in (exc.value.response_text or "") + assert captured["resp"].is_closed + + @pytest.mark.asyncio + async def test_async_download_content_attachment(self) -> None: + seen: dict[str, Any] = {} + + async def handler(req: httpx.Request) -> httpx.Response: + seen["method"] = req.method + seen["path"] = req.url.path + return httpx.Response(status_code=200, content=b"img") + + client = _async_client(handler) + resp = await client.download_content_attachment("cv1", "att1") + assert seen == { + "method": "GET", + "path": "/contents/cv1/attachments/att1/file", + } + await resp.aread() + assert resp.content == b"img" + await resp.aclose() + + @pytest.mark.asyncio + async def test_async_download_content_attachment_error_closes_stream( + self, + ) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + async def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=404, content=b"not found") + captured["resp"] = resp + return resp + + client = _async_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + await client.download_content_attachment("cv1", "missing") + assert exc.value.status_code == 404 + assert captured["resp"].is_closed + + def test_stream_request_sends_include_reasoning(self) -> None: + seen: dict[str, Any] = {} + + def handler(req: httpx.Request) -> httpx.Response: + seen["body"] = json.loads(req.content) + return httpx.Response( + status_code=200, + content=b'event: stream_reasoning\ndata: {"text": "hmm"}\n\n' + b'event: done\ndata: {"run_id": "r1"}\n\n', + headers={"content-type": "text/event-stream"}, + ) + + client = _sync_client(handler) + events = list( + client.run_streaming_agent( + "a1", + AgentRunStreamRequest(input="hi", metadata={}, include_reasoning=True), + ) + ) + assert seen["body"] == { + "input": "hi", + "metadata": {}, + "include_reasoning": True, + } + assert events == [ + ("stream_reasoning", {"text": "hmm"}), + ("done", {"run_id": "r1"}), + ] + + +class TestStreamAndWaitDropsReasoning: + _DONE = ( + b'event: done\ndata: {"run_id": "r1", "status": "completed", ' + b'"attempts": [], "credits": null, "error_count": 0, "priority": false, ' + b'"input": null, "output": null}\n\n' + ) + + def test_sync_drops_include_reasoning(self) -> None: + seen: dict[str, Any] = {} + + def handler(req: httpx.Request) -> httpx.Response: + seen["body"] = json.loads(req.content) + return httpx.Response( + status_code=200, + content=self._DONE, + headers={"content-type": "text/event-stream"}, + ) + + client = _sync_client(handler) + body = AgentRunStreamRequest(input="hi", include_reasoning=True) + run = client.run_streaming_agent_and_wait("a1", body) + assert run.run_id == "r1" + assert seen["body"] == {"input": "hi"} + # The caller's dict is left as given. + assert body["include_reasoning"] is True + + @pytest.mark.asyncio + async def test_async_drops_include_reasoning(self) -> None: + seen: dict[str, Any] = {} + + async def handler(req: httpx.Request) -> httpx.Response: + seen["body"] = json.loads(req.content) + return httpx.Response( + status_code=200, + content=self._DONE, + headers={"content-type": "text/event-stream"}, + ) + + client = _async_client(handler) + body = AgentRunStreamRequest(input="hi", include_reasoning=True) + run = await client.run_streaming_agent_and_wait("a1", body) + assert run.run_id == "r1" + assert seen["body"] == {"input": "hi"} + # The caller's dict is left as given. + assert body["include_reasoning"] is True + + +class _BrokenStream(httpx.SyncByteStream): + def __iter__(self) -> Any: + raise httpx.ReadError("connection reset") + + +class _AsyncBrokenStream(httpx.AsyncByteStream): + async def __aiter__(self) -> Any: + raise httpx.ReadError("connection reset") + yield b"" # pragma: no cover - makes this an async generator + + +# Every streaming download goes through one helper; cover each entry point so +# none can drift back to its own copy. +_DOWNLOADS: list[tuple[str, tuple[str, ...]]] = [ + ("download_content_attachment", ("cv1", "att1")), + ("download_agent_run_attachment", ("run1", "att1")), + ("download_source_export", ("s1", "exp1")), +] + + +class TestStreamingDownloadErrors: + @pytest.mark.parametrize(("name", "args"), _DOWNLOADS) + def test_error_body_read_failure_still_closes_and_raises_status( + self, name: str, args: tuple[str, ...] + ) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=502, stream=_BrokenStream()) + captured["resp"] = resp + return resp + + client = _sync_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + getattr(client, name)(*args) + assert exc.value.status_code == 502 + assert captured["resp"].is_closed + assert isinstance(exc.value.__cause__, httpx.ReadError) + + @pytest.mark.asyncio + @pytest.mark.parametrize(("name", "args"), _DOWNLOADS) + async def test_async_error_body_read_failure_still_closes_and_raises_status( + self, name: str, args: tuple[str, ...] + ) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + async def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=502, stream=_AsyncBrokenStream()) + captured["resp"] = resp + return resp + + client = _async_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + await getattr(client, name)(*args) + assert exc.value.status_code == 502 + assert captured["resp"].is_closed + assert isinstance(exc.value.__cause__, httpx.ReadError) + + @pytest.mark.parametrize( + "name", ["run_streaming_agent", "run_streaming_agent_and_wait"] + ) + def test_streaming_run_error_body_read_failure_raises_status( + self, name: str + ) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=502, stream=_BrokenStream()) + captured["resp"] = resp + return resp + + client = _sync_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + result = getattr(client, name)("a1", AgentRunStreamRequest(input="hi")) + if name == "run_streaming_agent": + list(result) + assert exc.value.status_code == 502 + assert exc.value.response_text is None + assert isinstance(exc.value.__cause__, httpx.ReadError) + assert captured["resp"].is_closed + + @pytest.mark.asyncio + @pytest.mark.parametrize( + "name", ["run_streaming_agent", "run_streaming_agent_and_wait"] + ) + async def test_async_streaming_run_error_body_read_failure_raises_status( + self, name: str + ) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + async def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=502, stream=_AsyncBrokenStream()) + captured["resp"] = resp + return resp + + client = _async_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + if name == "run_streaming_agent": + async for _ in client.run_streaming_agent( + "a1", AgentRunStreamRequest(input="hi") + ): + pass + else: + await client.run_streaming_agent_and_wait( + "a1", AgentRunStreamRequest(input="hi") + ) + assert exc.value.status_code == 502 + assert exc.value.response_text is None + assert isinstance(exc.value.__cause__, httpx.ReadError) + assert captured["resp"].is_closed + + @pytest.mark.parametrize(("name", "args"), _DOWNLOADS) + def test_error_closes_and_keeps_body_text( + self, name: str, args: tuple[str, ...] + ) -> None: + from seclai import SeclaiAPIStatusError + + captured: dict[str, httpx.Response] = {} + + def handler(req: httpx.Request) -> httpx.Response: + resp = httpx.Response(status_code=402, json={"detail": "no credits"}) + captured["resp"] = resp + return resp + + client = _sync_client(handler) + with pytest.raises(SeclaiAPIStatusError) as exc: + getattr(client, name)(*args) + assert exc.value.status_code == 402 + assert "no credits" in (exc.value.response_text or "") + assert captured["resp"].is_closed + + +class TestAttachmentModelDecoding: + @pytest.mark.parametrize( + "bad", + [ + [_ATTACHMENT], # not an object + "oops", # text body + {"data": [{"id": "att1"}], "pagination": _ENVELOPE_PAGINATION}, + ], + ) + def test_undecodable_body_raises_seclai_error(self, bad: Any) -> None: + from seclai import SeclaiError + + def handler(req: httpx.Request) -> httpx.Response: + if isinstance(bad, str): + return httpx.Response(status_code=200, text=bad) + return _json_response(bad) + + client = _sync_client(handler) + with pytest.raises(SeclaiError): + client.list_content_attachments("cv1") + + @pytest.mark.asyncio + async def test_async_undecodable_body_raises_seclai_error(self) -> None: + from seclai import SeclaiError + + async def handler(req: httpx.Request) -> httpx.Response: + return _json_response({"agent_id": "a1"}) + + client = _async_client(handler) + with pytest.raises(SeclaiError): + await client.set_accepted_attachments("a1", "t1", None) + + def test_typed_fields(self) -> None: + response, _ = _2026_10_19_RESPONSES["list_email_source_rejections"] + client = _sync_client(lambda req: _json_response(response)) + refused = client.list_email_source_rejections("s1") + assert refused.data[0].from_address == "alice@example.org" + assert refused.data[0].authenticated is True + assert refused.pagination.total == 1 + + +class TestAgentRunStreamRequestOptionalKeys: + def test_upload_only_body(self) -> None: + seen: dict[str, Any] = {} + + def handler(req: httpx.Request) -> httpx.Response: + seen["body"] = json.loads(req.content) + return httpx.Response( + status_code=200, + content=b'event: done\ndata: {"run_id": "r1"}\n\n', + headers={"content-type": "text/event-stream"}, + ) + + client = _sync_client(handler) + # input and metadata are optional in the spec, so a run on an upload + # needs neither. + body = AgentRunStreamRequest(input_upload_id="up1") + events = list(client.run_streaming_agent("a1", body)) + assert seen["body"] == {"input_upload_id": "up1"} + assert events == [("done", {"run_id": "r1"})] + + def test_null_metadata_is_accepted(self) -> None: + body = AgentRunStreamRequest(input="hi", metadata=None) + assert body == {"input": "hi", "metadata": None} + + +# --------------------------------------------------------------------------- +# 2026-10-21: evaluation `error` results, the 402 body's wire shape +# --------------------------------------------------------------------------- + +_INSUFFICIENT_CREDITS_402 = { + "error": { + "code": "insufficient_credits", + "message": "Out of credits.", + "account_id": "acct-1", + } +} + + +class TestLatestApiVersion20261021: + def test_latest_is_2026_10_21(self) -> None: + assert ( + seclai_versions.LATEST_API_VERSION is seclai_versions.ApiVersion.V2026_10_21 + ) + + def test_latest_is_sent_as_the_header(self) -> None: + seen: dict[str, Any] = {} + + def handler(req: httpx.Request) -> httpx.Response: + seen["version"] = req.headers.get("seclai-version") + return _json_response({"data": []}) + + client = _sync_client(handler, api_version=seclai_versions.LATEST_API_VERSION) + client.list_agents() + assert seen["version"] == "2026-10-21" + + +class TestInsufficientCredits402: + def test_generated_model_reads_the_wire_shape(self) -> None: + parsed = InsufficientCreditsResponse.from_dict(_INSUFFICIENT_CREDITS_402) + assert parsed.error.code == "insufficient_credits" + assert parsed.error.account_id == "acct-1" + assert parsed.to_dict() == _INSUFFICIENT_CREDITS_402 + + +_TEST_DRAFT_ERROR = { + "status": "error", + "score": None, + "passed": None, + "explanation": "The evaluator returned no verdict.", +} + + +class TestTestDraftErrorVerdict: + def test_generated_model_decodes_null_score_and_passed(self) -> None: + # The spec types score and passed as non-null, the legacy shape; + # 2026-10-21 sends null for an error result. + parsed = DraftEvaluationResponse.from_dict(_TEST_DRAFT_ERROR) + assert parsed.status is EvaluationStatus.ERROR + assert parsed.score is None + assert parsed.passed is None + + +_NON_MANUAL_SUMMARY = { + "total": 10, + "passed": 6, + "failed": 2, + "error": 2, + "flagged": 1, + "pass_rate": 0.75, + "failure_rate": 0.25, + "by_mode": [ + { + "mode": "eval_and_retry", + "total": 10, + "passed": 6, + "failed": 2, + "error": 2, + "flagged": 1, + "pass_rate": 0.75, + "failure_rate": 0.25, + } + ], +} + + +class TestNonManualSummaryErrorCount: + def test_generated_model_reads_error_counts(self) -> None: + parsed = NonManualEvaluationSummaryResponse.from_dict(_NON_MANUAL_SUMMARY) + assert parsed.error == 2 + assert parsed.by_mode[0].error == 2