capability-runtime 0.1.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.
Files changed (138) hide show
  1. capability_runtime-0.1.0/PKG-INFO +232 -0
  2. capability_runtime-0.1.0/README.md +216 -0
  3. capability_runtime-0.1.0/pyproject.toml +51 -0
  4. capability_runtime-0.1.0/setup.cfg +4 -0
  5. capability_runtime-0.1.0/src/capability_runtime/__init__.py +90 -0
  6. capability_runtime-0.1.0/src/capability_runtime/adapters/__init__.py +13 -0
  7. capability_runtime-0.1.0/src/capability_runtime/adapters/agent_adapter.py +439 -0
  8. capability_runtime-0.1.0/src/capability_runtime/adapters/agently_backend.py +423 -0
  9. capability_runtime-0.1.0/src/capability_runtime/adapters/triggerflow_workflow_engine.py +865 -0
  10. capability_runtime-0.1.0/src/capability_runtime/adapters/workflow_engine.py +43 -0
  11. capability_runtime-0.1.0/src/capability_runtime/config.py +172 -0
  12. capability_runtime-0.1.0/src/capability_runtime/errors.py +20 -0
  13. capability_runtime-0.1.0/src/capability_runtime/guards.py +150 -0
  14. capability_runtime-0.1.0/src/capability_runtime/host_protocol.py +400 -0
  15. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/__init__.py +55 -0
  16. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/approvals_profiles.py +94 -0
  17. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/evidence_hooks.py +65 -0
  18. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/history.py +74 -0
  19. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/invoke_capability.py +409 -0
  20. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/resume.py +317 -0
  21. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/system_prompt.py +132 -0
  22. capability_runtime-0.1.0/src/capability_runtime/host_toolkit/turn_delta.py +128 -0
  23. capability_runtime-0.1.0/src/capability_runtime/logging_utils.py +94 -0
  24. capability_runtime-0.1.0/src/capability_runtime/manifest.py +173 -0
  25. capability_runtime-0.1.0/src/capability_runtime/output_validator.py +139 -0
  26. capability_runtime-0.1.0/src/capability_runtime/protocol/__init__.py +43 -0
  27. capability_runtime-0.1.0/src/capability_runtime/protocol/agent.py +62 -0
  28. capability_runtime-0.1.0/src/capability_runtime/protocol/capability.py +98 -0
  29. capability_runtime-0.1.0/src/capability_runtime/protocol/chat_backend.py +38 -0
  30. capability_runtime-0.1.0/src/capability_runtime/protocol/context.py +244 -0
  31. capability_runtime-0.1.0/src/capability_runtime/protocol/workflow.py +119 -0
  32. capability_runtime-0.1.0/src/capability_runtime/registry.py +287 -0
  33. capability_runtime-0.1.0/src/capability_runtime/reporting/__init__.py +2 -0
  34. capability_runtime-0.1.0/src/capability_runtime/reporting/node_report.py +497 -0
  35. capability_runtime-0.1.0/src/capability_runtime/runtime.py +930 -0
  36. capability_runtime-0.1.0/src/capability_runtime/runtime_ui_events_mixin.py +310 -0
  37. capability_runtime-0.1.0/src/capability_runtime/sdk_lifecycle.py +982 -0
  38. capability_runtime-0.1.0/src/capability_runtime/service_facade.py +418 -0
  39. capability_runtime-0.1.0/src/capability_runtime/services.py +181 -0
  40. capability_runtime-0.1.0/src/capability_runtime/structured_output.py +208 -0
  41. capability_runtime-0.1.0/src/capability_runtime/structured_stream.py +38 -0
  42. capability_runtime-0.1.0/src/capability_runtime/types.py +103 -0
  43. capability_runtime-0.1.0/src/capability_runtime/ui_events/__init__.py +19 -0
  44. capability_runtime-0.1.0/src/capability_runtime/ui_events/projector.py +617 -0
  45. capability_runtime-0.1.0/src/capability_runtime/ui_events/session.py +292 -0
  46. capability_runtime-0.1.0/src/capability_runtime/ui_events/store.py +127 -0
  47. capability_runtime-0.1.0/src/capability_runtime/ui_events/transport.py +33 -0
  48. capability_runtime-0.1.0/src/capability_runtime/ui_events/v1.py +76 -0
  49. capability_runtime-0.1.0/src/capability_runtime/upstream_compat.py +182 -0
  50. capability_runtime-0.1.0/src/capability_runtime/utils/__init__.py +1 -0
  51. capability_runtime-0.1.0/src/capability_runtime/utils/usage.py +65 -0
  52. capability_runtime-0.1.0/src/capability_runtime/workflow_runtime.py +218 -0
  53. capability_runtime-0.1.0/src/capability_runtime.egg-info/PKG-INFO +232 -0
  54. capability_runtime-0.1.0/src/capability_runtime.egg-info/SOURCES.txt +136 -0
  55. capability_runtime-0.1.0/src/capability_runtime.egg-info/dependency_links.txt +1 -0
  56. capability_runtime-0.1.0/src/capability_runtime.egg-info/requires.txt +9 -0
  57. capability_runtime-0.1.0/src/capability_runtime.egg-info/top_level.txt +1 -0
  58. capability_runtime-0.1.0/tests/test_agently_backend.py +201 -0
  59. capability_runtime-0.1.0/tests/test_agently_backend_replay.py +535 -0
  60. capability_runtime-0.1.0/tests/test_backend_mode.py +106 -0
  61. capability_runtime-0.1.0/tests/test_bilingual_docs_surface.py +42 -0
  62. capability_runtime-0.1.0/tests/test_bridge_artifacts_passthrough.py +47 -0
  63. capability_runtime-0.1.0/tests/test_bridge_register_tool_public_api.py +88 -0
  64. capability_runtime-0.1.0/tests/test_coding_agent_examples_atomic.py +80 -0
  65. capability_runtime-0.1.0/tests/test_coding_agent_examples_recipes.py +61 -0
  66. capability_runtime-0.1.0/tests/test_config_glue.py +41 -0
  67. capability_runtime-0.1.0/tests/test_dependency_pins.py +26 -0
  68. capability_runtime-0.1.0/tests/test_docs_pinned_dependency_versions.py +34 -0
  69. capability_runtime-0.1.0/tests/test_docs_scheme2_no_skilladapter_residue.py +70 -0
  70. capability_runtime-0.1.0/tests/test_error_observability.py +128 -0
  71. capability_runtime-0.1.0/tests/test_examples_alignment_fixes_l1.py +79 -0
  72. capability_runtime-0.1.0/tests/test_examples_no_agent_sdk_imports.py +54 -0
  73. capability_runtime-0.1.0/tests/test_examples_real_evidence_strict_integration.py +240 -0
  74. capability_runtime-0.1.0/tests/test_examples_real_integration.py +215 -0
  75. capability_runtime-0.1.0/tests/test_examples_smoke.py +120 -0
  76. capability_runtime-0.1.0/tests/test_examples_ui_events_showcase_offline.py +315 -0
  77. capability_runtime-0.1.0/tests/test_examples_ui_events_showcase_real_fallback.py +85 -0
  78. capability_runtime-0.1.0/tests/test_examples_ui_events_showcase_real_integration.py +85 -0
  79. capability_runtime-0.1.0/tests/test_examples_ui_events_showcase_ui_contract.py +126 -0
  80. capability_runtime-0.1.0/tests/test_examples_workflow_skills_first_smoke.py +33 -0
  81. capability_runtime-0.1.0/tests/test_guards.py +89 -0
  82. capability_runtime-0.1.0/tests/test_host_toolkit_approvals_profiles.py +17 -0
  83. capability_runtime-0.1.0/tests/test_host_toolkit_history_assembler.py +33 -0
  84. capability_runtime-0.1.0/tests/test_host_toolkit_invoke_capability.py +492 -0
  85. capability_runtime-0.1.0/tests/test_host_toolkit_invoke_capability_shared_runtime.py +122 -0
  86. capability_runtime-0.1.0/tests/test_host_toolkit_resume_helper.py +136 -0
  87. capability_runtime-0.1.0/tests/test_host_toolkit_system_prompt_evidence.py +56 -0
  88. capability_runtime-0.1.0/tests/test_host_toolkit_turn_delta.py +60 -0
  89. capability_runtime-0.1.0/tests/test_integration_agently_requester_smoke.py +47 -0
  90. capability_runtime-0.1.0/tests/test_integration_approval_event_shape.py +64 -0
  91. capability_runtime-0.1.0/tests/test_integration_sources_redis_pgsql_smoke.py +84 -0
  92. capability_runtime-0.1.0/tests/test_loop.py +231 -0
  93. capability_runtime-0.1.0/tests/test_node_report_builder.py +328 -0
  94. capability_runtime-0.1.0/tests/test_node_report_contract_v1.py +114 -0
  95. capability_runtime-0.1.0/tests/test_node_report_engine_identity_contract.py +89 -0
  96. capability_runtime-0.1.0/tests/test_offline_backend_injection_evidence.py +180 -0
  97. capability_runtime-0.1.0/tests/test_per_capability_llm_config_model_routing.py +282 -0
  98. capability_runtime-0.1.0/tests/test_preflight_gate.py +324 -0
  99. capability_runtime-0.1.0/tests/test_project_identity_naming_matrix.py +30 -0
  100. capability_runtime-0.1.0/tests/test_public_api_exports.py +87 -0
  101. capability_runtime-0.1.0/tests/test_public_repo_hygiene.py +71 -0
  102. capability_runtime-0.1.0/tests/test_qa_agent.py +170 -0
  103. capability_runtime-0.1.0/tests/test_registry.py +211 -0
  104. capability_runtime-0.1.0/tests/test_release_tag_version_guardrail.py +39 -0
  105. capability_runtime-0.1.0/tests/test_replay_tool_calls_alignment.py +116 -0
  106. capability_runtime-0.1.0/tests/test_repo_hygiene_no_tracked_env_or_pyc.py +99 -0
  107. capability_runtime-0.1.0/tests/test_repo_no_deep_imports_in_user_facing_docs.py +99 -0
  108. capability_runtime-0.1.0/tests/test_review_followups_module_contracts.py +57 -0
  109. capability_runtime-0.1.0/tests/test_runtime_bridge_fake_backend.py +55 -0
  110. capability_runtime-0.1.0/tests/test_runtime_concurrency.py +36 -0
  111. capability_runtime-0.1.0/tests/test_runtime_engine.py +96 -0
  112. capability_runtime-0.1.0/tests/test_runtime_hitl_host_protocol.py +247 -0
  113. capability_runtime-0.1.0/tests/test_runtime_hooks_and_schema_gate.py +150 -0
  114. capability_runtime-0.1.0/tests/test_runtime_initial_history_and_meta.py +87 -0
  115. capability_runtime-0.1.0/tests/test_runtime_manifest.py +145 -0
  116. capability_runtime-0.1.0/tests/test_runtime_run_stream_semantics_v1.py +211 -0
  117. capability_runtime-0.1.0/tests/test_runtime_service_facade_rpc_mapping.py +181 -0
  118. capability_runtime-0.1.0/tests/test_runtime_service_session_bridge.py +246 -0
  119. capability_runtime-0.1.0/tests/test_runtime_status_mapping.py +144 -0
  120. capability_runtime-0.1.0/tests/test_runtime_structured_output_bridge.py +181 -0
  121. capability_runtime-0.1.0/tests/test_runtime_structured_stream.py +105 -0
  122. capability_runtime-0.1.0/tests/test_sandbox_permissions_passthrough_contract.py +165 -0
  123. capability_runtime-0.1.0/tests/test_services_call_callback.py +84 -0
  124. capability_runtime-0.1.0/tests/test_services_map_node_status.py +45 -0
  125. capability_runtime-0.1.0/tests/test_skills_conformance_smoke.py +170 -0
  126. capability_runtime-0.1.0/tests/test_upstream_adapter_tool_registration.py +87 -0
  127. capability_runtime-0.1.0/tests/test_upstream_chat_backend_protocol_contract.py +70 -0
  128. capability_runtime-0.1.0/tests/test_upstream_chat_sse_usage_contract.py +35 -0
  129. capability_runtime-0.1.0/tests/test_upstream_compat_spaces_schema.py +75 -0
  130. capability_runtime-0.1.0/tests/test_upstream_runtime_client_server_contract.py +27 -0
  131. capability_runtime-0.1.0/tests/test_upstream_sandbox_profile_precedence_contract.py +54 -0
  132. capability_runtime-0.1.0/tests/test_upstream_skills_bundles_contract.py +39 -0
  133. capability_runtime-0.1.0/tests/test_upstream_tool_descriptor_compat.py +91 -0
  134. capability_runtime-0.1.0/tests/test_upstream_verification.py +25 -0
  135. capability_runtime-0.1.0/tests/test_versioning_strategy_guard.py +53 -0
  136. capability_runtime-0.1.0/tests/test_wal_backend_injection_contract.py +70 -0
  137. capability_runtime-0.1.0/tests/test_wal_locator_resolution_contract.py +73 -0
  138. capability_runtime-0.1.0/tests/test_workflow_host_runtime_surface.py +200 -0
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: capability-runtime
3
+ Version: 0.1.0
4
+ Summary: Bridge/glue layer that composes Agently (LLM/TriggerFlow) with skills-runtime-sdk (skills/tools/WAL/events).
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: PyYAML>=6
9
+ Requires-Dist: pydantic<3,>=2
10
+ Requires-Dist: agently==4.0.8
11
+ Requires-Dist: skills-runtime-sdk==0.1.11
12
+ Provides-Extra: dev
13
+ Requires-Dist: pytest>=7; extra == "dev"
14
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
15
+ Requires-Dist: mypy>=1.8; extra == "dev"
16
+
17
+ <div align="center">
18
+
19
+ [English](README.md) | [中文](README.zh-CN.md)
20
+
21
+ </div>
22
+
23
+ # capability-runtime
24
+
25
+ `capability-runtime` is a production-oriented runtime/adapter layer that exposes a
26
+ stable `Runtime` API while composing two upstream systems:
27
+
28
+ - `skills-runtime-sdk` for skills, tools, approvals, WAL, and event evidence
29
+ - `Agently` for OpenAI-compatible transport and TriggerFlow-based orchestration internals
30
+
31
+ The public contract of this repository is intentionally narrow:
32
+
33
+ - capability primitives: `AgentSpec` and `WorkflowSpec`
34
+ - execution entrypoint: `Runtime`
35
+ - evidence surface: `NodeReport`, host snapshots, and service-facade helpers
36
+
37
+ ## What You Get
38
+
39
+ - A single execution surface: `Runtime.run()` and `Runtime.run_stream()`
40
+ - Public capability registration and manifest descriptors
41
+ - Workflow orchestration on top of the runtime without exposing TriggerFlow as a public API
42
+ - Evidence-first results through `NodeReport`, tool-call reports, approval summaries, and WAL locators
43
+ - Host-facing helpers for wait/resume, approval tickets, continuity, and service streaming
44
+
45
+ ## Architecture At A Glance
46
+
47
+ ```text
48
+ +-----------------------------+
49
+ | Host Application |
50
+ | - register capabilities |
51
+ | - run / stream / continue |
52
+ +--------------+--------------+
53
+ |
54
+ v
55
+ +------------------------------------------------------------------------+
56
+ | capability-runtime |
57
+ | |
58
+ | Public contract |
59
+ | - AgentSpec / WorkflowSpec |
60
+ | - Runtime |
61
+ | - NodeReport / HostRunSnapshot / RuntimeServiceFacade |
62
+ | |
63
+ | Internal adapters |
64
+ | - AgentAdapter |
65
+ | - TriggerFlowWorkflowEngine |
66
+ | - service/session continuity bridge |
67
+ +------------------------------+-----------------------------------------+
68
+ |
69
+ v
70
+ +-------------------------------+
71
+ | skills-runtime-sdk |
72
+ | - skills + tools |
73
+ | - approvals + exec sessions |
74
+ | - WAL / AgentEvent evidence |
75
+ +---------------+---------------+
76
+ |
77
+ v
78
+ +-------------------------------+
79
+ | Agently / TriggerFlow |
80
+ | - OpenAI-compatible transport |
81
+ | - workflow execution internals|
82
+ +-------------------------------+
83
+ ```
84
+
85
+ ## Install
86
+
87
+ From source:
88
+
89
+ ```bash
90
+ python -m pip install -e .
91
+ ```
92
+
93
+ With development dependencies:
94
+
95
+ ```bash
96
+ python -m pip install -e ".[dev]"
97
+ ```
98
+
99
+ When the package is published, the install form is:
100
+
101
+ ```bash
102
+ python -m pip install capability-runtime
103
+ ```
104
+
105
+ Import name:
106
+
107
+ ```python
108
+ import capability_runtime
109
+ ```
110
+
111
+ ## Quickstart
112
+
113
+ ### 1. Offline runtime loop
114
+
115
+ ```bash
116
+ python examples/01_quickstart/run_mock.py
117
+ ```
118
+
119
+ This path is the smallest reproducible loop:
120
+
121
+ - register an `AgentSpec`
122
+ - validate the registry
123
+ - run in `mode="mock"`
124
+ - inspect the terminal `CapabilityResult`
125
+
126
+ ### 2. Bridge mode with a real model backend
127
+
128
+ ```bash
129
+ cp examples/01_quickstart/.env.example examples/01_quickstart/.env
130
+ python examples/01_quickstart/run_bridge.py
131
+ ```
132
+
133
+ Bridge mode reuses Agently's OpenAI-compatible transport but still delegates the
134
+ actual skills/tools/WAL semantics to `skills-runtime-sdk`.
135
+
136
+ ### 3. Workflow orchestration
137
+
138
+ ```bash
139
+ python examples/02_workflow/run.py
140
+ ```
141
+
142
+ For a higher-level index, start with [examples/README.md](examples/README.md).
143
+
144
+ ## Public API At A Glance
145
+
146
+ The package root exposes the supported contract:
147
+
148
+ ```python
149
+ from capability_runtime import (
150
+ Runtime,
151
+ RuntimeConfig,
152
+ CustomTool,
153
+ AgentSpec,
154
+ AgentIOSchema,
155
+ WorkflowSpec,
156
+ Step,
157
+ LoopStep,
158
+ ParallelStep,
159
+ ConditionalStep,
160
+ InputMapping,
161
+ CapabilitySpec,
162
+ CapabilityKind,
163
+ CapabilityResult,
164
+ CapabilityStatus,
165
+ NodeReport,
166
+ HostRunSnapshot,
167
+ ApprovalTicket,
168
+ ResumeIntent,
169
+ RuntimeServiceFacade,
170
+ RuntimeServiceRequest,
171
+ RuntimeServiceHandle,
172
+ RuntimeSession,
173
+ )
174
+ ```
175
+
176
+ The runtime currently supports three execution modes through `RuntimeConfig.mode`:
177
+
178
+ - `mock`: deterministic local testing without a real LLM backend
179
+ - `bridge`: Agently transport + `skills-runtime-sdk` execution semantics
180
+ - `sdk_native`: native `skills-runtime-sdk` backend without Agently transport
181
+
182
+ ## Repository Layout
183
+
184
+ ```text
185
+ .
186
+ ├── src/capability_runtime/ # package source
187
+ ├── examples/ # human-facing runnable examples
188
+ ├── docs_for_coding_agent/ # compact pack for coding agents
189
+ ├── help/ # public help and operational guides
190
+ ├── config/ # example config shapes
191
+ ├── scripts/ # release / validation helpers
192
+ └── tests/ # offline regression guardrails
193
+ ```
194
+
195
+ ## Documentation Map
196
+
197
+ - [help/README.md](help/README.md): public help index
198
+ - [examples/README.md](examples/README.md): runnable examples by scenario
199
+ - [docs_for_coding_agent/README.md](docs_for_coding_agent/README.md): compact coding-agent pack
200
+ - [config/README.md](config/README.md): config shape reference
201
+
202
+ Recommended reading order for new users:
203
+
204
+ 1. [help/00-overview.md](help/00-overview.md)
205
+ 2. [help/01-quickstart.md](help/01-quickstart.md)
206
+ 3. [help/03-python-api.md](help/03-python-api.md)
207
+ 4. [examples/README.md](examples/README.md)
208
+
209
+ ## Release And PyPI Publishing
210
+
211
+ This repository ships GitHub Actions workflows for:
212
+
213
+ - Tier-0 CI on push and pull request
214
+ - tag-driven and manual PyPI publishing
215
+
216
+ Release guardrails:
217
+
218
+ - the Git tag must match `pyproject.toml`'s `[project].version`
219
+ - the Git tag must match `capability_runtime.__version__`
220
+ - the publish job builds both sdist and wheel before uploading
221
+
222
+ The publish workflow is designed for PyPI Trusted Publishing. You still need to
223
+ configure the corresponding Trusted Publisher entry on `pypi.org`.
224
+
225
+ ## Relationship To The Upstreams
226
+
227
+ - `skills-runtime-sdk` remains the source of truth for skills, approvals, tools,
228
+ WAL, and event evidence.
229
+ - `Agently` remains the transport/orchestration substrate where this repository
230
+ chooses to bridge instead of forking or reimplementing.
231
+ - `capability-runtime` is the contract-convergence layer: it narrows those
232
+ upstream capabilities into a smaller host-facing runtime surface.
@@ -0,0 +1,216 @@
1
+ <div align="center">
2
+
3
+ [English](README.md) | [中文](README.zh-CN.md)
4
+
5
+ </div>
6
+
7
+ # capability-runtime
8
+
9
+ `capability-runtime` is a production-oriented runtime/adapter layer that exposes a
10
+ stable `Runtime` API while composing two upstream systems:
11
+
12
+ - `skills-runtime-sdk` for skills, tools, approvals, WAL, and event evidence
13
+ - `Agently` for OpenAI-compatible transport and TriggerFlow-based orchestration internals
14
+
15
+ The public contract of this repository is intentionally narrow:
16
+
17
+ - capability primitives: `AgentSpec` and `WorkflowSpec`
18
+ - execution entrypoint: `Runtime`
19
+ - evidence surface: `NodeReport`, host snapshots, and service-facade helpers
20
+
21
+ ## What You Get
22
+
23
+ - A single execution surface: `Runtime.run()` and `Runtime.run_stream()`
24
+ - Public capability registration and manifest descriptors
25
+ - Workflow orchestration on top of the runtime without exposing TriggerFlow as a public API
26
+ - Evidence-first results through `NodeReport`, tool-call reports, approval summaries, and WAL locators
27
+ - Host-facing helpers for wait/resume, approval tickets, continuity, and service streaming
28
+
29
+ ## Architecture At A Glance
30
+
31
+ ```text
32
+ +-----------------------------+
33
+ | Host Application |
34
+ | - register capabilities |
35
+ | - run / stream / continue |
36
+ +--------------+--------------+
37
+ |
38
+ v
39
+ +------------------------------------------------------------------------+
40
+ | capability-runtime |
41
+ | |
42
+ | Public contract |
43
+ | - AgentSpec / WorkflowSpec |
44
+ | - Runtime |
45
+ | - NodeReport / HostRunSnapshot / RuntimeServiceFacade |
46
+ | |
47
+ | Internal adapters |
48
+ | - AgentAdapter |
49
+ | - TriggerFlowWorkflowEngine |
50
+ | - service/session continuity bridge |
51
+ +------------------------------+-----------------------------------------+
52
+ |
53
+ v
54
+ +-------------------------------+
55
+ | skills-runtime-sdk |
56
+ | - skills + tools |
57
+ | - approvals + exec sessions |
58
+ | - WAL / AgentEvent evidence |
59
+ +---------------+---------------+
60
+ |
61
+ v
62
+ +-------------------------------+
63
+ | Agently / TriggerFlow |
64
+ | - OpenAI-compatible transport |
65
+ | - workflow execution internals|
66
+ +-------------------------------+
67
+ ```
68
+
69
+ ## Install
70
+
71
+ From source:
72
+
73
+ ```bash
74
+ python -m pip install -e .
75
+ ```
76
+
77
+ With development dependencies:
78
+
79
+ ```bash
80
+ python -m pip install -e ".[dev]"
81
+ ```
82
+
83
+ When the package is published, the install form is:
84
+
85
+ ```bash
86
+ python -m pip install capability-runtime
87
+ ```
88
+
89
+ Import name:
90
+
91
+ ```python
92
+ import capability_runtime
93
+ ```
94
+
95
+ ## Quickstart
96
+
97
+ ### 1. Offline runtime loop
98
+
99
+ ```bash
100
+ python examples/01_quickstart/run_mock.py
101
+ ```
102
+
103
+ This path is the smallest reproducible loop:
104
+
105
+ - register an `AgentSpec`
106
+ - validate the registry
107
+ - run in `mode="mock"`
108
+ - inspect the terminal `CapabilityResult`
109
+
110
+ ### 2. Bridge mode with a real model backend
111
+
112
+ ```bash
113
+ cp examples/01_quickstart/.env.example examples/01_quickstart/.env
114
+ python examples/01_quickstart/run_bridge.py
115
+ ```
116
+
117
+ Bridge mode reuses Agently's OpenAI-compatible transport but still delegates the
118
+ actual skills/tools/WAL semantics to `skills-runtime-sdk`.
119
+
120
+ ### 3. Workflow orchestration
121
+
122
+ ```bash
123
+ python examples/02_workflow/run.py
124
+ ```
125
+
126
+ For a higher-level index, start with [examples/README.md](examples/README.md).
127
+
128
+ ## Public API At A Glance
129
+
130
+ The package root exposes the supported contract:
131
+
132
+ ```python
133
+ from capability_runtime import (
134
+ Runtime,
135
+ RuntimeConfig,
136
+ CustomTool,
137
+ AgentSpec,
138
+ AgentIOSchema,
139
+ WorkflowSpec,
140
+ Step,
141
+ LoopStep,
142
+ ParallelStep,
143
+ ConditionalStep,
144
+ InputMapping,
145
+ CapabilitySpec,
146
+ CapabilityKind,
147
+ CapabilityResult,
148
+ CapabilityStatus,
149
+ NodeReport,
150
+ HostRunSnapshot,
151
+ ApprovalTicket,
152
+ ResumeIntent,
153
+ RuntimeServiceFacade,
154
+ RuntimeServiceRequest,
155
+ RuntimeServiceHandle,
156
+ RuntimeSession,
157
+ )
158
+ ```
159
+
160
+ The runtime currently supports three execution modes through `RuntimeConfig.mode`:
161
+
162
+ - `mock`: deterministic local testing without a real LLM backend
163
+ - `bridge`: Agently transport + `skills-runtime-sdk` execution semantics
164
+ - `sdk_native`: native `skills-runtime-sdk` backend without Agently transport
165
+
166
+ ## Repository Layout
167
+
168
+ ```text
169
+ .
170
+ ├── src/capability_runtime/ # package source
171
+ ├── examples/ # human-facing runnable examples
172
+ ├── docs_for_coding_agent/ # compact pack for coding agents
173
+ ├── help/ # public help and operational guides
174
+ ├── config/ # example config shapes
175
+ ├── scripts/ # release / validation helpers
176
+ └── tests/ # offline regression guardrails
177
+ ```
178
+
179
+ ## Documentation Map
180
+
181
+ - [help/README.md](help/README.md): public help index
182
+ - [examples/README.md](examples/README.md): runnable examples by scenario
183
+ - [docs_for_coding_agent/README.md](docs_for_coding_agent/README.md): compact coding-agent pack
184
+ - [config/README.md](config/README.md): config shape reference
185
+
186
+ Recommended reading order for new users:
187
+
188
+ 1. [help/00-overview.md](help/00-overview.md)
189
+ 2. [help/01-quickstart.md](help/01-quickstart.md)
190
+ 3. [help/03-python-api.md](help/03-python-api.md)
191
+ 4. [examples/README.md](examples/README.md)
192
+
193
+ ## Release And PyPI Publishing
194
+
195
+ This repository ships GitHub Actions workflows for:
196
+
197
+ - Tier-0 CI on push and pull request
198
+ - tag-driven and manual PyPI publishing
199
+
200
+ Release guardrails:
201
+
202
+ - the Git tag must match `pyproject.toml`'s `[project].version`
203
+ - the Git tag must match `capability_runtime.__version__`
204
+ - the publish job builds both sdist and wheel before uploading
205
+
206
+ The publish workflow is designed for PyPI Trusted Publishing. You still need to
207
+ configure the corresponding Trusted Publisher entry on `pypi.org`.
208
+
209
+ ## Relationship To The Upstreams
210
+
211
+ - `skills-runtime-sdk` remains the source of truth for skills, approvals, tools,
212
+ WAL, and event evidence.
213
+ - `Agently` remains the transport/orchestration substrate where this repository
214
+ chooses to bridge instead of forking or reimplementing.
215
+ - `capability-runtime` is the contract-convergence layer: it narrows those
216
+ upstream capabilities into a smaller host-facing runtime surface.
@@ -0,0 +1,51 @@
1
+ [project]
2
+ name = "capability-runtime"
3
+ version = "0.1.0"
4
+ description = "Bridge/glue layer that composes Agently (LLM/TriggerFlow) with skills-runtime-sdk (skills/tools/WAL/events)."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ dependencies = [
9
+ "PyYAML>=6",
10
+ "pydantic>=2,<3",
11
+ "agently==4.0.8",
12
+ "skills-runtime-sdk==0.1.11",
13
+ ]
14
+
15
+ [project.optional-dependencies]
16
+ dev = [
17
+ "pytest>=7",
18
+ "pytest-asyncio>=0.23",
19
+ "mypy>=1.8",
20
+ ]
21
+
22
+ [tool.setuptools]
23
+ package-dir = {"" = "src"}
24
+
25
+ [tool.setuptools.packages.find]
26
+ where = ["src"]
27
+
28
+ [tool.pytest.ini_options]
29
+ addopts = "-q"
30
+ asyncio_mode = "auto"
31
+ testpaths = ["tests"]
32
+ markers = [
33
+ "integration: optional integration tests (may require docker/services)",
34
+ ]
35
+
36
+ [tool.mypy]
37
+ python_version = "3.10"
38
+ mypy_path = "src"
39
+ explicit_package_bases = true
40
+ ignore_missing_imports = true
41
+ warn_unused_ignores = false
42
+ warn_unused_configs = true
43
+ disable_error_code = ["import-untyped"]
44
+
45
+ [[tool.mypy.overrides]]
46
+ module = ["examples.*"]
47
+ ignore_errors = true
48
+
49
+ [build-system]
50
+ requires = ["setuptools>=68", "wheel"]
51
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,90 @@
1
+ """capability-runtime:统一 Runtime 入口(能力协议 + 执行 + 报告)。"""
2
+ from __future__ import annotations
3
+
4
+ __version__ = "0.1.0"
5
+
6
+ # === 统一入口 ===
7
+ from .config import CustomTool, RuntimeConfig
8
+ from .runtime import Runtime
9
+ from .service_facade import RuntimeServiceFacade, RuntimeServiceHandle, RuntimeServiceRequest, RuntimeSession
10
+ from .structured_stream import StructuredStreamEvent
11
+
12
+ # === 报告类型 ===
13
+ from .types import NodeReport, NodeResult
14
+
15
+ # === Host toolkit(精选公共导出)===
16
+ from .host_toolkit import InvokeCapabilityAllowlist, make_invoke_capability_tool
17
+ from .host_protocol import ApprovalTicket, HostRunSnapshot, HostRunStatus, ResumeIntent
18
+ from .manifest import CapabilityDescriptor, CapabilityManifestEntry, CapabilityVisibility
19
+
20
+ # === Protocol 导出 ===
21
+ from .protocol.agent import AgentIOSchema, AgentSpec
22
+ from .protocol.capability import (
23
+ CapabilityKind,
24
+ CapabilityRef,
25
+ CapabilityResult,
26
+ CapabilitySpec,
27
+ CapabilityStatus,
28
+ )
29
+ from .protocol.context import ExecutionContext
30
+ from .protocol.workflow import (
31
+ ConditionalStep,
32
+ InputMapping,
33
+ LoopStep,
34
+ ParallelStep,
35
+ Step,
36
+ WorkflowSpec,
37
+ )
38
+ from .services import RuntimeServices
39
+ from .workflow_runtime import WorkflowReplayRequest, WorkflowRunSnapshot, WorkflowRunStatus, WorkflowStepSnapshot
40
+
41
+ # === 错误导出 ===
42
+ from .errors import CapabilityNotFoundError, RuntimeFrameworkError
43
+
44
+ __all__ = [
45
+ # Runtime
46
+ "Runtime",
47
+ "RuntimeConfig",
48
+ "CustomTool",
49
+ "StructuredStreamEvent",
50
+ # Reports
51
+ "NodeReport",
52
+ "NodeResult",
53
+ # Host toolkit (selected)
54
+ "InvokeCapabilityAllowlist",
55
+ "make_invoke_capability_tool",
56
+ # Protocol
57
+ "CapabilityKind",
58
+ "CapabilityRef",
59
+ "CapabilitySpec",
60
+ "CapabilityStatus",
61
+ "CapabilityResult",
62
+ "CapabilityManifestEntry",
63
+ "CapabilityDescriptor",
64
+ "CapabilityVisibility",
65
+ "HostRunStatus",
66
+ "ApprovalTicket",
67
+ "ResumeIntent",
68
+ "HostRunSnapshot",
69
+ "WorkflowRunStatus",
70
+ "WorkflowStepSnapshot",
71
+ "WorkflowRunSnapshot",
72
+ "WorkflowReplayRequest",
73
+ "RuntimeSession",
74
+ "RuntimeServiceRequest",
75
+ "RuntimeServiceHandle",
76
+ "RuntimeServiceFacade",
77
+ "AgentSpec",
78
+ "AgentIOSchema",
79
+ "WorkflowSpec",
80
+ "Step",
81
+ "LoopStep",
82
+ "ParallelStep",
83
+ "ConditionalStep",
84
+ "InputMapping",
85
+ "ExecutionContext",
86
+ "RuntimeServices",
87
+ # Errors
88
+ "RuntimeFrameworkError",
89
+ "CapabilityNotFoundError",
90
+ ]
@@ -0,0 +1,13 @@
1
+ """Adapters:桥接上游与能力组织层。"""
2
+ from __future__ import annotations
3
+
4
+ # 已有桥接适配器(不修改)
5
+ # from .agently_backend import AgentlyChatBackend
6
+ # from .triggerflow_tool import ...
7
+
8
+ # 新增能力适配器
9
+ from .agent_adapter import AgentAdapter
10
+
11
+ __all__ = [
12
+ "AgentAdapter",
13
+ ]