specmodule 0.1.3__tar.gz → 0.2.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.
- {specmodule-0.1.3/specmodule.egg-info → specmodule-0.2.0}/PKG-INFO +2 -2
- {specmodule-0.1.3 → specmodule-0.2.0}/llm/config.py +4 -2
- {specmodule-0.1.3 → specmodule-0.2.0}/module_harness/__init__.py +67 -35
- specmodule-0.2.0/module_harness/cli/__init__.py +19 -0
- specmodule-0.2.0/module_harness/cli/__main__.py +6 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/cli}/cli.py +1433 -1443
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/cli}/command.py +115 -115
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/cli}/entry.py +132 -130
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/cli}/loader.py +215 -215
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/cli}/scaffold.py +10 -8
- specmodule-0.2.0/module_harness/core/__init__.py +2 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/core}/builtins.py +29 -29
- specmodule-0.2.0/module_harness/core/call.py +93 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/core}/harness.py +7 -19
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/core}/prompt.py +17 -9
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/core}/registry.py +16 -9
- specmodule-0.2.0/module_harness/infra/__init__.py +2 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/infra}/checkpoint.py +3 -3
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/infra}/query.py +855 -529
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/infra}/status.py +5 -1
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/infra}/store.py +609 -485
- specmodule-0.2.0/module_harness/infra/stream.py +65 -0
- specmodule-0.2.0/module_harness/model/__init__.py +2 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/model}/module.py +551 -484
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/model}/submodule.py +276 -268
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/model}/translator.py +19 -12
- specmodule-0.2.0/module_harness/orchestrate/__init__.py +2 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/orchestrate}/align.py +5 -4
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/orchestrate}/consistency.py +32 -39
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/orchestrate}/feed.py +197 -197
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/orchestrate}/graph_builder.py +26 -31
- {specmodule-0.1.3 → specmodule-0.2.0}/pyproject.toml +13 -3
- {specmodule-0.1.3 → specmodule-0.2.0/specmodule.egg-info}/PKG-INFO +2 -2
- specmodule-0.2.0/specmodule.egg-info/SOURCES.txt +51 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/specmodule.egg-info/requires.txt +1 -1
- specmodule-0.1.3/specmodule.egg-info/SOURCES.txt +0 -43
- {specmodule-0.1.3 → specmodule-0.2.0}/LICENSE +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/README.md +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/llm/__init__.py +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/llm/client.py +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/llm/mock.py +0 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/core}/config.py +0 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/core}/outputfmt.py +0 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/infra}/control.py +0 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/infra}/events.py +0 -0
- {specmodule-0.1.3/module_harness → specmodule-0.2.0/module_harness/model}/spec.py +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/module_harness/templates/builtin/codereview.json +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/module_harness/templates/builtin/docwrite.json +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/module_harness/templates/builtin/summarize.json +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/module_harness/templates/builtin/translate.json +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/setup.cfg +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/specmodule.egg-info/dependency_links.txt +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/specmodule.egg-info/entry_points.txt +0 -0
- {specmodule-0.1.3 → specmodule-0.2.0}/specmodule.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: specmodule
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: 可审计、可调试、可完全掌控的 LLM 使用框架(tickflow + llm + module_harness)
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: llm,workflow,petri-net,agent
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: tickflow-py
|
|
18
|
+
Requires-Dist: tickflow-py<0.3,>=0.2.0
|
|
19
19
|
Provides-Extra: anthropic
|
|
20
20
|
Requires-Dist: anthropic; extra == "anthropic"
|
|
21
21
|
Provides-Extra: openai
|
|
@@ -97,7 +97,7 @@ class LLMConfig:
|
|
|
97
97
|
timeout: float = 60.0
|
|
98
98
|
max_retries: int = 3
|
|
99
99
|
|
|
100
|
-
# ── 默认模型参数(harness
|
|
100
|
+
# ── 默认模型参数(harness 未指定时兜底;model/max_tokens/temperature 来自 config.json models[0])──
|
|
101
101
|
model: str = ""
|
|
102
102
|
max_tokens: int = 4096
|
|
103
103
|
temperature: float = 0.7
|
|
@@ -168,6 +168,7 @@ class LLMConfig:
|
|
|
168
168
|
models_map: dict[str, dict[str, Any]] = {}
|
|
169
169
|
default_model = ""
|
|
170
170
|
default_temperature = 0.7
|
|
171
|
+
default_max_tokens = 4096
|
|
171
172
|
|
|
172
173
|
for m in models:
|
|
173
174
|
name = m.get("name", "")
|
|
@@ -176,6 +177,7 @@ class LLMConfig:
|
|
|
176
177
|
if not default_model:
|
|
177
178
|
default_model = name
|
|
178
179
|
default_temperature = float(m.get("temperature", 0.7))
|
|
180
|
+
default_max_tokens = int(m.get("max_tokens", 4096))
|
|
179
181
|
|
|
180
182
|
config = cls(
|
|
181
183
|
provider=p.get("sdktype", "openai"),
|
|
@@ -184,7 +186,7 @@ class LLMConfig:
|
|
|
184
186
|
timeout=float(p.get("timeout", 60.0)),
|
|
185
187
|
max_retries=int(p.get("max_retries", 3)),
|
|
186
188
|
model=overrides.pop("model", None) or default_model,
|
|
187
|
-
max_tokens=int(overrides.pop("max_tokens", None) or
|
|
189
|
+
max_tokens=int(overrides.pop("max_tokens", None) or default_max_tokens),
|
|
188
190
|
temperature=float(overrides.pop("temperature", None) or default_temperature),
|
|
189
191
|
models=models_map,
|
|
190
192
|
system_rules=system_rules,
|
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
# module_harness/__init__.py
|
|
2
2
|
"""ModuleHarness — tickflow 上层抽象:harness 与 script 执行元件。"""
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from .
|
|
6
|
-
from .
|
|
7
|
-
from .
|
|
4
|
+
# core:核心执行元件
|
|
5
|
+
from .core.config import HarnessConfig
|
|
6
|
+
from .core.outputfmt import OutputFormat, OutputValidator
|
|
7
|
+
from .core.prompt import PromptRenderer
|
|
8
|
+
from .core.harness import Harness
|
|
9
|
+
from .core.call import HarnessCallError, HarnessCallResult, call_harness
|
|
10
|
+
from .core.registry import HarnessRegistry
|
|
11
|
+
from .core.builtins import BUILTIN_HARNESS_NAMES, register_builtin_harnesses
|
|
12
|
+
# model:数据模型与模块形态
|
|
13
|
+
from .model.spec import (
|
|
14
|
+
Spec,
|
|
15
|
+
TaskDefinition,
|
|
16
|
+
Tasklist,
|
|
17
|
+
TranslationSpec,
|
|
18
|
+
TasklistTemplate,
|
|
19
|
+
)
|
|
20
|
+
from .model.spec import SpecSchema
|
|
21
|
+
from .model.translator import TasklistValidator, TemplateLoader, Translator
|
|
22
|
+
from .model.module import Module
|
|
23
|
+
from .model.submodule import SubModule, SpecValidationError, script
|
|
24
|
+
# orchestrate:图编排
|
|
25
|
+
from .orchestrate.consistency import (
|
|
26
|
+
ConsistencyError,
|
|
27
|
+
ConsistencyReport,
|
|
28
|
+
ConsistencyReviewer,
|
|
29
|
+
REVIEW_HARNESS_CONFIG,
|
|
30
|
+
register_review_harness,
|
|
31
|
+
)
|
|
32
|
+
from .orchestrate.align import ALIGN_CHECK_CONFIG, register_align_check_harness
|
|
33
|
+
from .orchestrate.graph_builder import TasklistTranslator
|
|
34
|
+
# infra:运行基础设施
|
|
35
|
+
from .infra.events import (
|
|
8
36
|
EventBus,
|
|
9
37
|
HarnessEvent,
|
|
10
38
|
PromptRendered,
|
|
@@ -22,34 +50,8 @@ from .events import (
|
|
|
22
50
|
CommandCompleted,
|
|
23
51
|
CommandFailed,
|
|
24
52
|
)
|
|
25
|
-
from .
|
|
26
|
-
from .
|
|
27
|
-
from .registry import HarnessRegistry
|
|
28
|
-
from .spec import (
|
|
29
|
-
Spec,
|
|
30
|
-
TaskDefinition,
|
|
31
|
-
Tasklist,
|
|
32
|
-
TranslationSpec,
|
|
33
|
-
TasklistTemplate,
|
|
34
|
-
)
|
|
35
|
-
from .consistency import (
|
|
36
|
-
ConsistencyError,
|
|
37
|
-
ConsistencyReport,
|
|
38
|
-
ConsistencyReviewer,
|
|
39
|
-
REVIEW_HARNESS_CONFIG,
|
|
40
|
-
register_review_harness,
|
|
41
|
-
)
|
|
42
|
-
from .align import ALIGN_CHECK_CONFIG, register_align_check_harness
|
|
43
|
-
from .builtins import BUILTIN_HARNESS_NAMES, register_builtin_harnesses
|
|
44
|
-
from .translator import TasklistValidator, TemplateLoader, Translator
|
|
45
|
-
from .graph_builder import TasklistTranslator
|
|
46
|
-
from .module import Module
|
|
47
|
-
from .submodule import SubModule, SpecValidationError, script
|
|
48
|
-
from .loader import ModuleLoader, ModuleManifestError, ModuleRequirementError
|
|
49
|
-
from .spec import SpecSchema
|
|
50
|
-
from .status import ModuleStatus, query_run_status
|
|
51
|
-
from .entry import ModuleEntry, discover_modules
|
|
52
|
-
from .query import (
|
|
53
|
+
from .infra.status import ModuleStatus, query_run_status
|
|
54
|
+
from .infra.query import (
|
|
53
55
|
CheckpointEntry,
|
|
54
56
|
CheckpointList,
|
|
55
57
|
QueryValueResult,
|
|
@@ -57,29 +59,33 @@ from .query import (
|
|
|
57
59
|
ReviewTimeline,
|
|
58
60
|
build_checkpoints,
|
|
59
61
|
build_timeline,
|
|
62
|
+
check_resume_compat_from_run,
|
|
60
63
|
checkpoints_to_dict,
|
|
61
64
|
create_checkpoint,
|
|
65
|
+
delete_run,
|
|
62
66
|
filter_failed,
|
|
63
67
|
filter_node,
|
|
64
68
|
filter_tick,
|
|
69
|
+
list_runs,
|
|
65
70
|
load_snapshot_summary,
|
|
66
71
|
query_value,
|
|
67
72
|
run_db_path,
|
|
68
73
|
timeline_to_dict,
|
|
69
74
|
)
|
|
70
|
-
from .checkpoint import (
|
|
75
|
+
from .infra.checkpoint import (
|
|
71
76
|
ModuleInputStore,
|
|
72
77
|
ResumeCheck,
|
|
73
78
|
ResumeError,
|
|
74
79
|
check_resume_compat,
|
|
75
80
|
)
|
|
76
|
-
from . import
|
|
77
|
-
from .store import (
|
|
81
|
+
from .infra.store import (
|
|
78
82
|
ENTRY_POINT_GROUP,
|
|
79
83
|
ModuleSource,
|
|
84
|
+
ResolvedModule,
|
|
80
85
|
apply_update,
|
|
81
86
|
cache_dir,
|
|
82
87
|
check_updates,
|
|
88
|
+
detail_to_dict,
|
|
83
89
|
file_sha256,
|
|
84
90
|
install_pack,
|
|
85
91
|
list_modules,
|
|
@@ -89,12 +95,27 @@ from .store import (
|
|
|
89
95
|
parse_dotenv,
|
|
90
96
|
pip_entry_point_dirs,
|
|
91
97
|
resolve_module,
|
|
98
|
+
resolve_module_full,
|
|
92
99
|
search_paths,
|
|
93
100
|
store_home,
|
|
94
101
|
uninstall_pack,
|
|
95
102
|
validate_pack_dir,
|
|
96
103
|
)
|
|
104
|
+
# cli 层(CLI 实现,非库面)
|
|
105
|
+
from .cli.command import Command, CommandConfig
|
|
106
|
+
from .cli.entry import ModuleEntry, discover_modules
|
|
107
|
+
from .cli.loader import ModuleLoader, ModuleManifestError, ModuleRequirementError
|
|
108
|
+
|
|
109
|
+
# 模块对象绑定(`from module_harness import store / submodule / query` 可用;
|
|
110
|
+
# query 共享层是 embedding.md 明示的顶层导出面)
|
|
111
|
+
from .infra import store
|
|
112
|
+
from .infra import query
|
|
113
|
+
from .model import submodule
|
|
97
114
|
|
|
115
|
+
# 嵌入者最小面(用法见 docs/guides/embedding.md):
|
|
116
|
+
# task 级 = call_harness / HarnessCallResult / HarnessCallError
|
|
117
|
+
# 图级 = Module / HarnessRegistry + HarnessConfig / OutputFormat / EventBus
|
|
118
|
+
# + TemplateLoader + register_builtin_harnesses
|
|
98
119
|
__all__ = [
|
|
99
120
|
# 配置
|
|
100
121
|
"HarnessConfig",
|
|
@@ -118,6 +139,10 @@ __all__ = [
|
|
|
118
139
|
"ScriptFailed",
|
|
119
140
|
# 核心
|
|
120
141
|
"Harness",
|
|
142
|
+
# task 级 API 地板(嵌入者消费面,docs/dev/superpowers/specs/2026-09-01-embedder-face-design.md)
|
|
143
|
+
"HarnessCallResult",
|
|
144
|
+
"HarnessCallError",
|
|
145
|
+
"call_harness",
|
|
121
146
|
"HarnessRegistry",
|
|
122
147
|
"Command",
|
|
123
148
|
"CommandConfig",
|
|
@@ -168,6 +193,7 @@ __all__ = [
|
|
|
168
193
|
"ResumeCheck",
|
|
169
194
|
"ResumeError",
|
|
170
195
|
"check_resume_compat",
|
|
196
|
+
"check_resume_compat_from_run",
|
|
171
197
|
# 模块入口(roadmap Phase 0:CLI 使用)
|
|
172
198
|
"ModuleEntry",
|
|
173
199
|
"discover_modules",
|
|
@@ -189,11 +215,17 @@ __all__ = [
|
|
|
189
215
|
"checkpoints_to_dict",
|
|
190
216
|
"create_checkpoint",
|
|
191
217
|
"load_snapshot_summary",
|
|
218
|
+
# 共享查询层(run 历史枚举与删除)
|
|
219
|
+
"list_runs",
|
|
220
|
+
"delete_run",
|
|
192
221
|
# store 共享层(module-user-store:家目录/枚举/安装管理)
|
|
193
222
|
"store_home",
|
|
194
223
|
"search_paths",
|
|
195
224
|
"list_modules",
|
|
196
225
|
"resolve_module",
|
|
226
|
+
"resolve_module_full",
|
|
227
|
+
"ResolvedModule",
|
|
228
|
+
"detail_to_dict",
|
|
197
229
|
"ModuleSource",
|
|
198
230
|
"ENTRY_POINT_GROUP",
|
|
199
231
|
"pip_entry_point_dirs",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# module_harness/cli
|
|
2
|
+
"""CLI 层:命令行入口、模块发现/装载、脚手架、command 节点。
|
|
3
|
+
|
|
4
|
+
``main`` 惰性再导出(PEP 562):core.registry import 本包的 command 节点时,
|
|
5
|
+
不得经包 __init__ 急切拉入 cli.cli 的重 import 链(会与
|
|
6
|
+
infra.checkpoint → orchestrate.graph_builder → core.registry 成环)。
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
__all__ = ["main"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def __getattr__(name: str) -> Any:
|
|
15
|
+
if name == "main":
|
|
16
|
+
from module_harness.cli.cli import main
|
|
17
|
+
|
|
18
|
+
return main
|
|
19
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|