Skip to content

Commit 3d35bbd

Browse files
mdhellerclaude
andcommitted
Merge main into feat/office-quality-gates
Union office.py imports (keep branch's validate_ooxml_artifact + main's runtime contracts); integrate branch's office quality-gate commands, ooxml validation, and CLI tests. Restores wrongly-closed feature content. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2 parents 33502cf + 021a6f6 commit 3d35bbd

70 files changed

Lines changed: 7027 additions & 9 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: operation-conformance
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
smoke:
11+
name: SourceOS operation conformance smoke
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.12'
21+
22+
- name: Run structural smoke validation
23+
run: |
24+
python3 tools/sourceos_operation_conformance.py \
25+
--examples-dir tests/fixtures/workspace-operation \
26+
--structural-only

.sourceos/manifest.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"repo": "SourceOS-Linux/sourceos-devtools",
3+
"domain": "tooling",
4+
"specVersion": "0.1.0",
5+
"ownedSchemas": [],
6+
"syncEngines": [],
7+
"sourceChannels": [],
8+
"policyClasses": [
9+
"high"
10+
],
11+
"auditEvents": [
12+
"devtools.contract.validated",
13+
"devtools.repo.scanned"
14+
],
15+
"dangerousSurfaces": [
16+
"devtools.schema.validation_bypass",
17+
"devtools.repo_scan.incomplete"
18+
],
19+
"authorityRepos": [
20+
"SourceOS-Linux/sourceos-spec"
21+
],
22+
"notes": "Developer/operator tooling surface for SourceOS contract validation, repo scanning, graph doctor, sync doctor, and policy explanation commands."
23+
}

Makefile

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.PHONY: validate test
1+
.PHONY: validate test scan-local-persistence validate-local-agents validate-local-agent-templates check-local-agent-drift validate-reasoning-cli validate-portable-ai validate-packaging
22

3-
validate: test
3+
validate: test scan-local-persistence validate-local-agents validate-local-agent-templates check-local-agent-drift validate-reasoning-cli validate-portable-ai validate-packaging
44
@test -f README.md
55
@test -f AGENTS.md
66
@test -f .github/copilot-instructions.md
@@ -11,3 +11,29 @@ validate: test
1111
test:
1212
@python3 -m pip install --user jsonschema >/dev/null
1313
@python3 -m unittest discover -s tests -v
14+
15+
scan-local-persistence:
16+
@python3 scripts/scan_local_persistence.py . --fail-on none
17+
18+
validate-local-agents:
19+
@python3 scripts/validate_local_agents.py .
20+
21+
validate-local-agent-templates:
22+
@python3 scripts/validate_local_agent_templates.py .
23+
24+
check-local-agent-drift:
25+
@python3 scripts/check_local_agent_registry_drift.py . --fail-on high
26+
27+
validate-reasoning-cli:
28+
@python3 bin/sourceosctl reasoning validate tests/fixtures/reasoning/deterministic >/dev/null
29+
@python3 bin/sourceosctl reasoning inspect tests/fixtures/reasoning/deterministic >/dev/null
30+
@python3 bin/sourceosctl reasoning replay-plan tests/fixtures/reasoning/deterministic >/dev/null
31+
@python3 bin/sourceosctl reasoning events tests/fixtures/reasoning/deterministic >/dev/null
32+
33+
validate-portable-ai:
34+
@python3 bin/sourceosctl portable-ai profiles >/dev/null
35+
@python3 bin/sourceosctl portable-ai preflight /tmp/SOURCEOS_AI --profile tiny-router >/dev/null
36+
@python3 bin/sourceosctl portable-ai prepare /tmp/SOURCEOS_AI --profile tiny-router --dry-run >/dev/null
37+
38+
validate-packaging:
39+
@python3 scripts/validate_packaging.py

README.md

