k1s-workerbee 0.1.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. k1s_workerbee-0.1.7.dist-info/METADATA +837 -0
  2. k1s_workerbee-0.1.7.dist-info/RECORD +52 -0
  3. k1s_workerbee-0.1.7.dist-info/WHEEL +5 -0
  4. k1s_workerbee-0.1.7.dist-info/entry_points.txt +2 -0
  5. k1s_workerbee-0.1.7.dist-info/licenses/LICENSE +201 -0
  6. k1s_workerbee-0.1.7.dist-info/top_level.txt +1 -0
  7. workerbee/__init__.py +7 -0
  8. workerbee/__main__.py +9 -0
  9. workerbee/agent.py +540 -0
  10. workerbee/assets/__init__.py +2 -0
  11. workerbee/assets/dashboard/k1s-logo-32.png +0 -0
  12. workerbee/assets/dashboard/page-background-1920x1080.webp +0 -0
  13. workerbee/assets/poc/api/Containerfile +8 -0
  14. workerbee/assets/poc/api/app.py +87 -0
  15. workerbee/assets/poc/frontend/Containerfile +7 -0
  16. workerbee/assets/poc/frontend/app.py +57 -0
  17. workerbee/assets/poc/store/Containerfile +7 -0
  18. workerbee/assets/poc/store/app.py +47 -0
  19. workerbee/assets/realtime/backend/Containerfile +6 -0
  20. workerbee/assets/realtime/backend/app.py +106 -0
  21. workerbee/assets/realtime/db/Containerfile +6 -0
  22. workerbee/assets/realtime/db/app.py +44 -0
  23. workerbee/assets/realtime/frontend/Containerfile +6 -0
  24. workerbee/assets/realtime/frontend/app.py +70 -0
  25. workerbee/cli.py +1613 -0
  26. workerbee/complementary_architecture.py +897 -0
  27. workerbee/config.py +161 -0
  28. workerbee/containerd_access.py +166 -0
  29. workerbee/containerd_helper.py +1329 -0
  30. workerbee/contract.py +884 -0
  31. workerbee/daemon.py +5315 -0
  32. workerbee/dns.py +609 -0
  33. workerbee/edge_link.py +2944 -0
  34. workerbee/http.py +186 -0
  35. workerbee/ingress.py +1382 -0
  36. workerbee/k1s_runtime.py +124 -0
  37. workerbee/locks.py +101 -0
  38. workerbee/manifests.py +2915 -0
  39. workerbee/mcp_daemon.py +1132 -0
  40. workerbee/mcp_server.py +1234 -0
  41. workerbee/paths.py +65 -0
  42. workerbee/poc.py +374 -0
  43. workerbee/ports.py +56 -0
  44. workerbee/probe.py +314 -0
  45. workerbee/profiles.py +1585 -0
  46. workerbee/remote_k1s_target.py +691 -0
  47. workerbee/runbooks.py +700 -0
  48. workerbee/runtime_support.py +1865 -0
  49. workerbee/secrets.py +277 -0
  50. workerbee/security.py +1347 -0
  51. workerbee/supervisor.py +2501 -0
  52. workerbee/trust.py +243 -0
