deeptwin 0.0.1__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.
- deeptwin-0.0.1/.gitignore +26 -0
- deeptwin-0.0.1/LICENSE +202 -0
- deeptwin-0.0.1/PKG-INFO +93 -0
- deeptwin-0.0.1/README.md +72 -0
- deeptwin-0.0.1/pyproject.toml +98 -0
- deeptwin-0.0.1/src/deeptwin/__init__.py +34 -0
- deeptwin-0.0.1/src/deeptwin/cli/__init__.py +1 -0
- deeptwin-0.0.1/src/deeptwin/cli/main.py +151 -0
- deeptwin-0.0.1/src/deeptwin/cli/output.py +54 -0
- deeptwin-0.0.1/src/deeptwin/compose.py +83 -0
- deeptwin-0.0.1/src/deeptwin/errors.py +55 -0
- deeptwin-0.0.1/src/deeptwin/llm/__init__.py +6 -0
- deeptwin-0.0.1/src/deeptwin/llm/base.py +21 -0
- deeptwin-0.0.1/src/deeptwin/llm/fake.py +35 -0
- deeptwin-0.0.1/src/deeptwin/models.py +110 -0
- deeptwin-0.0.1/src/deeptwin/py.typed +0 -0
- deeptwin-0.0.1/src/deeptwin/runs.py +50 -0
- deeptwin-0.0.1/src/deeptwin/store/__init__.py +1 -0
- deeptwin-0.0.1/src/deeptwin/store/files.py +56 -0
- deeptwin-0.0.1/src/deeptwin/store/project.py +168 -0
- deeptwin-0.0.1/tests/conftest.py +23 -0
- deeptwin-0.0.1/tests/fixtures/minimal/.deeptwin/layers/principles.yaml +9 -0
- deeptwin-0.0.1/tests/fixtures/minimal/.deeptwin/tasks/train/task-0001.yaml +11 -0
- deeptwin-0.0.1/tests/fixtures/minimal/answer.txt +9 -0
- deeptwin-0.0.1/tests/fixtures/minimal/skills/minimal/SKILL.md +23 -0
- deeptwin-0.0.1/tests/fixtures/minimal/skills/minimal/skill.yaml +16 -0
- deeptwin-0.0.1/tests/test_cli.py +313 -0
- deeptwin-0.0.1/tests/test_compose.py +199 -0
- deeptwin-0.0.1/tests/test_init.py +211 -0
- deeptwin-0.0.1/tests/test_provider.py +43 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.deeptwin/
|
|
2
|
+
data-raw/
|
|
3
|
+
|
|
4
|
+
# 공개 저장소에는 코드만 올린다 (2026-11-21 결정)
|
|
5
|
+
_bmad/
|
|
6
|
+
_bmad-output/
|
|
7
|
+
.claude/
|
|
8
|
+
skills-lock.json
|
|
9
|
+
deeptwin_design_v0.1.md
|
|
10
|
+
.DS_Store
|
|
11
|
+
|
|
12
|
+
# 테스트 fixture의 가상 데이터는 올린다
|
|
13
|
+
!tests/fixtures/minimal/.deeptwin/
|
|
14
|
+
|
|
15
|
+
# Python
|
|
16
|
+
__pycache__/
|
|
17
|
+
*.py[cod]
|
|
18
|
+
.venv/
|
|
19
|
+
build/
|
|
20
|
+
dist/
|
|
21
|
+
*.egg-info/
|
|
22
|
+
.pytest_cache/
|
|
23
|
+
.mypy_cache/
|
|
24
|
+
.ruff_cache/
|
|
25
|
+
.coverage
|
|
26
|
+
htmlcov/
|
deeptwin-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
deeptwin-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: deeptwin
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 개인의 판단 기준을 층별 파일로 쌓고, 모델 없이 조립해 스킬의 유동 영역에 넣는 라이브러리
|
|
5
|
+
Project-URL: Repository, https://github.com/soonseek/deeptwin
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Natural Language :: Korean
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Requires-Dist: filelock>=3.12
|
|
17
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
18
|
+
Requires-Dist: pyyaml>=6.0
|
|
19
|
+
Requires-Dist: typer>=0.15
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# deeptwin
|
|
23
|
+
|
|
24
|
+
개인의 판단 기준을 층별 파일로 쌓고, 작업마다 맞는 기준만 모델 없이 조립해 스킬의 유동 영역에 넣는 Python 라이브러리입니다.
|
|
25
|
+
|
|
26
|
+
> 아직 초기 단계입니다(0.0.1). 지금은 원칙 하나를 조립해 스킬을 한 번 돌리는 가장 얇은 길만 있습니다. 함수 서명과 명령은 0.x 동안 바뀔 수 있습니다.
|
|
27
|
+
|
|
28
|
+
## 설치
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install deeptwin
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Python 3.11 이상이 필요합니다.
|
|
35
|
+
|
|
36
|
+
## 쓰는 법
|
|
37
|
+
|
|
38
|
+
프로젝트 폴더에서 개인 데이터 폴더를 만듭니다. `.deeptwin/`이 생기고 `.gitignore`에 `.deeptwin/` 줄이 더해집니다.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
deeptwin init
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
스킬을 과제 하나로 돌립니다. 조립한 지침을 넣은 `SKILL.md` 사본과 결과물은 `.deeptwin/runs/<실행 ID>/`에 남고, 원본 `SKILL.md`는 바뀌지 않습니다. 실행은 원장(`.deeptwin/ledger.jsonl`)에 한 줄로 남습니다.
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
deeptwin run <스킬 ID> <과제 ID> --provider fake --fake-answer answer.txt
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`--provider fake`는 테스트와 예제 확인용입니다. 미리 적어 둔 답 파일을 결과물로 돌려줍니다. 실제 모델을 부르는 공급자는 아직 없습니다.
|
|
51
|
+
|
|
52
|
+
모든 명령은 `--json`을 받습니다. 켜면 stdout에 JSON 객체 하나만 씁니다. 성공하면 종료 코드 0, deeptwin이 알려 주는 오류면 1입니다. 인자가 틀리면 Click 기본 동작대로 종료 코드 2와 글로 된 안내를 내고, JSON은 쓰지 않습니다.
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{"ok": false, "command": "run", "error": {"code": "not_initialized", "message": "먼저 deeptwin init을 실행하세요."}}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 폴더
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
.deeptwin/ # 개인 데이터. git에 올리지 않는다
|
|
62
|
+
layers/ # 기준의 네 층(예시, 판단 카드, 우선순위, 원칙)
|
|
63
|
+
candidates/ # 승인 전 후보
|
|
64
|
+
tasks/ # 과제(train, sealed, spare)
|
|
65
|
+
runs/ # 실행마다 SKILL.md 사본과 결과물
|
|
66
|
+
ledger.jsonl # 원장. 추가만 한다
|
|
67
|
+
skills/<스킬 ID>/
|
|
68
|
+
SKILL.md # 고정 영역과 유동 영역 표시
|
|
69
|
+
skill.yaml # 판단 지점, 맥락 축, 상한
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`SKILL.md`에는 유동 영역 자리를 한 번 표시합니다.
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
<!-- deeptwin:fluid -->
|
|
76
|
+
<!-- /deeptwin:fluid -->
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 개발
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
uv sync
|
|
83
|
+
uv run ruff check && uv run ruff format --check && uv run mypy && uv run lint-imports
|
|
84
|
+
uv run pytest
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
테스트는 네트워크와 모델 없이 돌고, 가상 인물의 데이터만 씁니다. 실제 모델을 부르는 테스트에는 `live` 표식을 달고 기본 실행에서 뺍니다.
|
|
88
|
+
|
|
89
|
+
텔레메트리는 없습니다.
|
|
90
|
+
|
|
91
|
+
## 라이선스
|
|
92
|
+
|
|
93
|
+
Apache-2.0
|
deeptwin-0.0.1/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# deeptwin
|
|
2
|
+
|
|
3
|
+
개인의 판단 기준을 층별 파일로 쌓고, 작업마다 맞는 기준만 모델 없이 조립해 스킬의 유동 영역에 넣는 Python 라이브러리입니다.
|
|
4
|
+
|
|
5
|
+
> 아직 초기 단계입니다(0.0.1). 지금은 원칙 하나를 조립해 스킬을 한 번 돌리는 가장 얇은 길만 있습니다. 함수 서명과 명령은 0.x 동안 바뀔 수 있습니다.
|
|
6
|
+
|
|
7
|
+
## 설치
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install deeptwin
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Python 3.11 이상이 필요합니다.
|
|
14
|
+
|
|
15
|
+
## 쓰는 법
|
|
16
|
+
|
|
17
|
+
프로젝트 폴더에서 개인 데이터 폴더를 만듭니다. `.deeptwin/`이 생기고 `.gitignore`에 `.deeptwin/` 줄이 더해집니다.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
deeptwin init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
스킬을 과제 하나로 돌립니다. 조립한 지침을 넣은 `SKILL.md` 사본과 결과물은 `.deeptwin/runs/<실행 ID>/`에 남고, 원본 `SKILL.md`는 바뀌지 않습니다. 실행은 원장(`.deeptwin/ledger.jsonl`)에 한 줄로 남습니다.
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
deeptwin run <스킬 ID> <과제 ID> --provider fake --fake-answer answer.txt
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`--provider fake`는 테스트와 예제 확인용입니다. 미리 적어 둔 답 파일을 결과물로 돌려줍니다. 실제 모델을 부르는 공급자는 아직 없습니다.
|
|
30
|
+
|
|
31
|
+
모든 명령은 `--json`을 받습니다. 켜면 stdout에 JSON 객체 하나만 씁니다. 성공하면 종료 코드 0, deeptwin이 알려 주는 오류면 1입니다. 인자가 틀리면 Click 기본 동작대로 종료 코드 2와 글로 된 안내를 내고, JSON은 쓰지 않습니다.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{"ok": false, "command": "run", "error": {"code": "not_initialized", "message": "먼저 deeptwin init을 실행하세요."}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 폴더
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
.deeptwin/ # 개인 데이터. git에 올리지 않는다
|
|
41
|
+
layers/ # 기준의 네 층(예시, 판단 카드, 우선순위, 원칙)
|
|
42
|
+
candidates/ # 승인 전 후보
|
|
43
|
+
tasks/ # 과제(train, sealed, spare)
|
|
44
|
+
runs/ # 실행마다 SKILL.md 사본과 결과물
|
|
45
|
+
ledger.jsonl # 원장. 추가만 한다
|
|
46
|
+
skills/<스킬 ID>/
|
|
47
|
+
SKILL.md # 고정 영역과 유동 영역 표시
|
|
48
|
+
skill.yaml # 판단 지점, 맥락 축, 상한
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`SKILL.md`에는 유동 영역 자리를 한 번 표시합니다.
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
<!-- deeptwin:fluid -->
|
|
55
|
+
<!-- /deeptwin:fluid -->
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 개발
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
uv sync
|
|
62
|
+
uv run ruff check && uv run ruff format --check && uv run mypy && uv run lint-imports
|
|
63
|
+
uv run pytest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
테스트는 네트워크와 모델 없이 돌고, 가상 인물의 데이터만 씁니다. 실제 모델을 부르는 테스트에는 `live` 표식을 달고 기본 실행에서 뺍니다.
|
|
67
|
+
|
|
68
|
+
텔레메트리는 없습니다.
|
|
69
|
+
|
|
70
|
+
## 라이선스
|
|
71
|
+
|
|
72
|
+
Apache-2.0
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "deeptwin"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "개인의 판단 기준을 층별 파일로 쌓고, 모델 없이 조립해 스킬의 유동 영역에 넣는 라이브러리"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"pydantic>=2.7,<3",
|
|
15
|
+
"pyyaml>=6.0",
|
|
16
|
+
"filelock>=3.12",
|
|
17
|
+
"typer>=0.15",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Natural Language :: Korean",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Repository = "https://github.com/soonseek/deeptwin"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
deeptwin = "deeptwin.cli.main:app"
|
|
34
|
+
|
|
35
|
+
[dependency-groups]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=8",
|
|
38
|
+
"ruff>=0.8",
|
|
39
|
+
"mypy>=1.13",
|
|
40
|
+
"import-linter>=2.1",
|
|
41
|
+
"types-PyYAML",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/deeptwin"]
|
|
46
|
+
|
|
47
|
+
[tool.hatch.build.targets.sdist]
|
|
48
|
+
include = [
|
|
49
|
+
"src/deeptwin",
|
|
50
|
+
"tests",
|
|
51
|
+
"README.md",
|
|
52
|
+
"LICENSE",
|
|
53
|
+
"pyproject.toml",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
testpaths = ["tests"]
|
|
58
|
+
addopts = ["-m", "not live", "--strict-markers"]
|
|
59
|
+
markers = [
|
|
60
|
+
"live: 실제 모델을 부르는 테스트. 기본 실행에서 빠진다",
|
|
61
|
+
"acceptance: 설계서 8.11의 수용 테스트",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 100
|
|
66
|
+
target-version = "py311"
|
|
67
|
+
src = ["src", "tests"]
|
|
68
|
+
# 이 컴퓨터에만 두는 기획·BMad 폴더. git이 없어도 검사에서 뺀다
|
|
69
|
+
extend-exclude = ["_bmad", "_bmad-output", ".claude", "data-raw", "deeptwin_design_v0.1.md"]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint]
|
|
72
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM"]
|
|
73
|
+
|
|
74
|
+
[tool.mypy]
|
|
75
|
+
strict = true
|
|
76
|
+
plugins = ["pydantic.mypy"]
|
|
77
|
+
files = ["src", "tests"]
|
|
78
|
+
|
|
79
|
+
[tool.pydantic-mypy]
|
|
80
|
+
init_forbid_extra = true
|
|
81
|
+
init_typed = true
|
|
82
|
+
warn_required_dynamic_aliases = true
|
|
83
|
+
|
|
84
|
+
[tool.importlinter]
|
|
85
|
+
root_package = "deeptwin"
|
|
86
|
+
|
|
87
|
+
[[tool.importlinter.contracts]]
|
|
88
|
+
name = "조립·모델·저장은 모델 호출 계층(llm)을 import하지 않는다"
|
|
89
|
+
type = "forbidden"
|
|
90
|
+
source_modules = ["deeptwin.compose", "deeptwin.models", "deeptwin.store"]
|
|
91
|
+
forbidden_modules = ["deeptwin.llm"]
|
|
92
|
+
|
|
93
|
+
[[tool.importlinter.contracts]]
|
|
94
|
+
name = "모델(models)과 오류(errors)는 다른 deeptwin 모듈을 import하지 않는다"
|
|
95
|
+
type = "forbidden"
|
|
96
|
+
source_modules = ["deeptwin.models", "deeptwin.errors"]
|
|
97
|
+
# 와일드카드라서 뒤에 생기는 모듈도 막는다. models와 errors 서로도 금지다
|
|
98
|
+
forbidden_modules = ["deeptwin.*"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""deeptwin: 개인의 판단 기준을 층별 파일로 쌓고, 모델 없이 조립해 스킬의 유동 영역에 넣는다.
|
|
2
|
+
|
|
3
|
+
공개 API만 내보낸다.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
7
|
+
|
|
8
|
+
from deeptwin.compose import compose, fill_fluid
|
|
9
|
+
from deeptwin.errors import DeeptwinError
|
|
10
|
+
from deeptwin.llm import FakeProvider, Provider
|
|
11
|
+
from deeptwin.models import Composed, Principle, Run, Skill, Task
|
|
12
|
+
from deeptwin.runs import record_run
|
|
13
|
+
from deeptwin.store.project import DeepTwin
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
__version__ = version("deeptwin")
|
|
17
|
+
except PackageNotFoundError: # pragma: no cover - 설치하지 않고 소스에서 바로 쓸 때
|
|
18
|
+
__version__ = "0+unknown"
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"Composed",
|
|
22
|
+
"DeepTwin",
|
|
23
|
+
"DeeptwinError",
|
|
24
|
+
"FakeProvider",
|
|
25
|
+
"Principle",
|
|
26
|
+
"Provider",
|
|
27
|
+
"Run",
|
|
28
|
+
"Skill",
|
|
29
|
+
"Task",
|
|
30
|
+
"__version__",
|
|
31
|
+
"compose",
|
|
32
|
+
"fill_fluid",
|
|
33
|
+
"record_run",
|
|
34
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""명령줄(typer). `deeptwin.cli.main:app`이 `deeptwin` 명령이다."""
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""`deeptwin` 명령줄."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Annotated
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
|
|
12
|
+
from deeptwin.cli.output import Reply, respond
|
|
13
|
+
from deeptwin.compose import compose, fill_fluid
|
|
14
|
+
from deeptwin.errors import (
|
|
15
|
+
FakeAnswerRequiredError,
|
|
16
|
+
TaskSkillMismatchError,
|
|
17
|
+
UnknownProviderError,
|
|
18
|
+
)
|
|
19
|
+
from deeptwin.llm import FakeProvider, Provider
|
|
20
|
+
from deeptwin.runs import record_run, write_skill_copy
|
|
21
|
+
from deeptwin.store.project import DATA_DIR, DeepTwin
|
|
22
|
+
|
|
23
|
+
app = typer.Typer(
|
|
24
|
+
name="deeptwin",
|
|
25
|
+
help="개인의 판단 기준을 쌓아 스킬의 유동 영역에 조립하고 실행한다.",
|
|
26
|
+
no_args_is_help=True,
|
|
27
|
+
add_completion=False,
|
|
28
|
+
pretty_exceptions_show_locals=False,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
JsonOption = Annotated[
|
|
32
|
+
bool,
|
|
33
|
+
typer.Option("--json", help="결과를 JSON 객체 하나로 stdout에 쓴다. 에이전트가 읽는 용도다."),
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True)
|
|
38
|
+
class ProviderOptions:
|
|
39
|
+
"""공급자를 만들 때 명령줄에서 넘겨받는 값."""
|
|
40
|
+
|
|
41
|
+
fake_answer: Path | None = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _fake_provider(options: ProviderOptions) -> Provider:
|
|
45
|
+
if options.fake_answer is None:
|
|
46
|
+
raise FakeAnswerRequiredError("--provider fake에는 --fake-answer <파일>이 필요합니다.")
|
|
47
|
+
# 줄바꿈을 바꾸지 않고 읽는다. 결과물 output.md가 답 파일과 바이트까지 같다
|
|
48
|
+
return FakeProvider([options.fake_answer.read_bytes().decode("utf-8")])
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
PROVIDERS: dict[str, Callable[[ProviderOptions], Provider]] = {"fake": _fake_provider}
|
|
52
|
+
"""공급자 이름표. 이름 -> 공급자를 만드는 함수."""
|
|
53
|
+
|
|
54
|
+
DEFAULT_PROVIDER = "claude"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def make_provider(name: str, options: ProviderOptions) -> Provider:
|
|
58
|
+
factory = PROVIDERS.get(name)
|
|
59
|
+
if factory is None:
|
|
60
|
+
names = ", ".join(sorted(PROVIDERS))
|
|
61
|
+
raise UnknownProviderError(f"알 수 없는 공급자입니다: {name}. 쓸 수 있는 이름: {names}")
|
|
62
|
+
return factory(options)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@app.command()
|
|
66
|
+
def init(as_json: JsonOption = False) -> None:
|
|
67
|
+
"""지금 폴더에 .deeptwin/을 만들고 .gitignore에 .deeptwin/을 더한다."""
|
|
68
|
+
|
|
69
|
+
def action() -> Reply:
|
|
70
|
+
done = DeepTwin.init(Path.cwd())
|
|
71
|
+
lines = [
|
|
72
|
+
f"{DATA_DIR}/ 폴더를 준비했습니다."
|
|
73
|
+
if done.created
|
|
74
|
+
else f"{DATA_DIR}/ 폴더는 이미 준비돼 있습니다."
|
|
75
|
+
]
|
|
76
|
+
lines.append(
|
|
77
|
+
f".gitignore에 {DATA_DIR}/을 더했습니다."
|
|
78
|
+
if done.gitignore == "added"
|
|
79
|
+
else f".gitignore에는 이미 {DATA_DIR}/이 있습니다."
|
|
80
|
+
)
|
|
81
|
+
return Reply(
|
|
82
|
+
result={"created": list(done.created), "gitignore": done.gitignore},
|
|
83
|
+
text="\n".join(lines),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
respond("init", action, as_json=as_json)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@app.command()
|
|
90
|
+
def run(
|
|
91
|
+
skill_id: Annotated[
|
|
92
|
+
str, typer.Argument(metavar="SKILL", help="skills/ 아래의 스킬 ID", show_default=False)
|
|
93
|
+
],
|
|
94
|
+
task_id: Annotated[
|
|
95
|
+
str, typer.Argument(metavar="TASK", help="과제 ID(예: task-0001)", show_default=False)
|
|
96
|
+
],
|
|
97
|
+
provider: Annotated[
|
|
98
|
+
str,
|
|
99
|
+
typer.Option(
|
|
100
|
+
"--provider",
|
|
101
|
+
help="모델 공급자 이름. fake는 테스트와 예제 확인용이다.",
|
|
102
|
+
),
|
|
103
|
+
] = DEFAULT_PROVIDER,
|
|
104
|
+
fake_answer: Annotated[
|
|
105
|
+
Path | None,
|
|
106
|
+
typer.Option(
|
|
107
|
+
"--fake-answer",
|
|
108
|
+
exists=True,
|
|
109
|
+
dir_okay=False,
|
|
110
|
+
readable=True,
|
|
111
|
+
help="fake 공급자가 돌려줄 답 파일. 테스트와 예제 확인용이다.",
|
|
112
|
+
),
|
|
113
|
+
] = None,
|
|
114
|
+
as_json: JsonOption = False,
|
|
115
|
+
) -> None:
|
|
116
|
+
"""스킬을 과제 하나로 돌린다: 조립, 실행 폴더에 SKILL.md 사본 쓰기, 생성, 실행 기록."""
|
|
117
|
+
|
|
118
|
+
def action() -> Reply:
|
|
119
|
+
deeptwin = DeepTwin.open(Path.cwd())
|
|
120
|
+
llm = make_provider(provider, ProviderOptions(fake_answer=fake_answer))
|
|
121
|
+
skill = deeptwin.skill(skill_id)
|
|
122
|
+
task = deeptwin.task(task_id)
|
|
123
|
+
if task.skill != skill_id:
|
|
124
|
+
raise TaskSkillMismatchError(
|
|
125
|
+
f"과제와 스킬이 맞지 않습니다. 과제 {task.id}의 skill: {task.skill}, "
|
|
126
|
+
f"실행한 스킬: {skill_id}"
|
|
127
|
+
)
|
|
128
|
+
composed = compose(skill, task, deeptwin, context=task.context or {})
|
|
129
|
+
skill_copy = fill_fluid(skill.skill_md.read_text(encoding="utf-8"), composed.guide)
|
|
130
|
+
run_id = deeptwin.new_run()
|
|
131
|
+
write_skill_copy(deeptwin, run_id, skill_copy)
|
|
132
|
+
output = llm.complete(skill_copy, task.input)
|
|
133
|
+
record = record_run(composed, task, output, deeptwin, run_id=run_id)
|
|
134
|
+
injected = ", ".join(record.injected) or "없음"
|
|
135
|
+
return Reply(
|
|
136
|
+
result={
|
|
137
|
+
"run": record.id,
|
|
138
|
+
"guide_hash": record.guide_hash,
|
|
139
|
+
"injected": record.injected,
|
|
140
|
+
"output": record.output,
|
|
141
|
+
},
|
|
142
|
+
text="\n".join(
|
|
143
|
+
[
|
|
144
|
+
f"{record.id} 실행을 마쳤습니다.",
|
|
145
|
+
f"넣은 항목: {injected}",
|
|
146
|
+
f"결과물: {DATA_DIR}/{record.output}",
|
|
147
|
+
]
|
|
148
|
+
),
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
respond("run", action, as_json=as_json)
|