Lines changed: 95 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ It should contain:
1616
- lab/profile selection utilities;
1717
- local model-service client helpers;
1818
- model-router client utilities;
19+
- Network Door, Firewall Door, Mesh Door, BYOM provider, and Native Assistant Door plan/probe helpers;
1920
- guardrail/eval/evidence helpers;
2021
- agent sandbox/run helpers;
22+
- Local Model Door runtime detection and route planning helpers;
2123
- Agent Machine local mount and secure host-interface helpers;
2224
- Office Plane dry-run, guarded execution, inspection, and evidence helpers;
2325
- fingerprint and proof bundle tools;
@@ -34,7 +36,10 @@ It should not contain:
3436
- model-router backend;
3537
- web control plane backend;
3638
- SourceOS image build state;
37-
- secrets, tokens, credentials, private keys, or device-specific enrollment secrets.
39+
- secrets, tokens, credentials, private keys, or device-specific enrollment secrets;
40+
- firewall mutation engines;
41+
- service mesh installers;
42+
- native assistant runtime adapters.
3843

3944
## sourceosctl CLI
4045

@@ -60,6 +65,16 @@ sourceosctl [--version] <command> [<subcommand>] [options]
6065
| `sourceosctl fingerprint collect --dry-run` | Print environment fingerprint fields (dry-run only) |
6166
| `sourceosctl ai labs list` | List available AI labs (read-only) |
6267
| `sourceosctl agents sandbox plan --dry-run` | Print agent sandbox plan (dry-run only) |
68+
| `sourceosctl local-model doctor` | Inspect local model runtime and installed models without pulling weights or inference |
69+
| `sourceosctl local-model profiles` | List SourceOS Local Model Door profile refs |
70+
| `sourceosctl local-model plan --profile local-llama32-1b` | Render local model runtime plan without installing or running models |
71+
| `sourceosctl local-model route --task-class office-assist` | Render hash-only model route decision under local-first policy |
72+
| `sourceosctl local-model evidence inspect <path>` | Inspect local model route evidence JSON |
73+
| `sourceosctl network doctor` | Inspect Network Door contract posture without changing firewall, mesh, or provider state |
74+
| `sourceosctl network plan --destination <label>` | Render a hash-only Network Door route plan |
75+
| `sourceosctl network provider` | Render a BYOM / external model provider plan without contacting the provider |
76+
| `sourceosctl network evidence inspect <path>` | Inspect Network Door evidence JSON |
77+
| `sourceosctl native-assistant plan` | Render a native assistant bridge plan without invoking host assistant APIs |
6378
| `sourceosctl agent-machine mounts plan` | Render Agent Machine local mount plan for dev/docs/downloads roots (dry-run) |
6479
| `sourceosctl agent-machine mounts init --dry-run` | Render mount initialization plan; no directories or mounts are created |
6580
| `sourceosctl agent-machine mounts init --execute --policy-ok` | Create only scoped local output/download directories and emit AgentMachineMountEvidence |
@@ -74,6 +89,11 @@ sourceosctl [--version] <command> [<subcommand>] [options]
7489
| `sourceosctl office convert <path> --to <format> --execute --policy-ok` | Run guarded local LibreOffice conversion and emit OfficeArtifactEvidence |
7590
| `sourceosctl office inspect <path>` | Inspect a local office artifact file and hash it |
7691
| `sourceosctl office evidence inspect <path>` | Inspect Office Plane evidence JSON (read-only) |
92+
| `sourceosctl operation conformance --contracts-dir ../prophet-core-contracts` | Run Workspace Operation fixture bundle conformance checks |
93+
| `sourceosctl operation validate-fixture <path>` | Validate one Workspace Operation fixture |
94+
| `sourceosctl operation replay-fixture <output> --surface terminal-command\|browser-capture\|local-agent-execution` | Generate a local replay fixture starter |
95+
| `sourceosctl operation scaffold-adapter <output-dir>` | Scaffold starter adapter skeletons |
96+
| `sourceosctl diagnostics redact <input> --output <output>` | Export redacted diagnostics (cookies/tokens/keys/IDs/prompts/policy snippets) |
7797

7898
### Running from the repo
7999

