agenthooksprotocol 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agenthooksprotocol-0.7.0/src/agenthooksprotocol.egg-info → agenthooksprotocol-0.8.0}/PKG-INFO +16 -1
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/README.md +15 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/pyproject.toml +1 -1
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_hooks.py +48 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/__init__.py +43 -4
- agenthooksprotocol-0.8.0/src/agenthooksprotocol/_validator.py +342 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/ahp-codegen.lock.json +4 -4
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/auth.py +44 -11
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/generated.py +19 -2
- agenthooksprotocol-0.8.0/src/agenthooksprotocol/headers.py +129 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/runtime.py +17 -10
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/schemas.json +50 -2
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0/src/agenthooksprotocol.egg-info}/PKG-INFO +16 -1
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol.egg-info/SOURCES.txt +5 -1
- agenthooksprotocol-0.8.0/tests/test_registration_headers.py +527 -0
- agenthooksprotocol-0.8.0/tests/test_validator_optimization.py +1319 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/LICENSE +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/setup.cfg +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/__init__.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_boundaries.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_diagnostics.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_elicitation.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_grants.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_host_metadata.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_interop_content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_interop_hooks.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/capability.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/effect.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/event.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/registration.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/subscription.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/tool.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_models/transport.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/_outcomes.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/attachment.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/candidate.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/capability.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/catalogue.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/codec.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/compaction.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/contract.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/diagnostics.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/effect.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/elicitation.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/event.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/integrations/__init__.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/integrations/pydantic.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/interop.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/lifecycle.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/lifecycle_client.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/lifecycle_server.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/lineage.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/observation_chain.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/path.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/permission.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/py.typed +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/registration.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/response.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/__init__.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/_admission.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/_framing.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/_handlers.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/_json.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/_slots.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/asgi.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/attachments.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/hooks.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/server/stdio.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/state.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/subscription.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/tool.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/transport.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/transports/__init__.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/transports/http.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/transports/stdio.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol/wire.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol.egg-info/dependency_links.txt +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol.egg-info/requires.txt +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/src/agenthooksprotocol.egg-info/top_level.txt +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_attachments.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_catalogue.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_codec.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_compaction.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_compaction_wire.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_consumer_outcomes.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_content_lifetime.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_content_receipts.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_correlated_core.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_declared_contracts.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_elicitation_adapter.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_event_types.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_fixture_public.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_handwritten_surface.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_harness_identity.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_host_metadata.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_inline_messages.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_integration.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_integration_edges.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_interop.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_lifecycle.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_lifecycle_auth.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_observation.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_observation_chain_transport.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_owned_content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_owned_content_hooks.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_package.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_public_content.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_public_contract_surface.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_public_examples.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_public_hooks.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_public_server.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_registration_auth.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_safety.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_schema_corrections.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_sdk_unification.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_server_catch_all.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_server_error_codes.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_session_manifest.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_shared_materialization.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_stdio_env.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_stdio_transport.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_structural_facade.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_subscribes.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_typed_capabilities.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_typed_contract_regressions.py +0 -0
- {agenthooksprotocol-0.7.0 → agenthooksprotocol-0.8.0}/tests/test_upload_planning.py +0 -0
{agenthooksprotocol-0.7.0/src/agenthooksprotocol.egg-info → agenthooksprotocol-0.8.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agenthooksprotocol
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Official non-normative Python SDK for the Agent Hooks Protocol
|
|
5
5
|
Author: Agent Hooks Protocol maintainers
|
|
6
6
|
License:
|
|
@@ -343,6 +343,21 @@ The same remaining budget covers queue/readiness waits, provider waits, selected
|
|
|
343
343
|
|
|
344
344
|
The default `auth.EnvironmentAuthProvider` resolves bearer `tokenEnv` or optional `resolve_credential` tokenRef callbacks at delivery time. OAuth bindings require an explicit provider. Missing configured secrets and unsupported mechanisms fail closed. Anonymous success stays anonymous; an explicit provider can authorize challenge discovery under host trust policy. Interception may replay at most once after an eligible 401 Bearer challenge, retaining request identity and serialized body; observations/uploads are never automatically replayed. Upload bindings are independent: event credentials are never an upload fallback. Transport-owned TLS/workload integration is not replaced by this provider.
|
|
345
345
|
|
|
346
|
+
HTTP registrations accept `transport.headers`, for example:
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{"type":"http","url":"https://policy.example/hooks","headers":{"X-Tenant":"engineering","X-Api-Key":{"valueEnv":"POLICY_API_KEY"},"X-Gateway":{"valueRef":"vault/policy"}}}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
All valid HTTP field names are supported, including `Authorization`, `Cookie`, `Origin`, and protocol headers. Literal API keys and cookies are supported. Values must be safe HTTP field values (no CR, LF, or NUL); this HTTPX transport supports Latin-1 header bytes, including non-ASCII values such as `café`. There is no additional SDK header-size limit. Duplicate names are compared case-insensitively: the last property in configuration iteration order wins.
|
|
353
|
+
|
|
354
|
+
Transport defaults and authentication are applied first, then configured registration headers override them case-insensitively, including `Content-Type` and `Authorization`. Configured `Authorization`, whether literal or referenced, suppresses provider acquisition, discovery, challenges, and retries. A failed explicit secret lookup fails delivery; it never falls back to OAuth.
|
|
355
|
+
|
|
356
|
+
`valueEnv` and `valueRef` reuse the bearer secret lookup helper and `Hooks(..., resolve_credential=callback)` callback. The optional contextual `header_resolver.resolve(context)` API remains available for harnesses needing backend, destination, purpose, cancellation, and deadline context. Values resolve once per event or upload operation, are reused on an allowed authentication retry, and rotate on subsequent operations. Errors redact values and references.
|
|
357
|
+
|
|
358
|
+
Configured headers apply to both event POSTs and backend content uploads, overriding upload defaults and authentication as well. They are not installed globally on borrowed clients, discovery/token requests, or other backends. Existing transport redirect behavior is unchanged (SDK HTTP transports already disable automatic redirects). Custom injected transports retain responsibility for their transport contract.
|
|
359
|
+
|
|
360
|
+
|
|
346
361
|
Registered stdio backends start with a minimal base environment rather than the full host environment. The base is an allowlist of host variables: `PATH`, `HOME`, `USER`, `LOGNAME`, `SHELL`, `LANG`, `LC_*`, `TZ`, `TMPDIR`, `TEMP` and `TMP`, plus `SYSTEMROOT`, `WINDIR`, `COMSPEC`, `PATHEXT`, `USERPROFILE`, `APPDATA`, `LOCALAPPDATA` and `PROGRAMDATA` on Windows, where names match case-insensitively. The registration's `transport.env` entries are applied on top as literal strings, with no interpolation, and override base values. `tokenEnv` is still resolved in the host environment and credentials are never copied into the child. Env values are never logged. `Hooks(..., inherit_environment=True)` is an SDK-level opt-out that starts from the full host environment instead. `transports.StdioTransport(..., env=..., inherit_environment=...)` exposes the same controls.
|
|
347
362
|
|
|
348
363
|
## Static host manifest
|
|
@@ -119,6 +119,21 @@ The same remaining budget covers queue/readiness waits, provider waits, selected
|
|
|
119
119
|
|
|
120
120
|
The default `auth.EnvironmentAuthProvider` resolves bearer `tokenEnv` or optional `resolve_credential` tokenRef callbacks at delivery time. OAuth bindings require an explicit provider. Missing configured secrets and unsupported mechanisms fail closed. Anonymous success stays anonymous; an explicit provider can authorize challenge discovery under host trust policy. Interception may replay at most once after an eligible 401 Bearer challenge, retaining request identity and serialized body; observations/uploads are never automatically replayed. Upload bindings are independent: event credentials are never an upload fallback. Transport-owned TLS/workload integration is not replaced by this provider.
|
|
121
121
|
|
|
122
|
+
HTTP registrations accept `transport.headers`, for example:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{"type":"http","url":"https://policy.example/hooks","headers":{"X-Tenant":"engineering","X-Api-Key":{"valueEnv":"POLICY_API_KEY"},"X-Gateway":{"valueRef":"vault/policy"}}}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
All valid HTTP field names are supported, including `Authorization`, `Cookie`, `Origin`, and protocol headers. Literal API keys and cookies are supported. Values must be safe HTTP field values (no CR, LF, or NUL); this HTTPX transport supports Latin-1 header bytes, including non-ASCII values such as `café`. There is no additional SDK header-size limit. Duplicate names are compared case-insensitively: the last property in configuration iteration order wins.
|
|
129
|
+
|
|
130
|
+
Transport defaults and authentication are applied first, then configured registration headers override them case-insensitively, including `Content-Type` and `Authorization`. Configured `Authorization`, whether literal or referenced, suppresses provider acquisition, discovery, challenges, and retries. A failed explicit secret lookup fails delivery; it never falls back to OAuth.
|
|
131
|
+
|
|
132
|
+
`valueEnv` and `valueRef` reuse the bearer secret lookup helper and `Hooks(..., resolve_credential=callback)` callback. The optional contextual `header_resolver.resolve(context)` API remains available for harnesses needing backend, destination, purpose, cancellation, and deadline context. Values resolve once per event or upload operation, are reused on an allowed authentication retry, and rotate on subsequent operations. Errors redact values and references.
|
|
133
|
+
|
|
134
|
+
Configured headers apply to both event POSTs and backend content uploads, overriding upload defaults and authentication as well. They are not installed globally on borrowed clients, discovery/token requests, or other backends. Existing transport redirect behavior is unchanged (SDK HTTP transports already disable automatic redirects). Custom injected transports retain responsibility for their transport contract.
|
|
135
|
+
|
|
136
|
+
|
|
122
137
|
Registered stdio backends start with a minimal base environment rather than the full host environment. The base is an allowlist of host variables: `PATH`, `HOME`, `USER`, `LOGNAME`, `SHELL`, `LANG`, `LC_*`, `TZ`, `TMPDIR`, `TEMP` and `TMP`, plus `SYSTEMROOT`, `WINDIR`, `COMSPEC`, `PATHEXT`, `USERPROFILE`, `APPDATA`, `LOCALAPPDATA` and `PROGRAMDATA` on Windows, where names match case-insensitively. The registration's `transport.env` entries are applied on top as literal strings, with no interpolation, and override base values. `tokenEnv` is still resolved in the host environment and credentials are never copied into the child. Env values are never logged. `Hooks(..., inherit_environment=True)` is an SDK-level opt-out that starts from the full host environment instead. `transports.StdioTransport(..., env=..., inherit_environment=...)` exposes the same controls.
|
|
123
138
|
|
|
124
139
|
## Static host manifest
|
|
@@ -654,6 +654,7 @@ class Hooks(BoundaryMixin):
|
|
|
654
654
|
transport: Any = None,
|
|
655
655
|
resolve_credential: Any = None,
|
|
656
656
|
auth_provider: Any = None,
|
|
657
|
+
header_resolver: Any = None,
|
|
657
658
|
max_concurrent_uploads: int = 8,
|
|
658
659
|
inherit_environment: bool = False,
|
|
659
660
|
) -> None:
|
|
@@ -672,6 +673,7 @@ class Hooks(BoundaryMixin):
|
|
|
672
673
|
transport=transport,
|
|
673
674
|
resolve_credential=resolve_credential,
|
|
674
675
|
auth_provider=auth_provider,
|
|
676
|
+
header_resolver=header_resolver,
|
|
675
677
|
max_concurrent_uploads=max_concurrent_uploads,
|
|
676
678
|
inherit_environment=inherit_environment,
|
|
677
679
|
)
|
|
@@ -687,6 +689,7 @@ class Hooks(BoundaryMixin):
|
|
|
687
689
|
transport: Any = None,
|
|
688
690
|
resolve_credential: Any = None,
|
|
689
691
|
auth_provider: Any = None,
|
|
692
|
+
header_resolver: Any = None,
|
|
690
693
|
max_concurrent_uploads: int = 8,
|
|
691
694
|
inherit_environment: bool = False,
|
|
692
695
|
) -> None:
|
|
@@ -703,6 +706,17 @@ class Hooks(BoundaryMixin):
|
|
|
703
706
|
self._upload_limiter = anyio.Semaphore(max_concurrent_uploads)
|
|
704
707
|
self.validator = Validator()
|
|
705
708
|
self._lineage = TaskLineage(self.validator)
|
|
709
|
+
from .headers import validate_headers
|
|
710
|
+
|
|
711
|
+
registered_backends = config.get("hooks", []) if isinstance(config, dict) else []
|
|
712
|
+
for backend in registered_backends if isinstance(registered_backends, list) else []:
|
|
713
|
+
transport_config = (
|
|
714
|
+
backend.get("transport", {}) if isinstance(backend, dict) else {}
|
|
715
|
+
)
|
|
716
|
+
if isinstance(transport_config, dict) and transport_config.get("type") == "http":
|
|
717
|
+
validate_headers(transport_config.get("headers", {}))
|
|
718
|
+
self._header_resolver = header_resolver
|
|
719
|
+
self._resolve_credential = resolve_credential
|
|
706
720
|
self.validator.validate("registration", config)
|
|
707
721
|
if (
|
|
708
722
|
not isinstance(source, str)
|
|
@@ -863,6 +877,38 @@ class Hooks(BoundaryMixin):
|
|
|
863
877
|
if isinstance(self._injected, dict)
|
|
864
878
|
else self._injected
|
|
865
879
|
)
|
|
880
|
+
from .transports.http import HTTPTransport
|
|
881
|
+
|
|
882
|
+
config = backend["transport"]
|
|
883
|
+
if (
|
|
884
|
+
config["type"] == "http"
|
|
885
|
+
and config.get("headers")
|
|
886
|
+
and isinstance(transport, HTTPTransport)
|
|
887
|
+
):
|
|
888
|
+
from .auth import AuthenticatedHTTPTransport
|
|
889
|
+
|
|
890
|
+
# Keep borrowed client lifetime and programmatic metadata,
|
|
891
|
+
# but do not bypass the registration's endpoint scope.
|
|
892
|
+
if transport.url != config["url"]:
|
|
893
|
+
raise ProtocolError("HTTP registration endpoint mismatch")
|
|
894
|
+
transport = AuthenticatedHTTPTransport(
|
|
895
|
+
config["url"],
|
|
896
|
+
backend=backend,
|
|
897
|
+
resolve_credential=(
|
|
898
|
+
self._resolve_credential
|
|
899
|
+
if self._resolve_credential is not None
|
|
900
|
+
else getattr(transport, "resolve_credential", None)
|
|
901
|
+
),
|
|
902
|
+
client=transport._ready(),
|
|
903
|
+
headers=transport.headers,
|
|
904
|
+
auth_provider=getattr(
|
|
905
|
+
transport, "auth_provider", self._auth_provider
|
|
906
|
+
),
|
|
907
|
+
header_resolver=self._header_resolver or getattr(
|
|
908
|
+
transport, "header_resolver", None
|
|
909
|
+
),
|
|
910
|
+
validator=self.validator,
|
|
911
|
+
)
|
|
866
912
|
else:
|
|
867
913
|
config = backend["transport"]
|
|
868
914
|
if config["type"] == "stdio":
|
|
@@ -882,7 +928,9 @@ class Hooks(BoundaryMixin):
|
|
|
882
928
|
transport = AuthenticatedHTTPTransport(
|
|
883
929
|
config["url"],
|
|
884
930
|
backend=backend,
|
|
931
|
+
resolve_credential=self._resolve_credential,
|
|
885
932
|
auth_provider=self._auth_provider,
|
|
933
|
+
header_resolver=self._header_resolver,
|
|
886
934
|
validator=self.validator,
|
|
887
935
|
)
|
|
888
936
|
self._owned.append(transport)
|