decomposer: generate files for Build source connectors that retrieve content and source permissions from SCM and CMS systems and expose normalized content-change records to downstream ingestion workflows.

This commit is contained in:
2026-09-01 13:57:20 +00:00
parent b4a4f51323
commit 3403dea838
12 changed files with 284 additions and 3 deletions

View File

@@ -1,5 +1,23 @@
# crucible-agent-build-source-connectors
# Source connectors
> Build source connectors that retrieve content and source permissions from SCM and CMS systems and expose normalized content-change records to downstream ingestion workflows.
A dependency-free, pluggable capability for enumerating scoped content, consuming incremental cursors, normalizing webhooks, and capturing source ACLs from GitHub and SharePoint (Microsoft Graph).
A tool, not a standing agent service — see `input.schema.json`/`output.schema.json` for its contract. Generated by crucible-agent-decomposer for a plan gap step; language and structure are whatever the capability actually needs, not a fixed layout.
## Contract
`Connector` exposes `enumerate(scope, cursor)`, `changes(scope, cursor)`, `normalize_webhook(headers, payload)`, and `acl(scope)`. Each connector receives a `TokenProvider` and `HttpClient`, so OAuth/delegated authentication and transport are supplied by the host rather than embedded in adapters.
```python
from source_connectors import GitHubConnector, SharePointConnector, StaticTokenProvider, UrllibHttpClient
connector = GitHubConnector(StaticTokenProvider(token), UrllibHttpClient())
for change in connector.changes({"owner": "acme", "repo": "docs"}, cursor):
ingest(change)
```
Cursors are opaque JSON-safe values. GitHub uses the latest observed commit SHA and SharePoint uses Microsoft Graph's delta URL. Store the cursor only after downstream ingestion succeeds. Webhook signatures are deliberately not verified here: verify at the ingress boundary, then pass the trusted JSON payload to `normalize_webhook`.
## Security and scope
Tokens are sent only as Bearer headers. GitHub paths are constrained to the configured owner/repository; SharePoint paths are constrained to the configured site/drive. The adapters return source ACL entries with provider subject IDs and roles, preserving deny/unknown semantics for downstream policy evaluation.
Run tests with `python -m pytest` (after installing `.[test]`).