software-defence-factory 0.4.0 → 0.4.1
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.
- package/README.md +1 -0
- package/bin/software-defence-factory.mjs +2 -1
- package/docs/quickstart.md +3 -1
- package/docs/services.md +2 -1
- package/docs/setup.md +235 -0
- package/kit/installation.md +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ Choose the part you need:
|
|
|
19
19
|
|
|
20
20
|
| Outcome | Command / guide |
|
|
21
21
|
| --- | --- |
|
|
22
|
+
| Set up an operator, worker and application | [Setup plan and acceptance checklist](docs/setup.md) |
|
|
22
23
|
| Use the method with your existing agent | `software-defence-factory kit --output ./factory-kit` — exports a new staging directory |
|
|
23
24
|
| Try the runtime without inference | `software-defence-factory demo` — Docker required; synthetic sample only |
|
|
24
25
|
| Connect an existing repository | [Runtime quickstart](docs/quickstart.md) |
|
|
@@ -224,6 +224,7 @@ Runtime commands accept --state PATH. Default: ${DEFAULT_STATE}
|
|
|
224
224
|
Demo default: ${DEFAULT_DEMO_STATE}
|
|
225
225
|
The npm CLI keeps state outside the package; updates wait for stopped installations.
|
|
226
226
|
Dashboard binds only to loopback; use SSH for remote access.
|
|
227
|
-
|
|
227
|
+
Setup plan: ${join(ROOT, 'docs/setup.md')}
|
|
228
|
+
See docs/quickstart.md for task execution, evidence and recovery.`);
|
|
228
229
|
else throw new Error(`Unknown command: ${command}`);
|
|
229
230
|
} catch(error) {console.error(`Factory: ${error.message}`);process.exitCode=1;}
|
package/docs/quickstart.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Runtime quickstart
|
|
2
2
|
|
|
3
|
+
For a new worker or remote operator, start with the [setup plan](setup.md).
|
|
4
|
+
|
|
3
5
|
Install Node 22.13+, Git and Docker Engine/Desktop. Use an unprivileged account with Docker access. Install `software-defence-factory` through npm, or invoke the same package with npx. No factory source checkout is required.
|
|
4
6
|
|
|
5
7
|
## Qualify a synthetic installation
|
|
@@ -55,7 +57,7 @@ ssh -N -L 127.0.0.1:7331:127.0.0.1:7331 your-host
|
|
|
55
57
|
|
|
56
58
|
Open http://127.0.0.1:7331 on the client. Use the same local/remote port because the HTTP service validates its Host header. The SSH connection must remain open. Access also works across different networks when your configured private network connects the hosts.
|
|
57
59
|
|
|
58
|
-
Use `status`, `cancel JOB_ID`, `retry JOB_ID` and `stop`, always with the selected `--state`. `service`
|
|
60
|
+
Use `status`, `cancel JOB_ID`, `retry JOB_ID` and `stop`, always with the selected `--state`. `service install --state PATH` installs and enables the supported Linux user service; `service status`, `service logs` and `service uninstall` operate it. Bare `service` only prints a definition. For managed startup, persistent SSH tunnels and daily idle updates, follow [services](services.md). See [recovery](recovery.md) for interrupted attempts.
|
|
59
61
|
|
|
60
62
|
## Native application builds
|
|
61
63
|
|
package/docs/services.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Persistent controllers and remote dashboards
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
For the complete host-to-application sequence and reboot checklist, start with
|
|
4
|
+
[the setup plan](setup.md). Install the npm CLI first. A Factory controller is a Linux systemd **user**
|
|
4
5
|
service; SSH tunnels support Linux systemd and macOS launchd. Neither needs a
|
|
5
6
|
root controller. macOS can still run a local controller with `up`.
|
|
6
7
|
|
package/docs/setup.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Setup plan: operator, worker and application
|
|
2
|
+
|
|
3
|
+
Use this plan for a new installation or when moving an existing Factory to a
|
|
4
|
+
worker machine. Complete the applicable checkpoints in order and record the
|
|
5
|
+
result in a **private** copy of the checklist below. The plan applies to any
|
|
6
|
+
operator/worker names and any suitable private network; it requires no personal
|
|
7
|
+
context system, particular VPN provider or Factory source checkout.
|
|
8
|
+
|
|
9
|
+
The operator owns access and infrastructure choices. Factory maintainers own
|
|
10
|
+
this plan and the linked command guides and update them with behavior changes.
|
|
11
|
+
Paths beginning `/private/state` or `/absolute/path` below are placeholders;
|
|
12
|
+
replace them with user-owned absolute directories outside the application and
|
|
13
|
+
installed package.
|
|
14
|
+
|
|
15
|
+
## 1. Choose the scope and hosts
|
|
16
|
+
|
|
17
|
+
| Choice | Record before installation |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Method only or runtime | Method export needs no Docker, background service or model |
|
|
20
|
+
| Operator/client | Local machine, user and how the dashboard will be opened |
|
|
21
|
+
| Worker | Linux/systemd for managed controllers; macOS can use manual `up` |
|
|
22
|
+
| Applications | Canonical repository, branch, preserved WIP and responsible owner |
|
|
23
|
+
| Runtime | Stable Node executable (22.13+), Git, Docker, CPU/RAM/disk budget |
|
|
24
|
+
| State | Private state path and unused loopback port for each installation |
|
|
25
|
+
| Inference | Provider/model, credential reference, job image and network path |
|
|
26
|
+
| Automation | Which controllers may start, update policy and who may submit work |
|
|
27
|
+
| Recovery | Private backup location, retained runtime/image and recovery contact |
|
|
28
|
+
|
|
29
|
+
One installation owns one repository and port. A synthetic qualification
|
|
30
|
+
installation can provide a running dashboard while product controllers remain
|
|
31
|
+
stopped. There is no multi-project controller or second scheduler hidden in
|
|
32
|
+
this plan. Keep unrelated personal agent configuration on its existing host.
|
|
33
|
+
|
|
34
|
+
For method-only adoption, run `software-defence-factory kit --output NEW_DIRECTORY`
|
|
35
|
+
and follow [the adoption guide](../kit/README.md). The remaining host/runtime
|
|
36
|
+
steps apply only when using Factory's optional controller.
|
|
37
|
+
|
|
38
|
+
## 2. Establish host access and boot prerequisites
|
|
39
|
+
|
|
40
|
+
Use an unprivileged operator account. Check `node --version`, `git --version`
|
|
41
|
+
and `docker info` from the actual login/SSH session. Install dependencies using
|
|
42
|
+
the host's supported method. For a Linux worker, Docker, SSH and any private
|
|
43
|
+
network client must start at boot; inspect their actual unit names instead of
|
|
44
|
+
assuming every distribution uses the same service names.
|
|
45
|
+
|
|
46
|
+
For remote access:
|
|
47
|
+
|
|
48
|
+
1. Establish a reachable private address, including across networks if needed.
|
|
49
|
+
2. Enroll the worker's verified SSH host key and configure key authentication.
|
|
50
|
+
3. Create an SSH alias such as `factory-worker`; verify
|
|
51
|
+
`ssh -o BatchMode=yes factory-worker 'id -un'` from the operator machine.
|
|
52
|
+
4. Verify firewall/interface scope. Keep the dashboard on loopback; do not
|
|
53
|
+
expose it publicly or disable host-key checking to make the tunnel work.
|
|
54
|
+
|
|
55
|
+
Administrator access is a separate host choice. Installing/running Factory user
|
|
56
|
+
services does **not** require root or unrestricted passwordless sudo. If the
|
|
57
|
+
owner deliberately chooses passwordless administration, inspect `sudo -n -l`
|
|
58
|
+
for the intended `NOPASSWD` policy and repeat the permitted command after a
|
|
59
|
+
fresh reboot. A successful `sudo -n` command can merely reuse cached
|
|
60
|
+
credentials. A missing rule must be installed by an authenticated administrator;
|
|
61
|
+
record that remaining step without blocking unprivileged Factory operation.
|
|
62
|
+
|
|
63
|
+
Record disk unlock, login and power behavior explicitly. Linux user lingering
|
|
64
|
+
can start services without desktop login **after the OS and home are available**;
|
|
65
|
+
it cannot unlock an encrypted disk. A sleeping laptop is not an available
|
|
66
|
+
worker. Choose AC/battery/sleep behavior with the owner; do not disable disk
|
|
67
|
+
security or change power policy as a side effect of Factory setup.
|
|
68
|
+
|
|
69
|
+
Checkpoint: noninteractive SSH (when needed), Docker and the chosen Node binary
|
|
70
|
+
work, and required host dependencies have a documented startup/recovery owner.
|
|
71
|
+
|
|
72
|
+
## 3. Install the package and qualify the runtime
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
npm install --global software-defence-factory
|
|
76
|
+
software-defence-factory --version
|
|
77
|
+
software-defence-factory help
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use a user-writable npm prefix or the existing Node manager; do not turn the
|
|
81
|
+
controller into a root process to work around installation permissions. For
|
|
82
|
+
example, Linux users choosing `--prefix "$HOME/.local"` must also make
|
|
83
|
+
`$HOME/.local/bin` available in their login PATH. `npx` uses the same package;
|
|
84
|
+
managed services retain a runtime outside its cache. Keep the service's recorded
|
|
85
|
+
Node executable available. See [installation and updates](npm.md).
|
|
86
|
+
|
|
87
|
+
Use a **separate synthetic state and unused port** to exercise the runtime:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
software-defence-factory demo --state /private/state/runtime-proof --port 7345
|
|
91
|
+
# Inspect and finish the sample handoff before qualification.
|
|
92
|
+
software-defence-factory qualify --state /private/state/runtime-proof
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
These commands deliberately create synthetic jobs, including failed/interrupted
|
|
96
|
+
attempts. Never use application state for `demo` or `qualify`. They make no model
|
|
97
|
+
calls and prove neither model quality nor application readiness. Preserve the
|
|
98
|
+
qualification record; stop this controller unless it is the selected dashboard.
|
|
99
|
+
|
|
100
|
+
## 4. Prepare each application and inference profile
|
|
101
|
+
|
|
102
|
+
Preserve existing commits, branches, uncommitted work and licenses before moving
|
|
103
|
+
anything. Verify the canonical GitHub origin and main branch's tracking target;
|
|
104
|
+
a fork may still track its upstream product. Move application sources into the
|
|
105
|
+
chosen workspace, not into the npm package or private runtime state.
|
|
106
|
+
|
|
107
|
+
Before admitting development work, establish:
|
|
108
|
+
|
|
109
|
+
- Reproducible toolchain/dependency pins and an actual build/check command.
|
|
110
|
+
- A compatible job image for native libraries, browser/mobile tools or custom
|
|
111
|
+
model adapters; the standard image does not supply every application stack.
|
|
112
|
+
- Meaningful checks in GitHub CI on the selected revision, plus the intended
|
|
113
|
+
review/branch policy. Record plan/access limits if enforcement is unavailable.
|
|
114
|
+
- Applicable application instructions, design/scope, resource limits, secret
|
|
115
|
+
references and a clear delivery destination. Keep unfinished WIP separate
|
|
116
|
+
until intentionally integrated; jobs clone committed source only.
|
|
117
|
+
|
|
118
|
+
Configure a new installation using [the quickstart](quickstart.md):
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
software-defence-factory init --repo /absolute/path/to/app --agent pi --check "npm ci && npm test" --state /private/state/my-app --port 7331
|
|
122
|
+
software-defence-factory install --state /private/state/my-app
|
|
123
|
+
software-defence-factory doctor --state /private/state/my-app
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Replace the agent/check/paths with the accepted application profile. `install`
|
|
127
|
+
builds the standard image: do not use it to overwrite an existing custom image
|
|
128
|
+
selection. Follow the application image's own build/pinning procedure instead.
|
|
129
|
+
`init` does not edit the app, install personal skills or submit a task. Runtime
|
|
130
|
+
jobs receive the bundled method and six skills automatically.
|
|
131
|
+
|
|
132
|
+
For a local model, verify the existing model service, intended model name and
|
|
133
|
+
its startup. Test the model API from a disposable container using the **selected
|
|
134
|
+
job image and network**. Host `127.0.0.1` inside a container is not the host's
|
|
135
|
+
loopback. Any host bridge/proxy and narrow firewall rule are explicit machine
|
|
136
|
+
infrastructure; they need their own startup and reboot checks. A bridge address may appear
|
|
137
|
+
after the user service manager starts; configure retry/readiness and verify
|
|
138
|
+
recovery rather than assuming startup order from enablement alone. Avoid duplicate
|
|
139
|
+
model servers, public listeners, Docker socket mounts or whole account folders.
|
|
140
|
+
Cloud inference likewise needs a real provider/model connectivity check without
|
|
141
|
+
printing credentials. A model-list/health response is connectivity evidence;
|
|
142
|
+
qualifying model output requires a separately accepted bounded task.
|
|
143
|
+
|
|
144
|
+
Checkpoint: record the exact source revision, image ID, check command, resource
|
|
145
|
+
limits, inference connectivity and CI result. Keep product controllers stopped
|
|
146
|
+
until their tasks are explicitly ready to run.
|
|
147
|
+
|
|
148
|
+
## 5. Enable only the intended background services
|
|
149
|
+
|
|
150
|
+
A newly initialized state has no jobs. Before adopting older state, establish
|
|
151
|
+
that its queue may resume; starting **any** controller executes queued work.
|
|
152
|
+
If queue ownership/state is uncertain, reconcile it before enabling autostart.
|
|
153
|
+
|
|
154
|
+
On the Linux worker, select the state that should stay available:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
software-defence-factory stop --state /private/state/runtime-proof
|
|
158
|
+
software-defence-factory service install --state /private/state/runtime-proof
|
|
159
|
+
software-defence-factory service status --state /private/state/runtime-proof
|
|
160
|
+
software-defence-factory service updates --auto on
|
|
161
|
+
software-defence-factory service updates --auto status
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Follow [services](services.md) for user lingering, existing Docker group
|
|
165
|
+
membership, logs, stop/start, uninstall and maintenance recovery. A user manager
|
|
166
|
+
started before Docker group membership changed may need `--group docker`; this
|
|
167
|
+
applies an existing group and grants no new membership. Enable lingering only
|
|
168
|
+
for the intended account through the host's administrator.
|
|
169
|
+
|
|
170
|
+
On the operator machine, stop any old manual tunnel, then:
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
software-defence-factory tunnel install --host factory-worker --port 7345
|
|
174
|
+
software-defence-factory tunnel status --host factory-worker --port 7345
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Use the actual selected dashboard port on both sides. macOS tunnels start at
|
|
178
|
+
user login; Linux uses its user service manager. Open `http://127.0.0.1:7345`.
|
|
179
|
+
This is the worker's loopback dashboard forwarded through SSH.
|
|
180
|
+
|
|
181
|
+
Managed daily updates reserve idle controllers and preserve the prior running
|
|
182
|
+
set; they defer when busy and attempt rollback if the new runtime is unhealthy.
|
|
183
|
+
A deliberate `service stop` leaves boot enablement in place: use `uninstall`
|
|
184
|
+
when a controller must also remain disabled across reboots. Preserve private
|
|
185
|
+
state and previous releases. The timer does not rebuild application images,
|
|
186
|
+
start product tasks, change a model or publish application changes.
|
|
187
|
+
|
|
188
|
+
## 6. Prove reboot recovery and hand over
|
|
189
|
+
|
|
190
|
+
Choose a reboot window with disk unlock/recovery available. Save a private
|
|
191
|
+
baseline of the boot ID (`cat /proc/sys/kernel/random/boot_id`), runtime version,
|
|
192
|
+
job IDs/states/attempts, selected enabled services and paused installations.
|
|
193
|
+
After the owner reboots/unlocks the worker, check **before manually starting
|
|
194
|
+
anything**:
|
|
195
|
+
|
|
196
|
+
- SSH returns and a changed boot ID confirms a new boot.
|
|
197
|
+
- Docker, private network and model/proxy services are healthy, with no relevant
|
|
198
|
+
failed units or repeated restart loop. Inspect their current-boot logs.
|
|
199
|
+
- `service status --state PATH` reports enabled/running/healthy, the intended
|
|
200
|
+
runtime version and no unexpected maintenance reservation.
|
|
201
|
+
- The update timer is enabled and has a next execution time.
|
|
202
|
+
- The operator's tunnel reconnects and the dashboard responds at the same URL.
|
|
203
|
+
- Job history is unchanged and intentionally disabled product controllers have
|
|
204
|
+
no listeners or executor processes. Probe model connectivity from the job
|
|
205
|
+
container again without starting a product agent.
|
|
206
|
+
- The intended administrator policy still works, if that capability was chosen.
|
|
207
|
+
|
|
208
|
+
Record actual observations and failures separately. An observed boot after
|
|
209
|
+
manual unlock/login does not prove an unattended cold boot; a worker reboot
|
|
210
|
+
does not prove operator-machine login startup. Process crash recovery and tests
|
|
211
|
+
across two physical networks are also distinct checks. Use [recovery](recovery.md)
|
|
212
|
+
and [service recovery](services.md#recovery-and-proof-limits) for failures; do not
|
|
213
|
+
start a second controller or clear unknown process locks to make status green.
|
|
214
|
+
|
|
215
|
+
Copy this private completion record into the installation's handoff:
|
|
216
|
+
|
|
217
|
+
| Checkpoint | Result | Evidence / remaining action |
|
|
218
|
+
| --- | --- | --- |
|
|
219
|
+
| Host roles, owner, source and private state selected | Pending | |
|
|
220
|
+
| SSH, Docker, Node and host startup prerequisites | Pending | |
|
|
221
|
+
| Synthetic runtime qualification | Pending | |
|
|
222
|
+
| Application image, real checks/CI and preserved WIP | Pending | |
|
|
223
|
+
| Inference path and chosen model | Pending | |
|
|
224
|
+
| Controller/tunnel/timer installation and recovery | Pending | |
|
|
225
|
+
| Worker reboot after required unlock/login | Pending | |
|
|
226
|
+
| Operator login recovery / separate networks | Pending | Record separately |
|
|
227
|
+
| History and intentionally stopped products preserved | Pending | |
|
|
228
|
+
| Backups, logs, stop/update/rollback owner and guide | Pending | |
|
|
229
|
+
| First bounded application task | Not started | Separate task authority and proof |
|
|
230
|
+
|
|
231
|
+
Use Pass, Fail or Not applicable with a reason; never infer success from an
|
|
232
|
+
installed file. Keep host identities, credentials, raw logs and customer details
|
|
233
|
+
out of public issues and package contents. A ready worker is only the foundation:
|
|
234
|
+
follow [the method](../kit/README.md#first-real-task) for the first explicitly
|
|
235
|
+
accepted application task and revision-bound checks/review/handoff.
|
package/kit/installation.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
| Control surface | Existing issue/check/PR workflow unless otherwise selected |
|
|
11
11
|
| Harness, version, model/provider and billing | Unselected |
|
|
12
12
|
| Execution environment and necessary tools | Files, Git, shell and tests; browser for UI; other tools as needed |
|
|
13
|
+
| Worker boot and operator login | Disk unlock, SSH/network/Docker/model startup, selected services, timer and observed reboot evidence; not applicable for method-only use |
|
|
13
14
|
| Start, stop, routing owner and recovery | Manual until automation is qualified; one owner per job |
|
|
14
15
|
| Authority and allowed network/credential references | Identify permissions without key values |
|
|
15
16
|
| Time, concurrency, attempts and actual provider stop limits | Unknown until exercised |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "software-defence-factory",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Scoped software delivery and defence investigations with isolated jobs, evidence and review",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"scripts/export-kit.mjs",
|
|
30
30
|
"scripts/probe-platform.mjs",
|
|
31
31
|
"docs/npm.md",
|
|
32
|
+
"docs/setup.md",
|
|
32
33
|
"docs/services.md",
|
|
33
34
|
"docs/recovery.md",
|
|
34
35
|
"docs/quickstart.md",
|