@@ -89,6 +109,16 @@ python3 bin/sourceosctl release inspect-archive fixtures/nlboot_release_valid
89109
python3 bin/sourceosctl fingerprint collect --dry-run
90110
python3 bin/sourceosctl ai labs list
91111
python3 bin/sourceosctl agents sandbox plan --dry-run
112+
python3 bin/sourceosctl local-model doctor
113+
python3 bin/sourceosctl local-model profiles
114+
python3 bin/sourceosctl local-model plan --profile local-llama32-1b
115+
python3 bin/sourceosctl local-model route --task-class office-assist --prompt "local prompt text is hashed only"
116+
python3 bin/sourceosctl network doctor
117+
python3 bin/sourceosctl network plan --destination models.enterprise.example
118+
python3 bin/sourceosctl network plan --enterprise --mesh --allow-listed --destination models.enterprise.example
119+
python3 bin/sourceosctl network provider --provider-class openai-compatible --owner user
120+
python3 bin/sourceosctl native-assistant plan --operation open-workroom
121+
python3 bin/sourceosctl native-assistant plan --operation create-office-artifact --prompt "local prompt text is hashed only"
92122
python3 bin/sourceosctl agent-machine mounts plan
93123
python3 bin/sourceosctl agent-machine mounts init --dry-run
94124
python3 bin/sourceosctl agent-machine mounts init --execute --policy-ok --evidence-out ./mount-evidence.json
@@ -102,8 +132,69 @@ python3 bin/sourceosctl office generate --execute --policy-ok --artifact-type sp
102132
python3 bin/sourceosctl office generate --execute --policy-ok --artifact-type slide-deck --format pptx --title "Demo Deck" --evidence-out ./office-pptx-evidence.json
103133
python3 bin/sourceosctl office convert ./example.docx --to pdf --dry-run
104134
python3 bin/sourceosctl office convert ./example.docx --to pdf --execute --policy-ok --evidence-out ./office-convert-evidence.json
135+
python3 bin/sourceos operation conformance --contracts-dir ../prophet-core-contracts
136+
python3 bin/sourceos operation validate-fixture tests/fixtures/workspace-operation/minimal-operation.json --structural-only
137+
python3 bin/sourceos operation replay-fixture ./tmp-operation-replay.json --surface terminal-command
138+
python3 bin/sourceos operation scaffold-adapter ./tmp-adapter
139+
python3 bin/sourceos diagnostics redact ./diagnostic.log --output ./diagnostic.redacted.log
105140
```
106141

142+
### Local Model Door defaults
143+
144+
The Local Model Door aligns with:
145+
146+
- `SourceOS-Linux/sourceos-model-carry` for local model profiles;
147+
- `SocioProphet/model-router` for routing;
148+
- `SocioProphet/model-governance-ledger` for personal tuning contracts;
149+
- `SociOS-Linux/socios` for opt-in personalization orchestration.
150+
151+
Default profiles:
152+
153+
| Profile key | Model | Role |
154+
| --- | --- | --- |
155+
| `local-llama32-1b` | `llama3.2:1b` | laptop-safe router, triage, summarization, rewrite, Office assist |
156+
| `local-llama32-3b` | `llama3.2:3b` | quality local fallback |
157+
158+
The Local Model Door does **not** pull model weights, start Ollama, run inference, send prompts off-device, or authorize tool use. `local-model route --prompt ...` emits only a SHA-256 prompt hash.
159+
160+
### Network Door, Mesh Door, BYOM, and Native Assistant Door defaults
161+
162+
The Network/Assistant Door slice aligns with `SourceOS-Linux/sourceos-spec`:
163+
164+
- `NetworkAccessProfile`
165+
- `FirewallBindingProfile`
166+
- `MeshBindingProfile`
167+
- `ExternalModelProviderProfile`
168+
- `NativeAssistantBridgeProfile`
169+
170+
Default refs:
171+
172+
| Purpose | Ref |
173+
| --- | --- |
174+
| Enterprise/user network stack | `urn:srcos:network-access-profile:enterprise-and-user-default` |
175+
| User firewall profile | `urn:srcos:firewall-binding-profile:macos-lulu-user-default` |
176+
| Enterprise firewall profile | `urn:srcos:firewall-binding-profile:enterprise-gateway-default` |
177+
| Istio/Admiral-style mesh profile | `urn:srcos:mesh-binding-profile:istio-egress-default` |
178+
| User BYOM OpenAI-compatible provider profile | `urn:srcos:external-model-provider-profile:user-openai-compatible` |
179+
| Apple App Intents native assistant bridge profile | `urn:srcos:native-assistant-bridge-profile:apple-app-intents-default` |
180+
181+
The Network Door does **not** mutate firewall rules, install mesh components, contact external model providers, store credentials, or send prompts. Destination labels are represented as SHA-256 hashes in route plans.
182+
183+
The Native Assistant Door does **not** invoke Siri, App Intents, Shortcuts, Android intents, Windows shell integrations, browser extensions, or MCP/native bridge transports. It renders a bridge plan with prompt text redacted to a SHA-256 hash when provided.
184+
185+
Default policy posture:
186+
187+
- default egress is denied;
188+
- BYOM provider auth must be a reference, never inline;
189+
- enterprise firewall denies have precedence over user allows;
190+
- user firewall profiles may be stricter than enterprise profiles;
191+
- mesh binding and firewall binding are complementary, not interchangeable;
192+
- prompt egress is denied by default;
193+
- native assistant side effects require user confirmation;
194+
- raw app database access is denied by default.
195+
196+
See `docs/integration/network-native-assistant-door.md`.
197+
107198
### Agent Machine local mount defaults
108199

109200
The first Agent Machine mount slice aligns with the SourceOS contracts in `SourceOS-Linux/sourceos-spec`:
@@ -178,13 +269,15 @@ M1 is repo maturity and install surface definition:
178269
- `SociOS-Linux/nlboot`: boot/recovery client and evidence records.
179270
- `SourceOS-Linux/sourceos-spec`: canonical SourceOS schemas and contracts.
180271
- `SourceOS-Linux/sourceos-boot`: SourceOS boot/recovery integration.
272+
- `SourceOS-Linux/sourceos-model-carry`: local model profiles and carry-layer service refs.
181273
- `SourceOS-Linux/agent-term`: terminal-native SourceOS operator ChatOps console.
182274
- `SociOS-Linux/workstation-contracts`: workstation/CI conformance contracts and IPC receipts.
275+
- `SociOS-Linux/socios`: opt-in automation and personalization orchestration.
183276
- `SocioProphet/prophet-workspace`: workspace product semantics, Professional Workrooms, and OfficeArtifact contracts.
184277
- `SocioProphet/homebrew-prophet`: Homebrew install formulae.
185278
- `SocioProphet/model-router`: governed model/service routing.
186279
- `SocioProphet/guardrail-fabric`: guardrail policy client integration.
187-
- `SocioProphet/model-governance-ledger`: evidence and promotion records.
280+
- `SocioProphet/model-governance-ledger`: evidence, consent, evaluation, promotion, and personalization governance records.
188281
- `SocioProphet/agent-registry`: governed agent identity/tool-grant contracts.
189282
- `SocioProphet/agentplane`: governed execution, placement, run, replay, and evidence.
190283

@@ -199,4 +292,3 @@ The validation target runs the unit test suite and checks repository metadata. A
199292
```bash
200293
make test # run tests only
201294
```
202-

bin/sourceos

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python3
2+
"""sourceos alias entry-point script."""
3+
4+
import os
5+
import runpy
6+
import sys
7+
8+
repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
9+
sys.argv[0] = "sourceos"
10+
runpy.run_path(os.path.join(repo_root, "bin", "sourceosctl"), run_name="__main__")

bin/sourceos-agent

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python3
2+
"""sourceos-agent entry-point script."""
3+
import os
4+
import sys
5+
6+
# Allow running directly from the repo root without installing.
7+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8+
9+
from sourceosctl.commands.local_agent_registry_cli import main
10+
11+
sys.exit(main())

bin/sourceos-portable-ai

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
"""Standalone SourceOS Portable AI Kit CLI."""
3+
4+
from __future__ import annotations
5+
6+
import os
7+
import sys
8+
9+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10+
11+
from sourceosctl.commands.portable_ai_cli import main
12+
13+
if __name__ == "__main__":
14+
sys.exit(main())

bin/sourceosctl

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,82 @@ import os
66
# Allow running directly from the repo root without installing.
77
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
88

9+
# Lightweight plugin routing for newer command groups while keeping the core
10+
# argparse surface stable. These command groups are non-mutating plan/probe
11+
# surfaces and own their own subparsers.
12+
if len(sys.argv) > 1 and sys.argv[1] == "contract":
13+
from sourceosctl.commands.contracts import contract_main
14+
15+
sys.exit(contract_main(sys.argv[2:]))
16+
17+
if len(sys.argv) > 1 and sys.argv[1] == "repo":
18+
from sourceosctl.commands.contracts import repo_main
19+
20+
sys.exit(repo_main(sys.argv[2:]))
21+
22+
if len(sys.argv) > 1 and sys.argv[1] == "estate":
23+
from sourceosctl.commands.contracts import estate_main
24+
25+
sys.exit(estate_main(sys.argv[2:]))
26+
27+
if len(sys.argv) > 1 and sys.argv[1] == "graph":
28+
from sourceosctl.commands.contracts import graph_main
29+
30+
sys.exit(graph_main(sys.argv[2:]))
31+
32+
if len(sys.argv) > 1 and sys.argv[1] == "sync":
33+
from sourceosctl.commands.contracts import sync_main
34+
35+
sys.exit(sync_main(sys.argv[2:]))
36+
37+
if len(sys.argv) > 1 and sys.argv[1] == "policy":
38+
from sourceosctl.commands.contracts import policy_main
39+
40+
sys.exit(policy_main(sys.argv[2:]))
41+
42+
if len(sys.argv) > 1 and sys.argv[1] == "reasoning":
43+
from sourceosctl.commands.reasoning import reasoning_main
44+
45+
sys.exit(reasoning_main(sys.argv[2:]))
46+
47+
if len(sys.argv) > 1 and sys.argv[1] == "operation":
48+
from sourceosctl.commands.operation import operation_main
49+
50+
sys.exit(operation_main(sys.argv[2:]))
51+
52+
if len(sys.argv) > 1 and sys.argv[1] == "diagnostics":
53+
from sourceosctl.commands.diagnostics import diagnostics_main
54+
55+
sys.exit(diagnostics_main(sys.argv[2:]))
56+
57+
if len(sys.argv) > 1 and sys.argv[1] == "network":
58+
from sourceosctl.commands.network import network_main
59+
60+
sys.exit(network_main(sys.argv[2:]))
61+
62+
if len(sys.argv) > 1 and sys.argv[1] == "native-assistant":
63+
from sourceosctl.commands.network import native_assistant_main
64+
65+
sys.exit(native_assistant_main(sys.argv[2:]))
66+
67+
if len(sys.argv) > 1 and sys.argv[1] == "portable-ai":
68+
from sourceosctl.commands.portable_ai_cli import main as portable_ai_main
69+
70+
sys.exit(portable_ai_main(sys.argv[2:]))
71+
72+
if len(sys.argv) > 1 and sys.argv[1] == "local-agent":
73+
from sourceosctl.commands.local_agent_registry_cli import main as local_agent_main
74+
75+
sys.exit(local_agent_main(sys.argv[2:]))
76+
77+
if len(sys.argv) > 2 and sys.argv[1:3] == ["doctor", "local-runtime"]:
78+
from sourceosctl.commands.local_agent_registry_cli import local_runtime_doctor
79+
80+
class _Args:
81+
pass
82+
83+
sys.exit(local_runtime_doctor(_Args()))
84+
985
from sourceosctl.cli import main
1086

11-
sys.exit(main())
87+
sys.exit(main())

0 commit comments

Comments
 (0)