fyos-plugin-vorlage 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.
- fyos_plugin_vorlage-0.1.0/LICENSE +202 -0
- fyos_plugin_vorlage-0.1.0/NOTICE +4 -0
- fyos_plugin_vorlage-0.1.0/PKG-INFO +117 -0
- fyos_plugin_vorlage-0.1.0/README.md +101 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage/__init__.py +18 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage/bilder/vorlage-1.svg +33 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage/fyos-katalog.yaml +44 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage/plugin.py +220 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage/skills/vorlage/SKILL.md +35 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage/ui/vorlage.html +104 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage.egg-info/PKG-INFO +117 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage.egg-info/SOURCES.txt +18 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage.egg-info/dependency_links.txt +1 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage.egg-info/entry_points.txt +8 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage.egg-info/requires.txt +5 -0
- fyos_plugin_vorlage-0.1.0/fyos_plugin_vorlage.egg-info/top_level.txt +1 -0
- fyos_plugin_vorlage-0.1.0/pyproject.toml +39 -0
- fyos_plugin_vorlage-0.1.0/setup.cfg +4 -0
- fyos_plugin_vorlage-0.1.0/tests/test_paket.py +154 -0
- fyos_plugin_vorlage-0.1.0/tests/test_plugin.py +245 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fyos-plugin-vorlage
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Muster für ein FYOS-Hub-Plugin: Werkzeuge vorlage.*, eine kleine App (ui://), ein Skill und ein Katalogeintrag
|
|
5
|
+
Author: sirfyyn and FYOS CONTRIBUTORS
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Requires-Dist: fyos-hub
|
|
12
|
+
Provides-Extra: test
|
|
13
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
14
|
+
Requires-Dist: pyyaml>=6; extra == "test"
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
English: [README.en.md](README.en.md)
|
|
18
|
+
|
|
19
|
+
# fyos-plugin-vorlage
|
|
20
|
+
|
|
21
|
+
Ein vollständiges, lauffähiges Muster für ein Plugin von **FYOS — For Your Own Sake**. Es folgt Schritt für Schritt
|
|
22
|
+
der Anleitung [`docs/ERWEITERN.md`](https://git.example.com/fyos/fyos-os/src/branch/main/docs/ERWEITERN.md) in
|
|
23
|
+
`fyos-os`. Kopiere das Repo, benenne es um, ersetze die Werkzeuge durch deine.
|
|
24
|
+
|
|
25
|
+
## Was drin ist
|
|
26
|
+
|
|
27
|
+
| Pfad | Zweck |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `fyos_plugin_vorlage/plugin.py` | `VorlagePlugin`: Werkzeuge `vorlage.hallo` (lesend) und `vorlage.notiz_setzen` (schreibend, mit Trockenlauf; ein echter Lauf braucht `bestaetigt: true`), Konfiguration, Geheimnis, Fehlerarten, Oberfläche anmelden |
|
|
30
|
+
| `fyos_plugin_vorlage/ui/vorlage.html` | die App (`ui://vorlage/vorlage.html`) mit der gemeinsamen Brücke des Hubs: Frische-Stempel am Panel („Stand vor 2 Min.“, nach 5 Minuten „veraltet“) und „Speichern“ als Anfrage (Plan zeigen, Rückfrage, erst nach „Ja“ schreiben) |
|
|
31
|
+
| `fyos_plugin_vorlage/fyos-katalog.yaml`, `bilder/` | Katalogeintrag für den Installer mit Skizze und »Was daraus wird« |
|
|
32
|
+
| `fyos_plugin_vorlage/skills/vorlage/SKILL.md` | Wissen für den Agenten (wann welches Werkzeug, Fallen); reist im Paket mit |
|
|
33
|
+
| `pyproject.toml` | Paket, Entry-Points `mcp_hub.plugins` (Hub), `fyos.katalog` (Installer) und `fyos.skills` (Skills) |
|
|
34
|
+
| `Dockerfile` | Hub-Bild mit diesem Plugin; installiert mit uv, ein eigener Paketindex steht per `FYOS_INDEX_URL` vor PyPI |
|
|
35
|
+
| `hub-config.beispiel.yaml` | Eintrag in der Hub-Konfiguration: `config:` und `secrets:` |
|
|
36
|
+
| `begleiter/hallo_per_rest.py` | Begleitskript: Werkzeug von außen über `/hub/call` aufrufen (`--notiz` zeigt den Plan, erst `--ja` speichert) |
|
|
37
|
+
| `tests/` | pytest gegen den echten Hub-Kern, dazu ein Test, der die Vorlage umbenennt und die Kopie testet |
|
|
38
|
+
| `tools/sauber.py`, `.sauber/` | Sauberkeits-Prüfung (keine privaten Adressen, Konten, Geheimnisse im Repo) |
|
|
39
|
+
| `.gitea/workflows/ci.yml` | CI: Sauberkeit, dann Tests (Pakete mit uv, Paketindex vor PyPI) |
|
|
40
|
+
| `.github/workflows/` | dasselbe auf GitHub: `tests.yml` (Tests und Geheimnis-Scan), `pypi.yml` (veröffentlicht das Paket auf einen Tag `v*` per Trusted Publishing) |
|
|
41
|
+
| `umbenennen.py` | benennt Paket, Plugin und Werkzeuge in einem Schritt um |
|
|
42
|
+
| `LICENSE`, `NOTICE` | Apache License 2.0 und Urheberhinweis; für ein abgeleitetes Plugin anpassen (siehe [Lizenz](#lizenz)) |
|
|
43
|
+
| `README.en.md` | englische Fassung dieser Datei |
|
|
44
|
+
|
|
45
|
+
## Ausprobieren
|
|
46
|
+
|
|
47
|
+
Installiert wird mit [uv](https://docs.astral.sh/uv/) statt mit pip; der Grund steht im Abschnitt
|
|
48
|
+
[Pakete mit uv, der eigene Index zuerst](#pakete-mit-uv-der-eigene-index-zuerst).
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
uv venv && . .venv/bin/activate
|
|
52
|
+
uv pip install -e /pfad/zu/fyos-os/hub # der Hub (Paket fyos-hub)
|
|
53
|
+
uv pip install -e ".[test]"
|
|
54
|
+
python3 -m pytest -q
|
|
55
|
+
python3 -m mcp_hub.server # Hub auf Port 8080; die Vorlage lädt über den Entry-Point
|
|
56
|
+
curl -s localhost:8080/hub/call -H 'Content-Type: application/json' \
|
|
57
|
+
-d '{"tool":"vorlage.hallo","arguments":{"name":"Alex"}}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Die App öffnet sich in der Shell unter `/os?offen=app:vorlage__hallo`.
|
|
61
|
+
|
|
62
|
+
Schreiben geht in zwei Schritten, als Anfrage statt als Aktion (`docs/ERWEITERN.md` im Repo `fyos-os`, Abschnitt 3.6):
|
|
63
|
+
erst der Plan, dann die Bestätigung. Die App macht das mit „Speichern“ von selbst, von außen sieht es so aus:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
curl -s localhost:8080/hub/call -H 'Content-Type: application/json' \
|
|
67
|
+
-d '{"tool":"vorlage.notiz_setzen","arguments":{"text":"Milch kaufen","__dry_run__":true}}' # nur der Plan
|
|
68
|
+
curl -s localhost:8080/hub/call -H 'Content-Type: application/json' \
|
|
69
|
+
-d '{"tool":"vorlage.notiz_setzen","arguments":{"text":"Milch kaufen","bestaetigt":true}}' # speichert wirklich
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Umbenennen in 5 Schritten
|
|
73
|
+
|
|
74
|
+
1. **Kopieren:** Repo kopieren oder als Vorlage nutzen, in `fyos-plugin-<name>` umbenennen (der Installer erkennt
|
|
75
|
+
Plugin-Pakete am Präfix `fyos-plugin-`).
|
|
76
|
+
2. **Umbenennen:** `python3 umbenennen.py wetter` (Probe zuerst mit `--trocken`). Das Skript ersetzt Paket
|
|
77
|
+
(`fyos_plugin_wetter`), Plugin-Name und Werkzeug-IDs (`wetter.hallo`), Klasse (`WetterPlugin`), Umgebungsvariablen
|
|
78
|
+
(`FYOS_WETTER_…`), Ordner `skills/wetter`, `ui/wetter.html`, `bilder/wetter-1.svg` und die Einträge in `pyproject.toml`.
|
|
79
|
+
3. **Installieren und prüfen:** `uv pip install -e ".[test]" && python3 -m pytest -q`.
|
|
80
|
+
4. **Werkzeuge ersetzen:** in `plugin.py` `describe_tools` und `call` an dein Vorhaben anpassen, die App in
|
|
81
|
+
`ui/<name>.html`, den Skill in `fyos_plugin_<name>/skills/<name>/SKILL.md`, den Katalogeintrag in `fyos-katalog.yaml`. Tests mitziehen.
|
|
82
|
+
5. **Ausliefern:** `python3 tools/sauber.py .` muss still sein, dann committen. Das Hub-Bild mit
|
|
83
|
+
`docker build --build-arg HUB_BILD=<registry>/fyos-os/hub:main -t mein-hub:main .` bauen (braucht das Paket Pakete
|
|
84
|
+
aus einem eigenen Index, kommt `--build-arg FYOS_INDEX_URL=<Index-URL>` dazu) oder das Paket über den
|
|
85
|
+
Installer wählen (siehe ERWEITERN.md, Abschnitt 10).
|
|
86
|
+
|
|
87
|
+
Danach `umbenennen.py` löschen oder behalten, wie du magst; die Tests, die die Umbenennung prüfen
|
|
88
|
+
(`tests/test_paket.py`, Gruppe »Umbenennen«), lassen sich mit ihm entfernen.
|
|
89
|
+
|
|
90
|
+
## Pakete mit uv, der eigene Index zuerst
|
|
91
|
+
|
|
92
|
+
Dockerfile und CI installieren mit [uv](https://docs.astral.sh/uv/) statt mit pip. Ein eigener Paketindex (zum Beispiel
|
|
93
|
+
die PyPI-Registry deines Git-Servers) steht per `--index` vor PyPI: im Dockerfile als Bau-Argument `FYOS_INDEX_URL`, in der
|
|
94
|
+
CI als Repo-Variable `FYOS_PIP_INDEX`. Dazu steht `--index-strategy first-index` ausdrücklich im Befehl: uv nimmt ein Paket
|
|
95
|
+
nur aus dem ersten Index, der es führt. Ein Paket gleichen Namens auf PyPI kann ein Paket aus deinem Index so nicht
|
|
96
|
+
verdrängen (Dependency Confusion); mit `pip --extra-index-url` wäre das möglich, weil pip die höchste Version aus allen
|
|
97
|
+
Indizes nimmt. Die Version von uv ist im Dockerfile und in der CI fest. Mehr dazu in `docs/ERWEITERN.md` im Repo
|
|
98
|
+
`fyos-os`, Abschnitt 10.3.
|
|
99
|
+
|
|
100
|
+
## Was nicht ins Repo gehört
|
|
101
|
+
|
|
102
|
+
Tokens, Passwörter, Schlüssel, `.env`-Dateien, echte Adressen deiner Geräte, Namen von Personen. Geheimnisse stehen in
|
|
103
|
+
der Umgebung des Hubs oder unter `/run/secrets/`, im Repo nur ihr Name. `tools/sauber.py` fängt die gröbsten Fehler ab.
|
|
104
|
+
Ein Plugin-Repo mit persönlicher Konfiguration bleibt privat.
|
|
105
|
+
|
|
106
|
+
## Lizenz
|
|
107
|
+
|
|
108
|
+
FYOS Plugin-Vorlage steht unter der Apache License, Version 2.0 (SPDX-Kennung `Apache-2.0`).
|
|
109
|
+
|
|
110
|
+
Copyright 2026 sirfyyn and FYOS CONTRIBUTORS <!-- sauber: ok -->
|
|
111
|
+
|
|
112
|
+
Der vollständige Lizenztext steht in [`LICENSE`](LICENSE), der Urheberhinweis in [`NOTICE`](NOTICE).
|
|
113
|
+
|
|
114
|
+
Für ein eigenes Plugin auf Grundlage dieses Musters: Die Lizenz deines Plugins wählst du selbst. Was du vom Muster
|
|
115
|
+
übernimmst, bleibt unter Apache-2.0; behalte dafür `LICENSE` und die Urheberzeile in `NOTICE` bei und ergänze deine eigene.
|
|
116
|
+
Trage deine Lizenz und deine Urheberzeile außerdem in `pyproject.toml` (`license`, `authors`) und in `NOTICE` ein;
|
|
117
|
+
`umbenennen.py` ändert sie nicht.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
English: [README.en.md](README.en.md)
|
|
2
|
+
|
|
3
|
+
# fyos-plugin-vorlage
|
|
4
|
+
|
|
5
|
+
Ein vollständiges, lauffähiges Muster für ein Plugin von **FYOS — For Your Own Sake**. Es folgt Schritt für Schritt
|
|
6
|
+
der Anleitung [`docs/ERWEITERN.md`](https://git.example.com/fyos/fyos-os/src/branch/main/docs/ERWEITERN.md) in
|
|
7
|
+
`fyos-os`. Kopiere das Repo, benenne es um, ersetze die Werkzeuge durch deine.
|
|
8
|
+
|
|
9
|
+
## Was drin ist
|
|
10
|
+
|
|
11
|
+
| Pfad | Zweck |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `fyos_plugin_vorlage/plugin.py` | `VorlagePlugin`: Werkzeuge `vorlage.hallo` (lesend) und `vorlage.notiz_setzen` (schreibend, mit Trockenlauf; ein echter Lauf braucht `bestaetigt: true`), Konfiguration, Geheimnis, Fehlerarten, Oberfläche anmelden |
|
|
14
|
+
| `fyos_plugin_vorlage/ui/vorlage.html` | die App (`ui://vorlage/vorlage.html`) mit der gemeinsamen Brücke des Hubs: Frische-Stempel am Panel („Stand vor 2 Min.“, nach 5 Minuten „veraltet“) und „Speichern“ als Anfrage (Plan zeigen, Rückfrage, erst nach „Ja“ schreiben) |
|
|
15
|
+
| `fyos_plugin_vorlage/fyos-katalog.yaml`, `bilder/` | Katalogeintrag für den Installer mit Skizze und »Was daraus wird« |
|
|
16
|
+
| `fyos_plugin_vorlage/skills/vorlage/SKILL.md` | Wissen für den Agenten (wann welches Werkzeug, Fallen); reist im Paket mit |
|
|
17
|
+
| `pyproject.toml` | Paket, Entry-Points `mcp_hub.plugins` (Hub), `fyos.katalog` (Installer) und `fyos.skills` (Skills) |
|
|
18
|
+
| `Dockerfile` | Hub-Bild mit diesem Plugin; installiert mit uv, ein eigener Paketindex steht per `FYOS_INDEX_URL` vor PyPI |
|
|
19
|
+
| `hub-config.beispiel.yaml` | Eintrag in der Hub-Konfiguration: `config:` und `secrets:` |
|
|
20
|
+
| `begleiter/hallo_per_rest.py` | Begleitskript: Werkzeug von außen über `/hub/call` aufrufen (`--notiz` zeigt den Plan, erst `--ja` speichert) |
|
|
21
|
+
| `tests/` | pytest gegen den echten Hub-Kern, dazu ein Test, der die Vorlage umbenennt und die Kopie testet |
|
|
22
|
+
| `tools/sauber.py`, `.sauber/` | Sauberkeits-Prüfung (keine privaten Adressen, Konten, Geheimnisse im Repo) |
|
|
23
|
+
| `.gitea/workflows/ci.yml` | CI: Sauberkeit, dann Tests (Pakete mit uv, Paketindex vor PyPI) |
|
|
24
|
+
| `.github/workflows/` | dasselbe auf GitHub: `tests.yml` (Tests und Geheimnis-Scan), `pypi.yml` (veröffentlicht das Paket auf einen Tag `v*` per Trusted Publishing) |
|
|
25
|
+
| `umbenennen.py` | benennt Paket, Plugin und Werkzeuge in einem Schritt um |
|
|
26
|
+
| `LICENSE`, `NOTICE` | Apache License 2.0 und Urheberhinweis; für ein abgeleitetes Plugin anpassen (siehe [Lizenz](#lizenz)) |
|
|
27
|
+
| `README.en.md` | englische Fassung dieser Datei |
|
|
28
|
+
|
|
29
|
+
## Ausprobieren
|
|
30
|
+
|
|
31
|
+
Installiert wird mit [uv](https://docs.astral.sh/uv/) statt mit pip; der Grund steht im Abschnitt
|
|
32
|
+
[Pakete mit uv, der eigene Index zuerst](#pakete-mit-uv-der-eigene-index-zuerst).
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
uv venv && . .venv/bin/activate
|
|
36
|
+
uv pip install -e /pfad/zu/fyos-os/hub # der Hub (Paket fyos-hub)
|
|
37
|
+
uv pip install -e ".[test]"
|
|
38
|
+
python3 -m pytest -q
|
|
39
|
+
python3 -m mcp_hub.server # Hub auf Port 8080; die Vorlage lädt über den Entry-Point
|
|
40
|
+
curl -s localhost:8080/hub/call -H 'Content-Type: application/json' \
|
|
41
|
+
-d '{"tool":"vorlage.hallo","arguments":{"name":"Alex"}}'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Die App öffnet sich in der Shell unter `/os?offen=app:vorlage__hallo`.
|
|
45
|
+
|
|
46
|
+
Schreiben geht in zwei Schritten, als Anfrage statt als Aktion (`docs/ERWEITERN.md` im Repo `fyos-os`, Abschnitt 3.6):
|
|
47
|
+
erst der Plan, dann die Bestätigung. Die App macht das mit „Speichern“ von selbst, von außen sieht es so aus:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
curl -s localhost:8080/hub/call -H 'Content-Type: application/json' \
|
|
51
|
+
-d '{"tool":"vorlage.notiz_setzen","arguments":{"text":"Milch kaufen","__dry_run__":true}}' # nur der Plan
|
|
52
|
+
curl -s localhost:8080/hub/call -H 'Content-Type: application/json' \
|
|
53
|
+
-d '{"tool":"vorlage.notiz_setzen","arguments":{"text":"Milch kaufen","bestaetigt":true}}' # speichert wirklich
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Umbenennen in 5 Schritten
|
|
57
|
+
|
|
58
|
+
1. **Kopieren:** Repo kopieren oder als Vorlage nutzen, in `fyos-plugin-<name>` umbenennen (der Installer erkennt
|
|
59
|
+
Plugin-Pakete am Präfix `fyos-plugin-`).
|
|
60
|
+
2. **Umbenennen:** `python3 umbenennen.py wetter` (Probe zuerst mit `--trocken`). Das Skript ersetzt Paket
|
|
61
|
+
(`fyos_plugin_wetter`), Plugin-Name und Werkzeug-IDs (`wetter.hallo`), Klasse (`WetterPlugin`), Umgebungsvariablen
|
|
62
|
+
(`FYOS_WETTER_…`), Ordner `skills/wetter`, `ui/wetter.html`, `bilder/wetter-1.svg` und die Einträge in `pyproject.toml`.
|
|
63
|
+
3. **Installieren und prüfen:** `uv pip install -e ".[test]" && python3 -m pytest -q`.
|
|
64
|
+
4. **Werkzeuge ersetzen:** in `plugin.py` `describe_tools` und `call` an dein Vorhaben anpassen, die App in
|
|
65
|
+
`ui/<name>.html`, den Skill in `fyos_plugin_<name>/skills/<name>/SKILL.md`, den Katalogeintrag in `fyos-katalog.yaml`. Tests mitziehen.
|
|
66
|
+
5. **Ausliefern:** `python3 tools/sauber.py .` muss still sein, dann committen. Das Hub-Bild mit
|
|
67
|
+
`docker build --build-arg HUB_BILD=<registry>/fyos-os/hub:main -t mein-hub:main .` bauen (braucht das Paket Pakete
|
|
68
|
+
aus einem eigenen Index, kommt `--build-arg FYOS_INDEX_URL=<Index-URL>` dazu) oder das Paket über den
|
|
69
|
+
Installer wählen (siehe ERWEITERN.md, Abschnitt 10).
|
|
70
|
+
|
|
71
|
+
Danach `umbenennen.py` löschen oder behalten, wie du magst; die Tests, die die Umbenennung prüfen
|
|
72
|
+
(`tests/test_paket.py`, Gruppe »Umbenennen«), lassen sich mit ihm entfernen.
|
|
73
|
+
|
|
74
|
+
## Pakete mit uv, der eigene Index zuerst
|
|
75
|
+
|
|
76
|
+
Dockerfile und CI installieren mit [uv](https://docs.astral.sh/uv/) statt mit pip. Ein eigener Paketindex (zum Beispiel
|
|
77
|
+
die PyPI-Registry deines Git-Servers) steht per `--index` vor PyPI: im Dockerfile als Bau-Argument `FYOS_INDEX_URL`, in der
|
|
78
|
+
CI als Repo-Variable `FYOS_PIP_INDEX`. Dazu steht `--index-strategy first-index` ausdrücklich im Befehl: uv nimmt ein Paket
|
|
79
|
+
nur aus dem ersten Index, der es führt. Ein Paket gleichen Namens auf PyPI kann ein Paket aus deinem Index so nicht
|
|
80
|
+
verdrängen (Dependency Confusion); mit `pip --extra-index-url` wäre das möglich, weil pip die höchste Version aus allen
|
|
81
|
+
Indizes nimmt. Die Version von uv ist im Dockerfile und in der CI fest. Mehr dazu in `docs/ERWEITERN.md` im Repo
|
|
82
|
+
`fyos-os`, Abschnitt 10.3.
|
|
83
|
+
|
|
84
|
+
## Was nicht ins Repo gehört
|
|
85
|
+
|
|
86
|
+
Tokens, Passwörter, Schlüssel, `.env`-Dateien, echte Adressen deiner Geräte, Namen von Personen. Geheimnisse stehen in
|
|
87
|
+
der Umgebung des Hubs oder unter `/run/secrets/`, im Repo nur ihr Name. `tools/sauber.py` fängt die gröbsten Fehler ab.
|
|
88
|
+
Ein Plugin-Repo mit persönlicher Konfiguration bleibt privat.
|
|
89
|
+
|
|
90
|
+
## Lizenz
|
|
91
|
+
|
|
92
|
+
FYOS Plugin-Vorlage steht unter der Apache License, Version 2.0 (SPDX-Kennung `Apache-2.0`).
|
|
93
|
+
|
|
94
|
+
Copyright 2026 sirfyyn and FYOS CONTRIBUTORS <!-- sauber: ok -->
|
|
95
|
+
|
|
96
|
+
Der vollständige Lizenztext steht in [`LICENSE`](LICENSE), der Urheberhinweis in [`NOTICE`](NOTICE).
|
|
97
|
+
|
|
98
|
+
Für ein eigenes Plugin auf Grundlage dieses Musters: Die Lizenz deines Plugins wählst du selbst. Was du vom Muster
|
|
99
|
+
übernimmst, bleibt unter Apache-2.0; behalte dafür `LICENSE` und die Urheberzeile in `NOTICE` bei und ergänze deine eigene.
|
|
100
|
+
Trage deine Lizenz und deine Urheberzeile außerdem in `pyproject.toml` (`license`, `authors`) und in `NOTICE` ein;
|
|
101
|
+
`umbenennen.py` ändert sie nicht.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""fyos_plugin_vorlage — Muster für ein FYOS-Hub-Plugin.
|
|
2
|
+
|
|
3
|
+
Das Paket meldet sich über den Entry-Point `mcp_hub.plugins` beim Hub an (`plugin.py`) und über `fyos.katalog`
|
|
4
|
+
beim Installer (`katalog_pfad`).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
__version__ = "0.1.0"
|
|
12
|
+
|
|
13
|
+
KATALOG_DATEI = Path(__file__).resolve().parent / "fyos-katalog.yaml"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def katalog_pfad() -> Path:
|
|
17
|
+
"""Pfad der Katalogdatei dieses Pakets. Die Bilder liegen daneben unter `bilder/`."""
|
|
18
|
+
return KATALOG_DATEI
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 400" role="img" aria-labelledby="t d">
|
|
2
|
+
<title id="t">Skizze: Vorlage-Plugin</title>
|
|
3
|
+
<desc id="d">Ein kleines Fenster mit einem Gruß, einer gespeicherten Notiz und einem Eingabefeld mit zwei Knöpfen; daneben der Hinweis, dass ein Plugin Werkzeuge und Oberfläche liefert.</desc>
|
|
4
|
+
<style>
|
|
5
|
+
.bg{fill:#f4f1ea}.fl{fill:#fffdf8}.bar{fill:#e6e0d3}.ink{fill:#2b2a27}.mut{fill:#8b8578}.acc{fill:#3f7d6e}.wrm{fill:#c9824a}
|
|
6
|
+
.ln{fill:none;stroke:#2b2a27;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.dsh{stroke-dasharray:6 5;opacity:.45}
|
|
7
|
+
text{font-family:ui-rounded,system-ui,-apple-system,sans-serif;font-size:14px}
|
|
8
|
+
@media (prefers-color-scheme:dark){.bg{fill:#1d1c1a}.fl{fill:#2a2926}.bar{fill:#3a3833}.ink{fill:#ece7dc}.mut{fill:#8f897c}.acc{fill:#5fb3a0}.wrm{fill:#e0a06b}.ln{stroke:#ece7dc}}
|
|
9
|
+
</style>
|
|
10
|
+
<rect class="bg" width="640" height="400" rx="14"/>
|
|
11
|
+
<rect class="ln dsh" x="6" y="6" width="628" height="388" rx="10"/>
|
|
12
|
+
<rect class="fl" x="60" y="60" width="330" height="250" rx="10"/>
|
|
13
|
+
<rect class="ln" x="60" y="60" width="330" height="250" rx="10"/>
|
|
14
|
+
<rect class="bar" x="61" y="61" width="328" height="28" rx="9"/>
|
|
15
|
+
<text class="ink" x="196" y="80">Vorlage</text>
|
|
16
|
+
<rect class="bar" x="82" y="108" width="286" height="74" rx="8"/>
|
|
17
|
+
<text class="ink" x="96" y="136" font-weight="700">Hallo, Alex!</text>
|
|
18
|
+
<text class="mut" x="96" y="160">Notiz: Milch nicht vergessen</text>
|
|
19
|
+
<rect class="bar" x="82" y="204" width="170" height="32" rx="8"/>
|
|
20
|
+
<text class="mut" x="96" y="225">Neue Notiz</text>
|
|
21
|
+
<rect class="bar" x="260" y="204" width="46" height="32" rx="8"/>
|
|
22
|
+
<text class="ink" x="269" y="225">Prüf</text>
|
|
23
|
+
<rect class="acc" x="312" y="204" width="56" height="32" rx="8"/>
|
|
24
|
+
<text class="fl" x="322" y="225" font-weight="700">Sich.</text>
|
|
25
|
+
<path class="ln" d="M390 185h60"/><path class="ln" d="M442 178l8 7-8 7"/>
|
|
26
|
+
<rect class="wrm" x="460" y="120" width="140" height="130" rx="10"/>
|
|
27
|
+
<text class="fl" x="494" y="160" font-weight="700">Plugin</text>
|
|
28
|
+
<text class="fl" x="478" y="184">vorlage.hallo</text>
|
|
29
|
+
<text class="fl" x="478" y="204">vorlage.notiz_setzen</text>
|
|
30
|
+
<text class="fl" x="478" y="228">und die App</text>
|
|
31
|
+
<text class="mut" x="60" y="352">Muster für eigene Plugins</text>
|
|
32
|
+
<text class="mut" x="566" y="388" font-size="12">Skizze</text>
|
|
33
|
+
</svg>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Katalogeintrag dieses Plugins für den FYOS-Installer (Schema: fyos-os/installer/fyos_installer/katalog.py).
|
|
2
|
+
# Der Installer findet die Datei über den Entry-Point `fyos.katalog` (pyproject.toml). Die Bilder liegen
|
|
3
|
+
# daneben unter bilder/ (Dateiname <id>-<n>.svg|png|jpg|webp, hier nur der Name in `bilder`).
|
|
4
|
+
version: 1
|
|
5
|
+
bausteine:
|
|
6
|
+
- id: vorlage
|
|
7
|
+
titel: Vorlage-Plugin
|
|
8
|
+
kurz: Eine Begrüßung und eine Notiz als kleine App; Muster für eigene Plugins.
|
|
9
|
+
was_daraus_wird: |
|
|
10
|
+
Im Desktop erscheint ein zusätzliches Fenster, das dich begrüßt und eine Notiz zeigt, die du dort speichern kannst.
|
|
11
|
+
Der Gruß ist einstellbar; die Notiz bleibt auf deiner Installation.
|
|
12
|
+
Der Agent kann dieselben Werkzeuge aufrufen: Er begrüßt dich und merkt sich auf Wunsch eine Notiz.
|
|
13
|
+
Speichern fragt zuerst nach: Du siehst, was geschehen würde, und bestätigst erst dann; »Nur prüfen« zeigt es, ohne etwas zu ändern.
|
|
14
|
+
Gedacht ist der Baustein als Ausgangspunkt für eigene Plugins, nicht für den Alltag.
|
|
15
|
+
bilder: [vorlage-1.svg]
|
|
16
|
+
art: plugin
|
|
17
|
+
pflicht: false
|
|
18
|
+
abhaengig_von: [kern]
|
|
19
|
+
voraussetzungen: []
|
|
20
|
+
# Auf welche Stufe der Baustein welche Schicht hebt (Reifegrad im Installer, 1 bis 3): eine App und Werkzeuge für den Agenten.
|
|
21
|
+
# Ältere Installer kennen das Feld nicht und ignorieren es.
|
|
22
|
+
reife: { oberflaeche: 2, agent: 2 }
|
|
23
|
+
# Woher der Installer das Paket holt: aus dem Paketindex (FYOS_PAKETINDEX) unter `paket`
|
|
24
|
+
# oder per Git aus <FYOS_PLUGIN_QUELLE>/<repo>.git.
|
|
25
|
+
quelle: { paket: fyos-plugin-vorlage, repo: fyos-plugin-vorlage }
|
|
26
|
+
# Ohne Angabe lädt der Hub das Plugin über den Entry-Point; ein Eintrag hier schreibt ihn ausdrücklich in die Hub-Konfiguration.
|
|
27
|
+
hub_plugins:
|
|
28
|
+
- { name: vorlage }
|
|
29
|
+
# Jedes Feld wird zu einer Umgebungsvariable des Hubs; das Plugin liest sie (plugin.py, `_wert`).
|
|
30
|
+
konfiguration:
|
|
31
|
+
- name: begruessung
|
|
32
|
+
titel: Begrüßung
|
|
33
|
+
typ: text
|
|
34
|
+
beschreibung: Gruß der Begrüßung (leer lassen für »Hallo«)
|
|
35
|
+
standard: ""
|
|
36
|
+
pflicht: false
|
|
37
|
+
umgebung: FYOS_VORLAGE_BEGRUESSUNG
|
|
38
|
+
- name: token
|
|
39
|
+
titel: Beispiel-Token
|
|
40
|
+
typ: geheim
|
|
41
|
+
beschreibung: Beispiel für ein Geheimnis; die Vorlage braucht keines, zeigt aber den Weg
|
|
42
|
+
standard: ""
|
|
43
|
+
pflicht: false
|
|
44
|
+
umgebung: FYOS_VORLAGE_TOKEN
|