@@ -0,0 +1,837 @@
1
+ Metadata-Version: 2.4
2
+ Name: k1s-workerbee
3
+ Version: 0.1.7
4
+ Summary: Local MCP workbench for k1s-powered cloud-native agent testing
5
+ Author: k1s contributors
6
+ License: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: k1s-workerbee-runtime==0.1.7
11
+ Requires-Dist: mcp>=1.8
12
+ Provides-Extra: dev
13
+ Requires-Dist: pytest>=8.2; extra == "dev"
14
+ Requires-Dist: ruff>=0.6; extra == "dev"
15
+ Dynamic: license-file
16
+
17
+ # K1S WorkerBee MCP
18
+
19
+ <p align="center">
20
+ <img src="docs/assets/k1s-workerbee-hero.jpg" alt="K1S WorkerBee" width="640">
21
+ </p>
22
+
23
+ WorkerBee is a local MCP workbench that gives coding agents a project-scoped
24
+ k1s-powered app engine for building, deploying, probing, and exporting
25
+ cloud-native applications on a developer machine.
26
+
27
+ WorkerBee v0.1 can use an installed `k1s-workerbee-runtime` wheel or a sibling
28
+ `../k1s` checkout without modifying k1s. The default workflow uses Podman or
29
+ Docker for ordinary app validation. Advanced k1s controller/runtime development
30
+ uses explicit direct containerd mode, where every k1s profile component is
31
+ containerized and scoped under WorkerBee-owned namespaces.
32
+
33
+ ## What WorkerBee Does
34
+
35
+ WorkerBee gives coding agents a local cloud-native loop they can use without
36
+ turning your workstation into a shared cluster. For each project, it can build
37
+ images, stage native k1s or practical Kubernetes manifests, run the workload,
38
+ probe HTTPS ingress, inspect status and logs, run bounded commands, review
39
+ basic security posture, and export handoff artifacts.
40
+
41
+ The short version: you keep editing in your repo, and WorkerBee gives the agent
42
+ a bounded build-deploy-check-export workbench around that repo.
43
+
44
+ <p align="center">
45
+ <img src="docs/assets/how-workerbee-works-v0.png" alt="How WorkerBee works" width="760">
46
+ </p>
47
+
48
+ ## Capabilities
49
+
50
+ - Shared local MCP daemon for one or more agents, with project-scoped state,
51
+ runtime resources, dashboards, and ingress.
52
+ - Immediate global dashboard at `https://dashboard.workerbee.localhost:19443/`
53
+ with project lifecycle controls and self-healing k1s profile ingress links.
54
+ - Local HTTPS ingress through Caddy under `*.workerbee.localhost`, with
55
+ explicit LAN dev exposure, optional WorkerBee DNS forwarding for
56
+ `*.workerbee.home.arpa`-style names, and explicit CA export, local trust, or
57
+ LAN download handling when enabled.
58
+ - Agent workflow for image builds, native k1s manifest staging/deploy,
59
+ status/log inspection, bounded exec, HTTPS probes, cleanup, and iteration.
60
+ - Advisory security assessment for staged manifests, existing exports, and
61
+ WorkerBee-managed local ingress, with OWASP-oriented findings and policy
62
+ suggestions that do not block deploy/export.
63
+ - Artifact handoff as native k1s bundles, Kubernetes YAML, Helm skeletons, and
64
+ image metadata.
65
+ - Advanced direct containerd profiles for k1s development, including sqlite,
66
+ etcd, direct containerd workload, and HA-min profile shapes.
67
+ - End-to-end profile workload validation with a realtime frontend/backend/db
68
+ stack, dashboard/docs/API health checks, HTTPS ingress probes, WebSocket
69
+ validation, logs/status, and exported handoff artifacts.
70
+ - External k1s edge-link workflows for short-lived gateway/node validation
71
+ against an existing core, including start/status/validate/stop operations.
72
+ - AI Max / Strix Halo edge-cell simulation for the corrected 4-node cell model:
73
+ one gateway plus three cell nodes, with optional multi-cell fabric metadata.
74
+ - Public-safe OpenStack Lite contract fixtures for route parity, dashboard
75
+ fixtures, disabled routes, redacted refresh, dossier reporting, and target
76
+ import dry-run validation.
77
+
78
+ ## Quickstart
79
+
80
+ ### One-line install
81
+
82
+ The `latest` URL tracks the latest stable GitHub Release. Use it for ordinary
83
+ stable installs:
84
+
85
+ ```bash
86
+ curl -fsSL https://github.com/the-cm-collective/k1s-workerbee/releases/latest/download/install-workerbee.sh | sh
87
+ ```
88
+
89
+ To pin this stable release directly, use the release tag:
90
+
91
+ ```bash
92
+ curl -fsSL https://github.com/the-cm-collective/k1s-workerbee/releases/download/v0.1.7/install-workerbee.sh | sh
93
+ ```
94
+
95
+ Dev-channel candidates should also use an explicit tag so the installer does
96
+ not resolve back to the latest stable release.
97
+
98
+ ### Install from downloaded release artifacts
99
+
100
+ On Linux or macOS, open the latest GitHub release in a browser and download both
101
+ assets into the same local directory:
102
+
103
+ ```text
104
+ install-workerbee.sh
105
+ workerbee-wheelhouse.tar.gz
106
+ ```
107
+
108
+ Then run the installer from that directory and point it at the downloaded
109
+ wheelhouse archive:
110
+
111
+ ```bash
112
+ chmod +x install-workerbee.sh
113
+ WORKERBEE_INSTALL_BASE_URL="file://$(pwd)" ./install-workerbee.sh
114
+ workerbee doctor
115
+ ```
116
+
117
+ On macOS, pass an explicit Python 3.11+ interpreter when needed:
118
+
119
+ ```bash
120
+ PYTHON=python3.11 WORKERBEE_INSTALL_BASE_URL="file://$(pwd)" ./install-workerbee.sh
121
+ ```
122
+
123
+ The installer uses the currently active Python virtual environment when `VIRTUAL_ENV` is set. If no venv is active, it creates a standalone WorkerBee venv under `${XDG_DATA_HOME:-~/.local/share}/workerbee/venv` and writes a `workerbee` wrapper to `~/.local/bin`. If that directory is not on `PATH`, the installer prints the exact `export PATH=...` line to add.
124
+
125
+ WorkerBee does not install container runtimes. It uses Podman or Docker for the default workflow and supports explicit direct containerd development with `nerdctl`.
126
+
127
+ ### Build and install from a local wheelhouse
128
+
129
+ ```bash
130
+ scripts/build_wheelhouse.sh --k1s-root ../k1s --out dist/workerbee-wheelhouse
131
+ python -m venv .venv
132
+ . .venv/bin/activate
133
+ python -m pip install --no-index --find-links dist/workerbee-wheelhouse k1s-workerbee
134
+ workerbee doctor
135
+ ```
136
+
137
+ The public one-line installer expects each GitHub release to include these
138
+ assets:
139
+
140
+ ```text
141
+ install-workerbee.sh
142
+ workerbee-wheelhouse.tar.gz
143
+ ```
144
+
145
+ Release candidates should also publish `SHA256SUMS` beside those assets when
146
+ checksums are available. Stable installs should continue to use `/latest/`;
147
+ pre-release and dev-channel validation should use `/download/<tag>/`.
148
+
149
+ The default installer URL resolves through GitHub's latest-release redirect:
150
+
151
+ ```text
152
+ https://github.com/the-cm-collective/k1s-workerbee/releases/latest/download/install-workerbee.sh
153
+ ```
154
+
155
+ ### Start the background MCP daemon
156
+
157
+ ```bash
158
+ workerbee mcp start
159
+ ```
160
+
161
+ The command prints the local MCP URL and the global dashboard URL, normally
162
+ `https://dashboard.workerbee.localhost:19443/`. Use `workerbee mcp status`,
163
+ `workerbee mcp restart`, and `workerbee mcp stop` for lifecycle management. Use
164
+ `workerbee mcp serve` only when you want a foreground/debug process. If the
165
+ requested MCP port is already in use, `workerbee mcp start` fails fast; stop the
166
+ owning process or pass `--port`.
167
+
168
+ ### Connect Codex to the shared local MCP server
169
+
170
+ ```bash
171
+ codex mcp add workerbee --url http://127.0.0.1:8765/mcp
172
+ codex mcp list
173
+ workerbee agent instructions
174
+ ```
175
+
176
+ ### Add agent instructions to cloud-native repos
177
+
178
+ Add this project instruction to `AGENTS.md`:
179
+
180
+ ```markdown
181
+ When a task involves containers, services, manifests, ingress, databases, queues,
182
+ security review, or integration behavior, call WorkerBee MCP
183
+ `workerbee_v1_session_start` with the absolute repo cwd and task goal. Use the
184
+ returned `project` for every WorkerBee tool call. Respect the returned project
185
+ mode: `lazy` waits until deploy/start is needed, `start` may already be
186
+ launching the stack, and `stop` means WorkerBee is disabled for that project
187
+ until the mode is changed.
188
+
189
+ Use the local shell for repo edits, ordinary tests, and repo-local build scripts.
190
+ Use WorkerBee MCP for local image builds, native k1s/Kubernetes manifest
191
+ prepare/validate/deploy, project status, logs, exec, HTTPS ingress status and
192
+ probes, security assessment/review, secret policy checks, dashboard URLs, trust
193
+ guidance, cleanup, and artifact export. Use named stages or returned `stage_dir`
194
+ values for manifest operations. Use app names plus the optional `namespace` for
195
+ logs/exec; do not guess generated runtime container names. Use image build
196
+ hardening metadata to prefer minimal, non-root images; pass
197
+ `hardening_profile="hardened"` for WorkerBee-generated or deliberately minimal
198
+ images, and leave arbitrary repo Dockerfiles on `standard` unless asked to
199
+ harden them.
200
+
201
+ If the user asks to bring, run, or start the project up in WorkerBee, treat that
202
+ as a request for a running app workload. Build needed local images, stage and
203
+ validate manifests, deploy with `workerbee_v1_manifest_deploy_local`, then
204
+ inspect status/logs and probe ingress. Do not stop after
205
+ `workerbee_v1_project_start` if deployable manifests or
206
+ Containerfiles/Dockerfiles exist.
207
+
208
+ If this is the first time WorkerBee is coming up for a project, there may be no
209
+ deployed workload to inspect yet. Prefer existing repo manifests and
210
+ Containerfiles/Dockerfiles. When they are absent, build a temporary native k1s
211
+ deployment in WorkerBee state, deploy it locally, then rerun the requested
212
+ runtime validation or security review. Keep first-run generated artifacts in
213
+ WorkerBee state unless the user asks to commit them.
214
+
215
+ For security reviews, call `workerbee_v1_project_status` first, then
216
+ `workerbee_v1_security_review_project` for deployed workloads. If WorkerBee
217
+ reports no deployment metadata, stage/deploy the app or pass an explicit stage
218
+ and rerun the review. Summarize critical/high findings before lower-severity
219
+ items and include the report path.
220
+
221
+ For larger multi-feature requests, when prior WorkerBee stages are performing
222
+ well, scope a coherent feature batch, split it into feature checkpoints,
223
+ validate each checkpoint with repo tests and WorkerBee deployments/probes, and
224
+ keep iterating autonomously while progress is being made. Use checkpoint commits
225
+ only when the user has asked for commits or the repo workflow already permits
226
+ them.
227
+
228
+ For k1s controller/runtime development, use an explicit direct-containerd
229
+ WorkerBee project and the sibling `../k1s` checkout as `k1s_root`. Prefer one
230
+ agent for tandem k1s/WorkerBee work unless tasks are separable. Start profiles
231
+ with `workerbee_v1_profile_start`, deploy staged workloads with
232
+ `workerbee_v1_manifest_deploy_local(target="profile")`, inspect with
233
+ `workerbee_v1_profile_workload_status` and `workerbee_v1_logs(target="profile")`,
234
+ and run `workerbee_v1_profile_workload_validate` for the bundled realtime smoke
235
+ test. Before profile start/stop/purge or profile-target deploy, verify
236
+ `workerbee_v1_capabilities` reports `runtime.selected == containerd`. If a
237
+ profile tool reports `K1S_PROFILE_REQUIRES_CONTAINERD`, restart or select the
238
+ direct-containerd MCP path with `--runtime containerd --containerd-privilege
239
+ sudo-helper` and retry the profile lifecycle command. Restart profiles after
240
+ k1s source changes and restart MCP after WorkerBee source changes. Stop stale
241
+ profiles with `workerbee_v1_profile_stop(purge=true)` when profile evidence or
242
+ validation is complete, and keep manual cleanup scoped to WorkerBee state-hash
243
+ namespaces rather than reserved namespaces such as `ae`, `k8s.io`, `moby`, or
244
+ `default`.
245
+
246
+ For short-lived links from this host to an external k1s core, use the edge-link
247
+ tools: `workerbee_v1_edge_link_start`, `workerbee_v1_edge_link_status`,
248
+ `workerbee_v1_edge_link_validate`, and `workerbee_v1_edge_link_stop`. Prefer
249
+ `--from-microk8s`/MicroK8s bootstrap only for the local dev HA stack, keep
250
+ bootstrap secrets out of output, and validate heartbeat plus GPU advertisement
251
+ when relevant.
252
+ ```
253
+
254
+ For the reasoning behind this agent workflow, see
255
+ [`docs/workerbee-codex-state-reconciliation.md`](docs/workerbee-codex-state-reconciliation.md).
256
+
257
+ Use `workerbee agent install --check` to inspect whether the block is present.
258
+ Use `workerbee agent install --append --target AGENTS.md` to append it to an
259
+ existing repo file, or add `--allow-create` when you explicitly want WorkerBee
260
+ to create the file.
261
+
262
+ ### Source checkout smoke workflow
263
+
264
+ ```bash
265
+ scripts/build_wheelhouse.sh --k1s-root ../k1s --out dist/workerbee-wheelhouse
266
+ python -m pip install -e .[dev] --find-links dist/workerbee-wheelhouse
267
+ workerbee doctor
268
+ workerbee start
269
+ workerbee deploy-poc
270
+ workerbee poc-status
271
+ workerbee logs api
272
+ workerbee export-k8s
273
+ workerbee stop --purge
274
+ ```
275
+
276
+ ## NixOS Local Development
277
+
278
+ The simplest NixOS path is to use Nix for host tools and native library
279
+ compatibility, while keeping WorkerBee itself in an editable Python virtual
280
+ environment. This avoids packaging every Python dependency in Nix and keeps the
281
+ release wheel path representative.
282
+
283
+ ```bash
284
+ direnv allow
285
+ scripts/build_wheelhouse.sh --k1s-root ../k1s --out dist/workerbee-wheelhouse
286
+ uv venv .venv
287
+ uv pip install -e '.[dev]' --find-links dist/workerbee-wheelhouse
288
+ workerbee doctor
289
+ ```
290
+
291
+ The dev shell provides Python, `uv`, `ruff`, `node`, `jq`, `imagemagick`, and on
292
+ Linux, `nerdctl`, `buildctl`, `slirp4netns`, and CNI plugins for direct
293
+ containerd development. Podman or Docker daemon setup remains a host
294
+ prerequisite for the default runtime path.
295
+ If `k1s-workerbee-runtime` is already available from your configured package
296
+ index, the local wheelhouse build and `--find-links` option can be omitted.
297
+
298
+ When rebuilding WorkerBee from this checkout and restarting the normal
299
+ background MCP daemon, stop the old daemon before reinstalling and refresh sudo
300
+ before start:
301
+
302
+ ```bash
303
+ workerbee mcp stop
304
+ scripts/build_wheelhouse.sh --k1s-root ../k1s --out dist/workerbee-wheelhouse
305
+ uv pip install --python .venv -e '.[dev]' --find-links dist/workerbee-wheelhouse --force-reinstall
306
+ sudo -v && workerbee mcp start
307
+ ```
308
+
309
+ This keeps the background daemon from serving old in-process code, refreshes the
310
+ editable install against the rebuilt local runtime wheelhouse, and ensures
311
+ direct-containerd startup has a current sudo credential when `sudo-helper` is
312
+ configured.
313
+
314
+ For the advanced direct containerd verification path, use the repo-local helper:
315
+
316
+ ```bash
317
+ scripts/dev/wb-containerd mcp-restart
318
+ scripts/dev/wb-containerd mcp-status
319
+ scripts/dev/wb-containerd mcp-stop
320
+ ```
321
+
322
+ The helper defaults to `/tmp/workerbee-containerd-verify`,
323
+ `127.0.0.1:8765`, and `sudo-helper`. Override with
324
+ `WORKERBEE_CONTAINERD_STATE_ROOT`, `WORKERBEE_MCP_HOST`,
325
+ `WORKERBEE_MCP_PORT`, or `WORKERBEE_MCP_TIMEOUT` when needed. It also accepts
326
+ normal WorkerBee arguments after applying the direct containerd defaults:
327
+
328
+ ```bash
329
+ scripts/dev/wb-containerd --project wb014 profile list
330
+ ```
331
+
332
+ Use a short explicit project for profile validation, such as `wb014` or
333
+ `k1sdev`. Derived Git worktree project names can be too long for profile DNS
334
+ names and container labels.
335
+
336
+ For an installed/user-level WorkerBee, persist the same defaults once and then
337
+ use the normal `workerbee` command:
338
+
339
+ ```bash
340
+ workerbee config set \
341
+ --runtime containerd \
342
+ --containerd-privilege sudo-helper \
343
+ --state-root /tmp/workerbee-containerd-verify \
344
+ --mcp-host 127.0.0.1 \
345
+ --mcp-port 8765 \
346
+ --mcp-timeout 90
347
+
348
+ workerbee mcp restart
349
+ workerbee mcp status
350
+ workerbee mcp stop
351
+ ```
352
+
353
+ WorkerBee reads defaults from `${XDG_CONFIG_HOME:-~/.config}/workerbee/config.json`.
354
+ Explicit CLI flags still win, and environment variables such as
355
+ `WORKERBEE_RUNTIME`, `WORKERBEE_CONTAINERD_PRIVILEGE`,
356
+ `WORKERBEE_STATE_ROOT`, `WORKERBEE_MCP_HOST`, `WORKERBEE_MCP_PORT`, and
357
+ `WORKERBEE_MCP_TIMEOUT` override the config file. Use
358
+ `workerbee config show`, `workerbee config path`, or `workerbee config clear`
359
+ to inspect or reset these defaults.
360
+
361
+ The MCP daemon is intentionally shared. Multiple coding agents can connect to
362
+ the same local MCP server URL and operate on separate project scopes by passing
363
+ distinct `project` values to WorkerBee tools. The daemon stores those projects
364
+ under a global state root, defaults to `WORKERBEE_HOME`, then
365
+ `$XDG_DATA_HOME/workerbee`, then `~/.local/share/workerbee`, and exposes a
366
+ global dashboard as soon as MCP starts.
367
+
368
+ Agents should start each repo session with `workerbee_v1_session_start`. WorkerBee derives a stable project id from the Git repository name plus the current branch plus a cwd hash, persists the cwd for that project, and returns dashboard URLs plus the cloud-native runbook. This lets two Codex sessions share one MCP daemon while still building and deploying against the correct checkout and branch. Outside Git, WorkerBee uses the cwd basename plus the cwd hash. Explicit `--project` or MCP `project` values override this derived identity.
369
+
370
+ For example, in `~/git/k1s` on branch `dev`, WorkerBee derives a project similar to `k1s-dev-190438baf7`. App ingress is scoped under that project:
371
+
372
+ ```text
373
+ https://app.k1s-dev-190438baf7.workerbee.localhost:19443/
374
+ https://api.k1s-dev-190438baf7.workerbee.localhost:19443/
375
+ ```
376
+
377
+ Project mode controls whether WorkerBee starts for a repo:
378
+
379
+ ```bash
380
+ workerbee project status
381
+ workerbee project mode lazy
382
+ workerbee project mode start --open
383
+ workerbee project mode stop
384
+ ```
385
+
386
+ `lazy` is the default and starts the k1s stack only when deploy/start is requested. `start` starts immediately and persists for future Codex sessions. `stop` stops the project and makes WorkerBee MCP return `PROJECT_STOPPED` for start/deploy/runtime operations until the mode is changed.
387
+
388
+ Useful daemon commands:
389
+
390
+ ```bash
391
+ workerbee mcp status
392
+ workerbee mcp stop
393
+ workerbee projects
394
+ workerbee global-dashboard
395
+ workerbee ingress status
396
+ workerbee trust status
397
+ ```
398
+
399
+ `workerbee mcp stop` stops the background MCP daemon and its global
400
+ dashboard/Caddy ingress container. Project stacks remain controlled with
401
+ `workerbee stop`, `workerbee project mode stop`, or the MCP project stop/reset
402
+ tools.
403
+
404
+ WorkerBee MCP is local-only by default. `mcp start`, `mcp restart`, and
405
+ `mcp serve` refuse non-loopback binds unless `--allow-remote-mcp` or
406
+ `WORKERBEE_ALLOW_REMOTE_MCP=1` is set for a controlled local-network test.
407
+ WorkerBee does not implement remote MCP authorization yet; future remote mode
408
+ should follow the MCP OAuth 2.1 Resource Server model with OAuth Protected
409
+ Resource Metadata rather than a custom bearer-token scheme.
410
+
411
+ App ingress is also loopback-only by default. For an explicit local-network dev
412
+ session, start or restart MCP with LAN ingress:
413
+
414
+ ```bash
415
+ workerbee mcp restart --ingress-exposure lan
416
+ ```
417
+
418
+ For a localhost-only stack, retrieve or install the same Caddy local CA from the
419
+ host when you want the browser or system tools to trust WorkerBee HTTPS:
420
+
421
+ ```bash
422
+ workerbee ingress ca --output workerbee-ca.crt
423
+ workerbee trust install --target system
424
+ workerbee trust install --target nss
425
+ ```
426
+
427
+ LAN mode binds WorkerBee Caddy on `0.0.0.0`, derives an `sslip.io` base domain
428
+ from the host LAN IP when `--ingress-domain` is omitted, and prints a plain HTTP
429
+ CA download URL such as
430
+ `http://ca.192-168-1-23.sslip.io:19080/workerbee-ca.crt`. The CA certificate is
431
+ public material and is served without auth only in explicit LAN mode; install or
432
+ trust it on the other device before using the LAN HTTPS app URLs. Use
433
+ `--ingress-domain workerbee.home.arpa`, `--ingress-bind`, or
434
+ `--ingress-ca-port` when your LAN DNS, host firewall, or port policy needs
435
+ explicit values.
436
+
437
+ For devices where editing the router DNS is not desirable, WorkerBee can also
438
+ run an explicit LAN dev DNS forwarder. Start MCP with DNS enabled, then set the
439
+ other device's DNS server to the WorkerBee host IP:
440
+
441
+ ```bash
442
+ workerbee mcp restart --ingress-exposure lan --ingress-dns forwarding
443
+ ```
444
+
445
+ DNS-enabled LAN ingress defaults to `workerbee.home.arpa` when no
446
+ `--ingress-domain` is supplied. WorkerBee answers that domain and all
447
+ subdomains with the WorkerBee LAN IP, and forwards other DNS names to the host's
448
+ configured resolvers. Real phones and tablets usually require DNS port `53`;
449
+ if binding it fails, retry with `--ingress-dns-bind <lan-ip>`, free that port,
450
+ or grant the daemon permission to bind privileged ports. `--ingress-dns-port` is
451
+ available for clients that support a custom DNS resolver port. WorkerBee DNS
452
+ only answers private/LAN clients for the selected WorkerBee domain; all other
453
+ queries are forwarded to the configured host resolvers.
454
+
455
+ The forwarder evaluates configured upstreams before returning a negative answer.
456
+ If an earlier LAN/router resolver returns stale `NXDOMAIN` or an empty answer
457
+ for a public preview name, WorkerBee still tries later upstreams and prefers a
458
+ positive answer. If every upstream returns `NXDOMAIN`, the answer stays
459
+ `NXDOMAIN`; if all upstreams fail or time out, WorkerBee returns `SERVFAIL`.
460
+ `workerbee mcp status`, `workerbee ingress status --json`, and
461
+ `workerbee_v1_ingress_status` include the redacted forwarding policy and
462
+ upstream order without logging query names by default.
463
+
464
+ For preview or lab environments that mix LAN-only WorkerBee names with public
465
+ preview zones, put public resolvers first for public preview zones and use the
466
+ LAN router only for LAN-only names until WorkerBee grows conditional forwarding.
467
+ A router may cache stale negative public answers even after authoritative DNS is
468
+ correct.
469
+
470
+ With DNS forwarding enabled, a LAN device can normally install the CA from
471
+ `http://ca.workerbee.home.arpa:19080/workerbee-ca.crt`, set its DNS server to
472
+ the WorkerBee host IP, and browse project URLs such as
473
+ `https://app.<project>.workerbee.home.arpa:19443/` without editing router DNS.
474
+ `workerbee mcp status` prints the dashboard URL, CA export/trust commands, LAN
475
+ CA download URL, and DNS listen value. `workerbee ingress status --json`,
476
+ `workerbee_v1_ingress_status`, and the global dashboard include the full
477
+ ingress/DNS/CA state, including the base domain, CA SHA256, CA command guidance,
478
+ and upstream resolvers.
479
+
480
+ The global dashboard also provides token-protected local controls to start, stop,
481
+ or delete one project, selected projects, or all known projects. Start can bring
482
+ a saved project stack back up outside the original agent session. Delete means
483
+ stop, purge project runtime/state, unregister the project from the global
484
+ dashboard, and resync WorkerBee Caddy imports. The dashboard can also request
485
+ MCP shutdown or an in-place MCP reboot. Dashboard action responses and pages are
486
+ served with no-store and browser security headers; cached static assets are
487
+ served with content-type sniffing disabled.
488
+
489
+ Staged deployment workflow:
490
+
491
+ ```bash
492
+ workerbee manifest prepare --name demo --template frontend-api-store
493
+ workerbee manifest validate --stage demo
494
+ workerbee security assess --stage demo
495
+ workerbee manifest deploy-local --stage demo
496
+ workerbee security review-project --stage demo
497
+ workerbee bundle export --stage demo --format k1s
498
+ ```
499
+
500
+ `workerbee security assess` reviews a staged bundle directly. `workerbee
501
+ security review-project` reviews a deployed project and writes a JSON report
502
+ under the WorkerBee project state at `reports/security/`. When the deployment
503
+ was performed through MCP `workerbee_v1_manifest_deploy_local`, WorkerBee
504
+ records the latest stage and agents can usually call
505
+ `workerbee_v1_security_review_project` without passing `stage`. If no deployment
506
+ metadata exists, WorkerBee returns an actionable error listing available stages
507
+ so the agent can stage/deploy first or retry with an explicit stage.
508
+
509
+ Secrets are SOPS/age-first by default. WorkerBee-generated stacks create a
510
+ project-local age identity under the WorkerBee state tree, write generated
511
+ secret files as `.sops.yaml`, and pass `SOPS_AGE_KEY_FILE` to local k1s
512
+ controllers. To use an existing identity, set
513
+ `WORKERBEE_SOPS_AGE_KEY_FILE=/path/to/keys.txt` before starting WorkerBee. The
514
+ insecure local escape hatch is explicit:
515
+ `WORKERBEE_ALLOW_PLAINTEXT_SECRETS=1`. Remote k1s deploy refuses native
516
+ `secretRefs` unless `--allow-remote-secretrefs` is passed, because secret paths
517
+ are resolved by the remote controller. Agents can call
518
+ `workerbee_v1_secret_policy_status(project)` to check whether a project is using
519
+ SOPS mode, whether its age identity is ready, and whether plaintext mode has
520
+ been explicitly enabled. WorkerBee token-bearing local state files are written
521
+ owner-only.
522
+
523
+ The live security assessment report scenario is opt-in because it builds and
524
+ deploys a real local app through WorkerBee:
525
+
526
+ ```bash
527
+ WORKERBEE_LIVE_SECURITY_REPORT=1 \
528
+ WORKERBEE_SECURITY_REPORT_OUT=/tmp/workerbee-security-report.json \
529
+ .venv/bin/python -m pytest tests/test_security_live.py -q
530
+ ```
531
+
532
+ The remote k1s deploy live scenario is also opt-in. It starts a standalone
533
+ same-host k1s target through direct containerd, builds the bundled realtime
534
+ frontend/backend/db app, deploys it with WorkerBee's remote k1s deploy path, and
535
+ probes the public HTTPS routes:
536
+
537
+ ```bash
538
+ unset WORKERBEE_CONTAINERD_ADDRESS AE_CONTAINERD_ADDRESS AE_CRI_ENDPOINT
539
+ unset WORKERBEE_ALLOW_SHARED_K8S_CONTAINERD
540
+ WORKERBEE_LIVE_REMOTE_K1S_DEPLOY=1 \
541
+ WORKERBEE_LIVE_REMOTE_K1S_ROOT=/path/to/k1s \
542
+ WORKERBEE_CONTAINERD_PRIVILEGE=sudo-helper \
543
+ .venv/bin/python -m pytest tests/test_remote_k1s_live.py -q
544
+ ```
545
+
546
+ Set `WORKERBEE_LIVE_REMOTE_K1S_KEEP=1` to pause after a successful deployment
547
+ for manual dashboard inspection. Press Enter when inspection is complete; the
548
+ test then removes the remote target and WorkerBee containers. The test also
549
+ prints and writes a fallback cleanup command in its JSON report, for example:
550
+
551
+ ```bash
552
+ workerbee --runtime containerd --state-root <state-root> cleanup --execute --purge-images
553
+ ```
554
+
555
+ `--stage` accepts either the absolute `stage_dir` returned by prepare or the
556
+ named stage under the project `artifacts/staged` directory.
557
+ `manifest prepare --source <file-or-dir>` can stage native k1s YAML or practical
558
+ Kubernetes YAML. Kubernetes input is applied through the k1s shim
559
+ `ae apply --k8s` path and should keep exactly one workload plus matching
560
+ Service/Ingress documents per file. Native k1s manifests are the required input
561
+ when exporting a native k1s bundle; Kubernetes input can be exported as
562
+ Kubernetes YAML or a Helm skeleton. Kubernetes and Helm exports preserve Secret
563
+ references but do not emit Secret values; create environment-specific Secret
564
+ objects before applying those exports.
565
+
566
+ For Compose-shaped first runs, treat Compose as the source topology rather than
567
+ as a directly runnable WorkerBee input. Map each service to a separate
568
+ one-container workload, keep API and background workers separate unless the repo
569
+ already ships a combined development image, run object stores or queues as their
570
+ own workloads, and model bucket/database/bootstrap setup as an explicit Job or
571
+ temporary setup workload. WorkerBee v0.1 does not run Kubernetes
572
+ `initContainers`, multi-container pods, or exact Kubernetes entrypoint override
573
+ semantics in local apply, so validate these translations with status, logs, and
574
+ ingress probes after deployment.
575
+
576
+ `workerbee_v1_ingress_status` reports global ingress, DNS, CA readiness, CA
577
+ SHA256, and command guidance for export/trust/LAN download.
578
+ `workerbee_v1_ingress_probe` supports `GET`, `HEAD`, `POST`, `PUT`, `PATCH`,
579
+ `DELETE`, and `OPTIONS` plus `json_body`, raw `body`, and custom `headers`.
580
+ Use headers for signed smoke tests such as S3 presigned `PUT`; WorkerBee
581
+ intentionally blocks overriding `Host` and `Content-Length`.
582
+
583
+ Image builds support repo-root contexts with nested Dockerfiles:
584
+
585
+ ```bash
586
+ workerbee build-image . --dockerfile backend/Dockerfile --tag workerbee-demo-api:dev
587
+ ```
588
+
589
+ WorkerBee prefers an installed `k1s-workerbee-runtime` package. For source development it
590
+ falls back to a sibling k1s checkout at `../k1s`. Override with
591
+ `WORKERBEE_K1S_ROOT=/path/to/k1s`.
592
+
593
+ `workerbee start` prints the project k1s dashboard URL immediately. The default
594
+ local URL is `http://127.0.0.1:19108/dashboard` when that port is free.
595
+ `workerbee mcp start` additionally prints the global dashboard URL, normally
596
+ `https://dashboard.workerbee.localhost:19443/`.
597
+
598
+ When a project deploys app ingress through the MCP daemon, WorkerBee scopes
599
+ hosts under the project name, for example
600
+ `https://app.default.workerbee.localhost:19443/` and
601
+ `https://api.default.workerbee.localhost:19443/` in loopback mode, or under the
602
+ selected LAN base domain in LAN mode. Caddy terminates TLS with its local
603
+ internal CA. WorkerBee never installs that CA implicitly; run
604
+ `workerbee trust install` only when you explicitly want the local CA added to
605
+ system/user trust stores. In explicit LAN mode, WorkerBee also publishes a CA
606
+ download URL for other local devices; when WorkerBee DNS forwarding is enabled,
607
+ the global dashboard and status output include the DNS server address and domain
608
+ to configure on those devices.
609
+
610
+ The MCP SDK is installed by the package dependency. In a source checkout, build the
611
+ wheelhouse first or provide equivalent dependency links before running `workerbee mcp start`.
612
+
613
+ For container-orchestration development where Podman or Docker would interfere
614
+ with the system under test, run WorkerBee against direct containerd explicitly:
615
+
616
+ ```bash
617
+ workerbee --runtime containerd --containerd-privilege sudo-helper mcp start
618
+ ```
619
+
620
+ On Ubuntu/Debian hosts that also run MicroK8s with NVIDIA GPU Operator, the
621
+ operator toolkit can mutate MicroK8s' containerd template and signal MicroK8s
622
+ containerd. Before direct-containerd test runs on such a host, use the portable
623
+ dev guard:
624
+
625
+ ```bash
626
+ scripts/dev/microk8s-nvidia-guard status
627
+ scripts/dev/microk8s-nvidia-guard apply
628
+ ```
629
+
630
+ The guard is detection-driven and exits no-op on hosts without MicroK8s, without
631
+ NVIDIA GPU Operator, or where the toolkit is not targeting MicroK8s containerd.
632
+ When applicable, it temporarily suspends the owning Flux Kustomization and GPU
633
+ Operator HelmRelease, following parent Kustomization labels when necessary so
634
+ GitOps does not immediately re-apply the HelmRelease. It disables only the
635
+ NVIDIA toolkit component, verifies MicroK8s health, and records rollback state
636
+ under `/tmp`. Restore the previous state after the test window with:
637
+
638
+ ```bash
639
+ scripts/dev/microk8s-nvidia-guard rollback
640
+ ```
641
+
642
+ Containerized k1s profiles are only available in direct containerd mode. They
643
+ are intended for advanced k1s development, not ordinary app-stack use. WorkerBee
644
+ currently ships these built-in profiles. For the recommended tandem workflow
645
+ with this repo plus a sibling `../k1s` checkout, see
646
+ [`docs/k1s-dev-workflow.md`](docs/k1s-dev-workflow.md).
647
+
648
+ ```text
649
+ k1s-dev-min-sqlite 1 controller + API shim/dashboard + sqlite
650
+ k1s-dev-etcd-labs 1 controller + API shim/dashboard + etcd
651
+ k1s-single-etcd-containerd 1 controller + API shim/dashboard + etcd + direct containerd workloads
652
+ k1s-ha-min 3 controllers + API shim/dashboard + shared etcd + shared NATS
653
+ ```
654
+
655
+ No k1s profile starts a k1s controller, API shim, etcd, NATS, or dashboard as a host process. Use:
656
+
657
+ ```bash
658
+ workerbee --runtime containerd profile list
659
+ workerbee --runtime containerd --project wb014 profile start --profile k1s-ha-min --k1s-root ../k1s
660
+ workerbee --runtime containerd --project wb014 profile status
661
+ workerbee --runtime containerd --project wb014 validate --scenario k1s-profile --profile k1s-ha-min --k1s-root ../k1s
662
+ workerbee --runtime containerd --project wb014 profile stop --purge
663
+ ```
664
+
665
+ When run through the MCP daemon, profile controller/API ingress is published under the project namespace, for example `https://k1s.wb014.workerbee.localhost:19443/dashboard` and `https://k1s-api.wb014.workerbee.localhost:19443/`.
666
+
667
+ The canonical profile controller URL is now `https://k1s.<project>.workerbee.localhost:19443/`.
668
+ It exposes dashboard and docs paths such as:
669
+
670
+ ```text
671
+ https://k1s.wb014.workerbee.localhost:19443/dashboard
672
+ https://k1s.wb014.workerbee.localhost:19443/docs
673
+ https://k1s.wb014.workerbee.localhost:19443/redoc
674
+ https://k1s-api.wb014.workerbee.localhost:19443/
675
+ ```
676
+
677
+ `k1s-dash.<project>.workerbee.localhost` remains a compatibility alias for the
678
+ dashboard. WorkerBee profile workload operations use the project profile's
679
+ internal admin token and WorkerBee's generated CA to call the exposed profile API;
680
+ tokens are not returned in MCP or CLI results.
681
+
682
+ Profile workload deploy/status/log/validate operations require the background
683
+ MCP daemon for project-scoped Caddy ingress. To exercise the
684
+ app-engine-in-app-engine path, start MCP, stage a realtime frontend/backend/db
685
+ bundle, and deploy it into a running profile:
686
+
687
+ ```bash
688
+ workerbee --runtime containerd --containerd-privilege sudo-helper mcp start
689
+ workerbee --runtime containerd --project wb014 profile start --profile k1s-ha-min --k1s-root ../k1s
690
+ workerbee --runtime containerd --project wb014 manifest prepare --name realtime --template realtime-web-db
691
+ workerbee --runtime containerd --project wb014 manifest deploy-local \
692
+ --target profile \
693
+ --profile k1s-ha-min \
694
+ --stage realtime \
695
+ --k1s-root ../k1s
696
+ workerbee --runtime containerd --project wb014 profile status
697
+ ```
698
+
699
+ The MCP equivalents are `workerbee_v1_manifest_prepare`,
700
+ `workerbee_v1_manifest_deploy_local(target="profile")`,
701
+ `workerbee_v1_profile_workload_status`, and `workerbee_v1_logs(target="profile")`.
702
+ For a single end-to-end validation, use:
703
+
704
+ ```bash
705
+ workerbee --runtime containerd --project wb014 validate \
706
+ --scenario profile-workload \
707
+ --profile k1s-ha-min \
708
+ --k1s-root ../k1s
709
+ ```
710
+
711
+ That validation builds the bundled realtime image contexts, starts the requested
712
+ k1s profile, deploys native k1s manifests into the profile through the
713
+ project-scoped API, checks dashboard/docs/API health, probes HTTPS app ingress,
714
+ verifies a WebSocket echo path, collects workload status, and exports k1s,
715
+ Kubernetes, and Helm handoff artifacts.
716
+
717
+ This path uses `nerdctl` against the configured containerd socket, but scopes
718
+ WorkerBee work into state-root-hashed namespaces such as
719
+ `workerbee-<state-hash>-system` and `workerbee-<state-hash>-<project>`. It also
720
+ uses state-local nerdctl data roots, state-local CNI config directories, and
721
+ state-hash-scoped project networks. WorkerBee must never target reserved
722
+ namespaces such as `ae`, `k8s.io`, `moby`, or `default`; those may belong to a
723
+ real k1s/Kubernetes runtime on the same host.
724
+
725
+ WorkerBee also generates a state-derived CNI bridge interface name instead of
726
+ the global-looking `nerdctl0` default and allocates a deterministic
727
+ WorkerBee-only subnet for the default bridge that is separate from the explicit
728
+ project network subnet. On hosts with MicroK8s, WorkerBee refuses the MicroK8s
729
+ containerd socket by default and always refuses MicroK8s CNI config paths. For a
730
+ controlled local integration test that intentionally shares the MicroK8s
731
+ containerd socket, set `WORKERBEE_ALLOW_SHARED_K8S_CONTAINERD=1`; the CNI config
732
+ path must still remain under the WorkerBee state root.
733
+
734
+ Existing host artifacts such as a `nerdctl0` interface or a
735
+ `nerdctl-bridge.conflist` under `/var/snap/microk8s/.../args/cni-network` may
736
+ predate the current guard. Treat those as host remediation work: inspect
737
+ MicroK8s health, confirm Calico is pinned to the real host interface when
738
+ needed, and remove stale MicroK8s CNI pollution manually during a maintenance
739
+ window rather than through WorkerBee.
740
+
741
+ When `--runtime containerd` is explicitly selected, WorkerBee MCP defaults to `--containerd-privilege auto`. Auto first tries unprivileged `nerdctl`; if that fails, WorkerBee prompts once with `sudo` and starts a state-scoped root helper. The helper exposes a WorkerBee-owned Unix socket and a generated `nerdctl` wrapper under the WorkerBee state root, validates every command, and only allows WorkerBee state-hash namespaces plus state-local data/CNI paths. This never runs for `--runtime auto`, Docker, or Podman. Use `--containerd-privilege unprivileged` if you preconfigured rootless/system access yourself.
742
+
743
+ Inspect or stop the helper with:
744
+
745
+ ```bash
746
+ workerbee --runtime containerd containerd-privilege status
747
+ workerbee --runtime containerd containerd-privilege stop-helper
748
+ ```
749
+
750
+ Shared host containerd is still a privileged development mode. WorkerBee avoids broad prune operations and cleanup is constrained to WorkerBee state-hash namespaces, but Podman or Docker remains the safer default for ordinary users.
751
+
752
+ Other MCP clients can connect to the same Streamable HTTP endpoint if they support HTTP MCP. For example, Claude Code documents `claude mcp add --transport http workerbee http://127.0.0.1:8765/mcp`; Codex is the tested target for WorkerBee v0.1.
753
+
754
+ Uninstall standalone WorkerBee:
755
+
756
+ ```bash
757
+ rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/workerbee/venv" "$HOME/.local/bin/workerbee"
758
+ ```
759
+
760
+ If installed into an active venv, uninstall with `python -m pip uninstall k1s-workerbee`.
761
+
762
+ ## macOS Notes
763
+
764
+ macOS support is best effort for v0.1, with Docker Desktop as the recommended
765
+ runtime for the default WorkerBee app workflow. Install Python 3.11 or newer,
766
+ install Docker Desktop, start Docker Desktop, and confirm the Docker CLI works:
767
+
768
+ ```bash
769
+ python3.11 --version
770
+ docker version
771
+ ```
772
+
773
+ ### macOS one-line install
774
+
775
+ ```bash
776
+ curl -fsSL https://github.com/the-cm-collective/k1s-workerbee/releases/latest/download/install-workerbee.sh | PYTHON=python3.11 sh
777
+ export PATH="$HOME/.local/bin:$PATH"
778
+ workerbee doctor
779
+ ```
780
+
781
+ To pin a specific release or dev-channel candidate, replace
782
+ `/releases/latest/download/` with an explicit release tag path, such as
783
+ `/releases/download/v0.1.7/`.
784
+
785
+ The installer uses an active virtual environment when one is enabled. Without an
786
+ active venv, it creates a standalone WorkerBee venv under
787
+ `${XDG_DATA_HOME:-$HOME/.local/share}/workerbee/venv` and writes a wrapper to
788
+ `~/.local/bin/workerbee`.
789
+
790
+ ### macOS clone/dev install
791
+
792
+ ```bash
793
+ git clone git@github.com:the-cm-collective/k1s-workerbee.git
794
+ cd k1s-workerbee
795
+ python3.11 -m venv .venv
796
+ . .venv/bin/activate
797
+ python -m pip install -U pip
798
+ mkdir -p dist
799
+ curl -fsSL https://github.com/the-cm-collective/k1s-workerbee/releases/latest/download/workerbee-wheelhouse.tar.gz -o dist/workerbee-wheelhouse.tar.gz
800
+ tar -xzf dist/workerbee-wheelhouse.tar.gz -C dist
801
+ python -m pip install -e '.[dev]' --find-links dist/workerbee-wheelhouse
802
+ workerbee doctor
803
+ ```
804
+
805
+ If you are developing against a sibling k1s checkout instead of the published
806
+ runtime wheel, rebuild the wheelhouse from that checkout:
807
+
808
+ ```bash
809
+ scripts/build_wheelhouse.sh --k1s-root ../k1s --out dist/workerbee-wheelhouse --python .venv/bin/python
810
+ python -m pip install -e '.[dev]' --find-links dist/workerbee-wheelhouse
811
+ ```
812
+
813
+ With Docker Desktop, WorkerBee is intended to support the same default app
814
+ workflow used on Linux Docker/Podman hosts, with comparable default-app
815
+ capability to the direct-containerd backend: MCP daemon, global dashboard, Docker
816
+ image builds, local deploy/status/logs/exec, HTTPS ingress probes, POC
817
+ validation, cleanup, and artifact export.
818
+
819
+ ```bash
820
+ workerbee --runtime docker mcp start
821
+ workerbee --runtime docker deploy-poc
822
+ workerbee --runtime docker poc-status
823
+ workerbee --runtime docker logs api
824
+ workerbee --runtime docker export-k8s
825
+ workerbee --runtime docker stop --purge
826
+ workerbee --runtime docker mcp stop
827
+ ```
828
+
829
+ Direct-containerd profiles, the MicroK8s/NVIDIA guard, and
830
+ `scripts/dev/wb-containerd` are Linux/containerd development paths. They are not
831
+ the expected Docker Desktop path on macOS.
832
+
833
+ To trust the local WorkerBee Caddy CA after `workerbee mcp start`, run:
834
+
835
+ ```bash
836
+ workerbee trust install --target system
837
+ ```