monoid-agent-kernel 0.16.1__py3-none-any.whl
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.
- monoid_agent_kernel/__init__.py +11 -0
- monoid_agent_kernel/_policy_util.py +40 -0
- monoid_agent_kernel/_proc.py +86 -0
- monoid_agent_kernel/builder.py +351 -0
- monoid_agent_kernel/cli.py +1244 -0
- monoid_agent_kernel/conformance/__init__.py +32 -0
- monoid_agent_kernel/conformance/harness.py +209 -0
- monoid_agent_kernel/conformance/profiles/__init__.py +55 -0
- monoid_agent_kernel/conformance/profiles/_metadata.py +16 -0
- monoid_agent_kernel/conformance/profiles/capability_security.py +216 -0
- monoid_agent_kernel/conformance/profiles/control_plane.py +41 -0
- monoid_agent_kernel/conformance/profiles/durable_runner.py +42 -0
- monoid_agent_kernel/conformance/profiles/message_fabric.py +42 -0
- monoid_agent_kernel/conformance/profiles/minimal_agent.py +13 -0
- monoid_agent_kernel/conformance/profiles/multi_agent.py +112 -0
- monoid_agent_kernel/conformance/profiles/provider_gateway.py +107 -0
- monoid_agent_kernel/conformance/profiles/reference_full.py +135 -0
- monoid_agent_kernel/conformance/profiles/side_effect_tool_agent.py +36 -0
- monoid_agent_kernel/conformance/profiles/tool_agent.py +39 -0
- monoid_agent_kernel/contracts.py +329 -0
- monoid_agent_kernel/core/__init__.py +1 -0
- monoid_agent_kernel/core/_util.py +145 -0
- monoid_agent_kernel/core/agents.py +883 -0
- monoid_agent_kernel/core/cancellation.py +16 -0
- monoid_agent_kernel/core/capability.py +376 -0
- monoid_agent_kernel/core/capability_revocation.py +92 -0
- monoid_agent_kernel/core/checkpoint.py +350 -0
- monoid_agent_kernel/core/content.py +101 -0
- monoid_agent_kernel/core/context.py +67 -0
- monoid_agent_kernel/core/control.py +124 -0
- monoid_agent_kernel/core/control_audit.py +99 -0
- monoid_agent_kernel/core/durable_metadata.py +116 -0
- monoid_agent_kernel/core/event_sequencing.py +164 -0
- monoid_agent_kernel/core/events.py +204 -0
- monoid_agent_kernel/core/external_agent_envelope.py +338 -0
- monoid_agent_kernel/core/frontmatter.py +140 -0
- monoid_agent_kernel/core/inbox.py +110 -0
- monoid_agent_kernel/core/lease_admission.py +57 -0
- monoid_agent_kernel/core/lifecycle.py +440 -0
- monoid_agent_kernel/core/manifest.py +88 -0
- monoid_agent_kernel/core/media.py +393 -0
- monoid_agent_kernel/core/outbox.py +212 -0
- monoid_agent_kernel/core/output_validator.py +103 -0
- monoid_agent_kernel/core/packages.py +742 -0
- monoid_agent_kernel/core/projections.py +213 -0
- monoid_agent_kernel/core/prompt.py +37 -0
- monoid_agent_kernel/core/proposal_file.py +84 -0
- monoid_agent_kernel/core/result.py +131 -0
- monoid_agent_kernel/core/schemas.py +1146 -0
- monoid_agent_kernel/core/scope.py +185 -0
- monoid_agent_kernel/core/side_effect_policy.py +153 -0
- monoid_agent_kernel/core/spec.py +325 -0
- monoid_agent_kernel/core/streaming.py +208 -0
- monoid_agent_kernel/core/subagent_runtime.py +187 -0
- monoid_agent_kernel/core/tool_approval.py +175 -0
- monoid_agent_kernel/core/tool_surface.py +505 -0
- monoid_agent_kernel/core/trace_context.py +76 -0
- monoid_agent_kernel/core/wire_validation.py +156 -0
- monoid_agent_kernel/core/workspace.py +161 -0
- monoid_agent_kernel/core/workspace_index.py +127 -0
- monoid_agent_kernel/env.py +32 -0
- monoid_agent_kernel/errors.py +105 -0
- monoid_agent_kernel/event_loader.py +47 -0
- monoid_agent_kernel/identifiers.py +50 -0
- monoid_agent_kernel/loop.py +4140 -0
- monoid_agent_kernel/loop_phases.py +561 -0
- monoid_agent_kernel/mcp/__init__.py +10 -0
- monoid_agent_kernel/mcp/client.py +227 -0
- monoid_agent_kernel/mcp/provider.py +407 -0
- monoid_agent_kernel/narration.py +92 -0
- monoid_agent_kernel/observability/__init__.py +9 -0
- monoid_agent_kernel/observability/otel.py +264 -0
- monoid_agent_kernel/permissions.py +74 -0
- monoid_agent_kernel/providers/__init__.py +7 -0
- monoid_agent_kernel/providers/_common.py +122 -0
- monoid_agent_kernel/providers/base.py +312 -0
- monoid_agent_kernel/providers/fake.py +76 -0
- monoid_agent_kernel/providers/gateway.py +474 -0
- monoid_agent_kernel/providers/openai.py +487 -0
- monoid_agent_kernel/public_view.py +173 -0
- monoid_agent_kernel/py.typed +0 -0
- monoid_agent_kernel/recorder.py +421 -0
- monoid_agent_kernel/reference/__init__.py +15 -0
- monoid_agent_kernel/reference/_shared/__init__.py +4 -0
- monoid_agent_kernel/reference/_shared/http_util.py +111 -0
- monoid_agent_kernel/reference/_shared/tokens.py +314 -0
- monoid_agent_kernel/reference/backend/__init__.py +21 -0
- monoid_agent_kernel/reference/backend/commands.py +375 -0
- monoid_agent_kernel/reference/backend/http.py +439 -0
- monoid_agent_kernel/reference/backend/jobs.py +68 -0
- monoid_agent_kernel/reference/backend/loop_factory.py +253 -0
- monoid_agent_kernel/reference/backend/outbox_dispatch.py +130 -0
- monoid_agent_kernel/reference/backend/ports.py +188 -0
- monoid_agent_kernel/reference/backend/projection.py +286 -0
- monoid_agent_kernel/reference/backend/proposal.py +220 -0
- monoid_agent_kernel/reference/backend/proposal_reader.py +16 -0
- monoid_agent_kernel/reference/backend/recovery.py +253 -0
- monoid_agent_kernel/reference/backend/run_execution.py +152 -0
- monoid_agent_kernel/reference/backend/run_preparation.py +197 -0
- monoid_agent_kernel/reference/backend/run_state.py +243 -0
- monoid_agent_kernel/reference/backend/run_types.py +128 -0
- monoid_agent_kernel/reference/backend/runtime_config.py +147 -0
- monoid_agent_kernel/reference/backend/service.py +1664 -0
- monoid_agent_kernel/reference/backend/session.py +280 -0
- monoid_agent_kernel/reference/backend/session_drive.py +231 -0
- monoid_agent_kernel/reference/capability.py +101 -0
- monoid_agent_kernel/reference/conformance.py +1777 -0
- monoid_agent_kernel/reference/llm_gateway/__init__.py +14 -0
- monoid_agent_kernel/reference/llm_gateway/http.py +225 -0
- monoid_agent_kernel/reference/llm_gateway/providers.py +96 -0
- monoid_agent_kernel/reference/llm_gateway/service.py +404 -0
- monoid_agent_kernel/reference/mcp_gateway/__init__.py +26 -0
- monoid_agent_kernel/reference/mcp_gateway/http.py +187 -0
- monoid_agent_kernel/reference/mcp_gateway/service.py +206 -0
- monoid_agent_kernel/reference/outbox.py +135 -0
- monoid_agent_kernel/reference/stores/__init__.py +20 -0
- monoid_agent_kernel/reference/stores/lease.py +116 -0
- monoid_agent_kernel/reference/stores/sqlite.py +295 -0
- monoid_agent_kernel/reference/studio/README.md +97 -0
- monoid_agent_kernel/reference/studio/__init__.py +21 -0
- monoid_agent_kernel/reference/studio/activity.py +53 -0
- monoid_agent_kernel/reference/studio/cli.py +481 -0
- monoid_agent_kernel/reference/studio/sample-skills/code-review-checklist/SKILL.md +25 -0
- monoid_agent_kernel/reference/studio/sample-skills/code-review-checklist/references/review-checklist.md +8 -0
- monoid_agent_kernel/reference/studio/sample-skills/commit-message/SKILL.md +32 -0
- monoid_agent_kernel/reference/studio/sample-skills/incident-summary/SKILL.md +24 -0
- monoid_agent_kernel/reference/studio/sample-skills/incident-summary/references/incident-template.md +32 -0
- monoid_agent_kernel/reference/studio/sample-skills/release-notes/SKILL.md +24 -0
- monoid_agent_kernel/reference/studio/sample-skills/release-notes/references/release-note-template.md +33 -0
- monoid_agent_kernel/reference/studio/sample-skills/release-notes/scripts/collect_changes.py +51 -0
- monoid_agent_kernel/reference/studio/server.py +1922 -0
- monoid_agent_kernel/reference/studio/web/index.html +1877 -0
- monoid_agent_kernel/reference/studio/web/settings.html +108 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/auto-render.min.js +1 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/katex.min.css +1 -0
- monoid_agent_kernel/reference/studio/web/vendor/katex/katex.min.js +1 -0
- monoid_agent_kernel/reference/studio/window.py +72 -0
- monoid_agent_kernel/reference/web_gateway/__init__.py +6 -0
- monoid_agent_kernel/reference/web_gateway/http.py +155 -0
- monoid_agent_kernel/reference/web_gateway/providers.py +807 -0
- monoid_agent_kernel/reference/web_gateway/service.py +559 -0
- monoid_agent_kernel/shell.py +722 -0
- monoid_agent_kernel/skills/__init__.py +20 -0
- monoid_agent_kernel/skills/definition.py +82 -0
- monoid_agent_kernel/skills/loader.py +55 -0
- monoid_agent_kernel/skills/provider.py +378 -0
- monoid_agent_kernel/subagent_loader.py +56 -0
- monoid_agent_kernel/tasks.py +1326 -0
- monoid_agent_kernel/tool_loader.py +51 -0
- monoid_agent_kernel/tool_services/__init__.py +8 -0
- monoid_agent_kernel/tool_services/base.py +25 -0
- monoid_agent_kernel/tool_services/jobs.py +47 -0
- monoid_agent_kernel/tool_services/shell.py +255 -0
- monoid_agent_kernel/tool_services/web.py +356 -0
- monoid_agent_kernel/tools/__init__.py +2 -0
- monoid_agent_kernel/tools/base.py +205 -0
- monoid_agent_kernel/tools/builtin.py +958 -0
- monoid_agent_kernel/tools/decorator.py +132 -0
- monoid_agent_kernel/tools/tool_ids.py +62 -0
- monoid_agent_kernel/web.py +171 -0
- monoid_agent_kernel/workspace/__init__.py +2 -0
- monoid_agent_kernel/workspace/local.py +1004 -0
- monoid_agent_kernel/workspace/paths.py +30 -0
- monoid_agent_kernel-0.16.1.dist-info/METADATA +709 -0
- monoid_agent_kernel-0.16.1.dist-info/RECORD +191 -0
- monoid_agent_kernel-0.16.1.dist-info/WHEEL +4 -0
- monoid_agent_kernel-0.16.1.dist-info/entry_points.txt +3 -0
- monoid_agent_kernel-0.16.1.dist-info/licenses/LICENSE +202 -0
- monoid_agent_kernel-0.16.1.dist-info/licenses/NOTICE +8 -0
- native_agent_runner/__init__.py +103 -0
- native_agent_runner/py.typed +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Multi-agent profile metadata."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from monoid_agent_kernel.conformance.harness import CapabilityHarness, MultiAgentBackendHarness
|
|
8
|
+
|
|
9
|
+
from ._metadata import ProfileMetadata
|
|
10
|
+
|
|
11
|
+
PROFILE = ProfileMetadata(
|
|
12
|
+
profile_id="multi-agent",
|
|
13
|
+
title="Multi Agent",
|
|
14
|
+
summary="Subagent runtime with identity, capability isolation, shared revocation, and trace linkage.",
|
|
15
|
+
rule_ids=("OR-04-REVOCATION-SCOPE", "OR-09-SUBAGENT-BOUNDARY"),
|
|
16
|
+
harnesses=("multi-agent-backend", "capability"),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def assert_multi_agent_backend_boundary_profile(harness: MultiAgentBackendHarness) -> None:
|
|
21
|
+
"""Run the backend subagent identity and diagnostics smoke matrix."""
|
|
22
|
+
result = harness.run_subagent_boundary_case()
|
|
23
|
+
assert result["parent_stream_isolated"] is True
|
|
24
|
+
assert result["child_identity_valid"] is True
|
|
25
|
+
assert result["descendant_events_readable"] is True
|
|
26
|
+
assert result["non_descendant_rejected"] is True
|
|
27
|
+
assert result["path_traversal_rejected"] is True
|
|
28
|
+
assert result["trace_linked"] is True
|
|
29
|
+
assert result["task_result_linked"] is True
|
|
30
|
+
assert result["diagnostics_summary_present"] is True
|
|
31
|
+
assert result["usage_rollup_matches"] is True
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def assert_multi_agent_backend_capability_boundary_profile(harness: MultiAgentBackendHarness) -> None:
|
|
35
|
+
"""Run the child capability-boundary smoke matrix."""
|
|
36
|
+
result = harness.run_subagent_capability_boundary_case()
|
|
37
|
+
assert result["revoked_event_observed"] is True
|
|
38
|
+
assert result["child_result_observed_revoked"] is True
|
|
39
|
+
assert result["gated_handler_not_called"] is True
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def assert_multi_agent_shared_revocation_profile(harness: CapabilityHarness) -> None:
|
|
43
|
+
"""Run the child-vault revocation sharing smoke matrix."""
|
|
44
|
+
_admit_profile_lease(
|
|
45
|
+
harness,
|
|
46
|
+
capability="web.search",
|
|
47
|
+
lease_id="lease_parent_live",
|
|
48
|
+
token_ref="token:parent-live",
|
|
49
|
+
durable=False,
|
|
50
|
+
)
|
|
51
|
+
_admit_profile_lease(
|
|
52
|
+
harness,
|
|
53
|
+
capability="web.fetch",
|
|
54
|
+
lease_id="lease_parent_durable",
|
|
55
|
+
token_ref="token:parent-durable",
|
|
56
|
+
durable=True,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
child = harness.fork_child()
|
|
60
|
+
assert child.token_for("web.search", now=200.0) is None
|
|
61
|
+
assert child.token_for("web.fetch", now=200.0) == "token:parent-durable"
|
|
62
|
+
|
|
63
|
+
_admit_profile_lease(
|
|
64
|
+
child,
|
|
65
|
+
capability="web.search",
|
|
66
|
+
lease_id="lease_child_live",
|
|
67
|
+
token_ref="token:child-live",
|
|
68
|
+
durable=False,
|
|
69
|
+
)
|
|
70
|
+
assert harness.token_for("web.search", now=200.0) == "token:parent-live"
|
|
71
|
+
assert child.token_for("web.search", now=200.0) == "token:child-live"
|
|
72
|
+
|
|
73
|
+
harness.revoke_capability({"capability": "web.search"})
|
|
74
|
+
assert harness.token_for("web.search", now=200.0) is None
|
|
75
|
+
assert child.token_for("web.search", now=200.0) is None
|
|
76
|
+
|
|
77
|
+
_admit_profile_lease(
|
|
78
|
+
child,
|
|
79
|
+
capability="web.context",
|
|
80
|
+
lease_id="lease_child_only",
|
|
81
|
+
token_ref="token:child-only",
|
|
82
|
+
durable=False,
|
|
83
|
+
)
|
|
84
|
+
assert child.token_for("web.context", now=200.0) == "token:child-only"
|
|
85
|
+
assert harness.token_for("web.context", now=200.0) is None
|
|
86
|
+
|
|
87
|
+
child.revoke_capability({"capability": "*"})
|
|
88
|
+
assert harness.token_for("web.fetch", now=200.0) is None
|
|
89
|
+
assert child.token_for("web.context", now=200.0) is None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _admit_profile_lease(
|
|
93
|
+
harness: CapabilityHarness,
|
|
94
|
+
*,
|
|
95
|
+
capability: str,
|
|
96
|
+
lease_id: str,
|
|
97
|
+
token_ref: str,
|
|
98
|
+
durable: bool,
|
|
99
|
+
) -> dict[str, Any]:
|
|
100
|
+
request = harness.request_capability({"capability": capability, "scope": {}})
|
|
101
|
+
return harness.grant_capability(
|
|
102
|
+
str(request["request_id"]),
|
|
103
|
+
{
|
|
104
|
+
"lease_id": lease_id,
|
|
105
|
+
"capability": capability,
|
|
106
|
+
"token_ref": token_ref,
|
|
107
|
+
"expires_at": 4_102_444_800.0,
|
|
108
|
+
"issued_at": 100.0,
|
|
109
|
+
"durable": durable,
|
|
110
|
+
"scope": {},
|
|
111
|
+
},
|
|
112
|
+
)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Provider-gateway profile metadata."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from monoid_agent_kernel.conformance.harness import GatewayHarness
|
|
9
|
+
|
|
10
|
+
from ._metadata import ProfileMetadata
|
|
11
|
+
|
|
12
|
+
PROFILE = ProfileMetadata(
|
|
13
|
+
profile_id="provider-gateway",
|
|
14
|
+
title="Provider Gateway",
|
|
15
|
+
summary="Gateway runtime with signed scopes, domain boundaries, redirect checks, and effective caps.",
|
|
16
|
+
rule_ids=("OR-01-SCOPE-RELATION", "OR-02-CAPABILITY-BOUNDARY", "OR-08-PROVIDER-CAPS"),
|
|
17
|
+
harnesses=("gateway",),
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def assert_provider_gateway_profile(harness: GatewayHarness) -> None:
|
|
22
|
+
"""Run the provider-gateway conformance smoke matrix."""
|
|
23
|
+
search = harness.call_gateway(
|
|
24
|
+
"web.search",
|
|
25
|
+
{"query": "binding"},
|
|
26
|
+
signed_scope={
|
|
27
|
+
"binding_id": "search_docs",
|
|
28
|
+
"max_calls": 2,
|
|
29
|
+
"max_results": 1,
|
|
30
|
+
"allowed_domains": ["docs.example.test"],
|
|
31
|
+
"blocked_domains": ["blog.example.test"],
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
assert search["effective_max_results"] == 1
|
|
35
|
+
assert search["result_count"] == 1
|
|
36
|
+
assert {result["domain"] for result in search["results"]} == {"docs.example.test"}
|
|
37
|
+
|
|
38
|
+
narrowed = harness.call_gateway(
|
|
39
|
+
"web.search",
|
|
40
|
+
{"binding_id": "search_docs", "query": "binding", "max_results": 1},
|
|
41
|
+
signed_scope={
|
|
42
|
+
"binding_id": "search_docs",
|
|
43
|
+
"max_calls": 2,
|
|
44
|
+
"max_results": 3,
|
|
45
|
+
"allowed_domains": ["*.example.test"],
|
|
46
|
+
},
|
|
47
|
+
)
|
|
48
|
+
assert narrowed["effective_max_results"] == 1
|
|
49
|
+
|
|
50
|
+
_assert_raises(
|
|
51
|
+
lambda: harness.call_gateway(
|
|
52
|
+
"web.search",
|
|
53
|
+
{"binding_id": "search_docs", "query": "binding", "max_results": 2},
|
|
54
|
+
signed_scope={"binding_id": "search_docs", "max_calls": 2, "max_results": 1},
|
|
55
|
+
),
|
|
56
|
+
"max_results exceeds signed token scope",
|
|
57
|
+
)
|
|
58
|
+
_assert_raises(
|
|
59
|
+
lambda: harness.call_gateway(
|
|
60
|
+
"web.fetch",
|
|
61
|
+
{"url": "https://docs.example.test/monoid-agent-kernel/web"},
|
|
62
|
+
signed_capability="web.search",
|
|
63
|
+
signed_scope={"binding_id": "search_docs", "allowed_domains": ["docs.example.test"]},
|
|
64
|
+
),
|
|
65
|
+
"capability does not match endpoint",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
fetched = harness.call_gateway(
|
|
69
|
+
"web.fetch",
|
|
70
|
+
{"url": "https://docs.example.test/monoid-agent-kernel/web"},
|
|
71
|
+
signed_scope={
|
|
72
|
+
"binding_id": "fetch_docs",
|
|
73
|
+
"max_calls": 2,
|
|
74
|
+
"max_bytes": 12,
|
|
75
|
+
"timeout_s": 2,
|
|
76
|
+
"allowed_domains": ["docs.example.test"],
|
|
77
|
+
},
|
|
78
|
+
)
|
|
79
|
+
assert fetched["effective_max_bytes"] == 12
|
|
80
|
+
assert fetched["effective_timeout_s"] == 2
|
|
81
|
+
assert fetched["content_bytes"] <= 12
|
|
82
|
+
|
|
83
|
+
context = harness.call_gateway(
|
|
84
|
+
"web.context",
|
|
85
|
+
{"query": "binding"},
|
|
86
|
+
signed_scope={
|
|
87
|
+
"binding_id": "context_docs",
|
|
88
|
+
"max_calls": 2,
|
|
89
|
+
"max_tokens": 2,
|
|
90
|
+
"max_urls": 1,
|
|
91
|
+
"max_snippets": 1,
|
|
92
|
+
"allowed_domains": ["docs.example.test"],
|
|
93
|
+
},
|
|
94
|
+
)
|
|
95
|
+
assert context["effective_max_tokens"] == 2
|
|
96
|
+
assert context["effective_max_urls"] == 1
|
|
97
|
+
assert context["effective_max_snippets"] == 1
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _assert_raises(operation: Callable[[], Any], message: str) -> None:
|
|
101
|
+
try:
|
|
102
|
+
operation()
|
|
103
|
+
except Exception as exc:
|
|
104
|
+
if message not in str(exc):
|
|
105
|
+
raise AssertionError(f"expected error containing {message!r}, got {exc!r}") from exc
|
|
106
|
+
return
|
|
107
|
+
raise AssertionError(f"expected error containing {message!r}")
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Reference-full profile metadata."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Protocol
|
|
6
|
+
from typing import Any, Callable
|
|
7
|
+
|
|
8
|
+
from monoid_agent_kernel.conformance.harness import (
|
|
9
|
+
BackendHarness,
|
|
10
|
+
CapabilityHarness,
|
|
11
|
+
ControlPlaneHarness,
|
|
12
|
+
DurableRunnerHarness,
|
|
13
|
+
GatewayHarness,
|
|
14
|
+
MessageFabricHarness,
|
|
15
|
+
MultiAgentBackendHarness,
|
|
16
|
+
SideEffectHarness,
|
|
17
|
+
ToolAgentHarness,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from .capability_security import (
|
|
21
|
+
assert_capability_security_lease_admission,
|
|
22
|
+
assert_capability_security_revocation_profile,
|
|
23
|
+
)
|
|
24
|
+
from .control_plane import (
|
|
25
|
+
assert_control_plane_audit_sequence_profile,
|
|
26
|
+
assert_control_plane_decision_profile,
|
|
27
|
+
)
|
|
28
|
+
from .durable_runner import (
|
|
29
|
+
assert_durable_runner_event_sequence_profile,
|
|
30
|
+
assert_durable_runner_recovery_metadata_profile,
|
|
31
|
+
assert_durable_runner_subagent_diagnostics_profile,
|
|
32
|
+
)
|
|
33
|
+
from ._metadata import ProfileMetadata
|
|
34
|
+
from .message_fabric import assert_message_fabric_profile
|
|
35
|
+
from .multi_agent import (
|
|
36
|
+
assert_multi_agent_backend_boundary_profile,
|
|
37
|
+
assert_multi_agent_backend_capability_boundary_profile,
|
|
38
|
+
assert_multi_agent_shared_revocation_profile,
|
|
39
|
+
)
|
|
40
|
+
from .provider_gateway import assert_provider_gateway_profile
|
|
41
|
+
from .side_effect_tool_agent import assert_side_effect_tool_agent_profile
|
|
42
|
+
from .tool_agent import (
|
|
43
|
+
assert_tool_agent_generic_ask_approval_profile,
|
|
44
|
+
assert_tool_agent_surface_admission_profile,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
PROFILE = ProfileMetadata(
|
|
48
|
+
profile_id="reference-full",
|
|
49
|
+
title="Reference Full",
|
|
50
|
+
summary="Bundled Reference services and Studio smoke path across current operational rules.",
|
|
51
|
+
rule_ids=(
|
|
52
|
+
"OR-01-SCOPE-RELATION",
|
|
53
|
+
"OR-02-CAPABILITY-BOUNDARY",
|
|
54
|
+
"OR-03-LEASE-ADMISSION",
|
|
55
|
+
"OR-04-REVOCATION-SCOPE",
|
|
56
|
+
"OR-05-EVENT-SEQUENCING",
|
|
57
|
+
"OR-06-CONTROL-AUDIT",
|
|
58
|
+
"OR-07-DURABLE-METADATA",
|
|
59
|
+
"OR-08-PROVIDER-CAPS",
|
|
60
|
+
"OR-09-SUBAGENT-BOUNDARY",
|
|
61
|
+
"OR-10-TOOL-SURFACE-ADMISSION",
|
|
62
|
+
"OR-11-GENERIC-ASK-APPROVAL",
|
|
63
|
+
"OR-12-DURABLE-SIDE-EFFECT",
|
|
64
|
+
"OR-13-EXTERNAL-AGENT-ENVELOPE",
|
|
65
|
+
),
|
|
66
|
+
harnesses=("backend", "capability", "gateway", "side-effect", "message-fabric", "studio"),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class ReferenceFullFactory(Protocol):
|
|
71
|
+
def new_backend(self) -> BackendHarness:
|
|
72
|
+
"""Return a fresh Reference backend harness."""
|
|
73
|
+
|
|
74
|
+
def new_tool_agent(self) -> ToolAgentHarness:
|
|
75
|
+
"""Return a fresh Reference tool-agent harness."""
|
|
76
|
+
|
|
77
|
+
def new_control_plane(self) -> ControlPlaneHarness:
|
|
78
|
+
"""Return a fresh Reference control-plane harness."""
|
|
79
|
+
|
|
80
|
+
def new_durable_runner(self) -> DurableRunnerHarness:
|
|
81
|
+
"""Return a fresh Reference durable-runner harness."""
|
|
82
|
+
|
|
83
|
+
def new_multi_agent(self) -> MultiAgentBackendHarness:
|
|
84
|
+
"""Return a fresh Reference multi-agent backend harness."""
|
|
85
|
+
|
|
86
|
+
def new_side_effect(self) -> SideEffectHarness:
|
|
87
|
+
"""Return a fresh Reference side-effect harness."""
|
|
88
|
+
|
|
89
|
+
def new_message_fabric(self) -> MessageFabricHarness:
|
|
90
|
+
"""Return a fresh Reference message-fabric harness."""
|
|
91
|
+
|
|
92
|
+
def new_capability(self) -> CapabilityHarness:
|
|
93
|
+
"""Return a fresh Reference capability harness."""
|
|
94
|
+
|
|
95
|
+
def new_gateway(self) -> GatewayHarness:
|
|
96
|
+
"""Return a fresh Reference gateway harness."""
|
|
97
|
+
|
|
98
|
+
def run_studio_smoke(self) -> dict:
|
|
99
|
+
"""Run the Reference Studio smoke path."""
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def assert_reference_full_profile(factory: ReferenceFullFactory) -> None:
|
|
103
|
+
"""Run the bundled Reference implementation across the current profile set."""
|
|
104
|
+
assert_provider_gateway_profile(factory.new_gateway())
|
|
105
|
+
|
|
106
|
+
assert_capability_security_lease_admission(factory.new_capability())
|
|
107
|
+
assert_capability_security_revocation_profile(factory.new_capability())
|
|
108
|
+
assert_multi_agent_shared_revocation_profile(factory.new_capability())
|
|
109
|
+
|
|
110
|
+
_run_with_close(factory.new_control_plane(), assert_control_plane_decision_profile)
|
|
111
|
+
_run_with_close(factory.new_control_plane(), assert_control_plane_audit_sequence_profile)
|
|
112
|
+
|
|
113
|
+
_run_with_close(factory.new_tool_agent(), assert_tool_agent_surface_admission_profile)
|
|
114
|
+
_run_with_close(factory.new_tool_agent(), assert_tool_agent_generic_ask_approval_profile)
|
|
115
|
+
_run_with_close(factory.new_side_effect(), assert_side_effect_tool_agent_profile)
|
|
116
|
+
_run_with_close(factory.new_message_fabric(), assert_message_fabric_profile)
|
|
117
|
+
|
|
118
|
+
_run_with_close(factory.new_durable_runner(), assert_durable_runner_event_sequence_profile)
|
|
119
|
+
_run_with_close(factory.new_durable_runner(), assert_durable_runner_recovery_metadata_profile)
|
|
120
|
+
_run_with_close(factory.new_durable_runner(), assert_durable_runner_subagent_diagnostics_profile)
|
|
121
|
+
|
|
122
|
+
_run_with_close(factory.new_multi_agent(), assert_multi_agent_backend_boundary_profile)
|
|
123
|
+
_run_with_close(factory.new_multi_agent(), assert_multi_agent_backend_capability_boundary_profile)
|
|
124
|
+
|
|
125
|
+
smoke = factory.run_studio_smoke()
|
|
126
|
+
assert smoke["run_id"]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _run_with_close(harness: Any, assertion: Callable[[Any], None]) -> None:
|
|
130
|
+
try:
|
|
131
|
+
assertion(harness)
|
|
132
|
+
finally:
|
|
133
|
+
close = getattr(harness, "close", None)
|
|
134
|
+
if callable(close):
|
|
135
|
+
close()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""External side-effect tool profile metadata and assertions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from monoid_agent_kernel.conformance.harness import SideEffectHarness
|
|
6
|
+
|
|
7
|
+
from ._metadata import ProfileMetadata
|
|
8
|
+
|
|
9
|
+
PROFILE = ProfileMetadata(
|
|
10
|
+
profile_id="side-effect-tool-agent",
|
|
11
|
+
title="Side-Effect Tool Agent",
|
|
12
|
+
summary="Agent integration that runs external side-effect tools with durable outbox or idempotency admission.",
|
|
13
|
+
rule_ids=("OR-12-DURABLE-SIDE-EFFECT",),
|
|
14
|
+
harnesses=("side-effect",),
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def assert_side_effect_tool_agent_profile(harness: SideEffectHarness) -> None:
|
|
19
|
+
"""Run the Phase 2 durable side-effect/outbox smoke matrix."""
|
|
20
|
+
|
|
21
|
+
dispatched = harness.run_outbox_dispatched_case()
|
|
22
|
+
assert dispatched["requested"] is True
|
|
23
|
+
assert dispatched["dispatched"] is True
|
|
24
|
+
|
|
25
|
+
pending = harness.run_pending_recovery_case()
|
|
26
|
+
assert pending["initial_status"] == "pending"
|
|
27
|
+
assert pending["recovered_status"] == "pending"
|
|
28
|
+
assert pending["request_id"] == pending["recovered_request_id"]
|
|
29
|
+
|
|
30
|
+
rejected = harness.run_strict_rejected_case()
|
|
31
|
+
assert rejected["denied"] is True
|
|
32
|
+
assert rejected["handler_finished"] is False
|
|
33
|
+
|
|
34
|
+
idempotent = harness.run_idempotent_inline_case()
|
|
35
|
+
assert idempotent["missing_denied"] is True
|
|
36
|
+
assert idempotent["valid_finished"] is True
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Tool-using agent profile metadata and assertions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from monoid_agent_kernel.conformance.harness import ToolAgentHarness
|
|
6
|
+
|
|
7
|
+
from ._metadata import ProfileMetadata
|
|
8
|
+
|
|
9
|
+
PROFILE = ProfileMetadata(
|
|
10
|
+
profile_id="tool-agent",
|
|
11
|
+
title="Tool Agent",
|
|
12
|
+
summary="Agent integration that executes tools with bindings, permissions, and output validation.",
|
|
13
|
+
rule_ids=(
|
|
14
|
+
"OR-10-TOOL-SURFACE-ADMISSION",
|
|
15
|
+
"OR-11-GENERIC-ASK-APPROVAL",
|
|
16
|
+
),
|
|
17
|
+
harnesses=("tool-agent",),
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def assert_tool_agent_surface_admission_profile(harness: ToolAgentHarness) -> None:
|
|
22
|
+
"""Run the Phase 2 tool surface admission smoke matrix."""
|
|
23
|
+
result = harness.run_tool_surface_admission_case()
|
|
24
|
+
assert result["permission_denied"] is True
|
|
25
|
+
assert result["denial_code"] == "tool_quota_exceeded"
|
|
26
|
+
assert result["run_completed"] is True
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def assert_tool_agent_generic_ask_approval_profile(harness: ToolAgentHarness) -> None:
|
|
30
|
+
"""Run the Phase 2 generic authorization='ask' approval smoke matrix."""
|
|
31
|
+
result = harness.run_generic_ask_approval_case()
|
|
32
|
+
assert result["approved_requested"] is True
|
|
33
|
+
assert result["approved_recorded"] is True
|
|
34
|
+
assert result["approved_replayed_once"] is True
|
|
35
|
+
assert result["denied_requested"] is True
|
|
36
|
+
assert result["denied_recorded"] is True
|
|
37
|
+
assert result["denied_replayed"] is False
|
|
38
|
+
assert result["stale_approved_recorded"] is True
|
|
39
|
+
assert result["stale_replay_rejected"] is True
|