229c938a525197c2fe17efc49b64fd98ee7e50d8273b614388269ff15c04949e1import log from "../../seed/log.js";
2import { renderTermsPage, renderPrivacyPage } from "./pages.js";
3
4export async function init(core) {
5 try {
6 const { getExtension } = await import("../loader.js");
7 const htmlExt = getExtension("html-rendering");
8 if (htmlExt?.pageRouter) {
9 htmlExt.pageRouter.get("/terms", (req, res) => {
10 res.setHeader("Content-Type", "text/html");
11 res.send(renderTermsPage());
12 });
13 htmlExt.pageRouter.get("/privacy", (req, res) => {
14 res.setHeader("Content-Type", "text/html");
15 res.send(renderPrivacyPage());
16 });
17 }
18
19 } catch {}
20
21 log.info("Legal", "Terms and Privacy pages loaded");
22 return {};
23}
241export default {
2 name: "legal",
3 version: "1.0.3",
4 builtFor: "TreeOS",
5 description:
6 "Terms of Service and Privacy Policy pages. Renders on /terms and /privacy. " +
7 "The register page conditionally shows agreement text and modals when this " +
8 "extension is installed. Without it, no legal pages, no agreement checkbox.",
9
10 needs: {},
11
12 optional: {
13 extensions: ["html-rendering", "treeos-base"],
14 },
15
16 provides: {
17 models: {},
18 routes: false,
19 tools: false,
20 jobs: false,
21 orchestrator: false,
22 energyActions: {},
23 sessionTypes: {},
24 env: [],
25 cli: [],
26 hooks: { fires: [], listens: [] },
27 },
28};
291import { page } from "../html-rendering/html/layout.js";
2import { baseStyles, responsiveBase } from "../html-rendering/html/baseStyles.js";
3
4const legalCss = `
5 ${baseStyles}
6 ${responsiveBase}
7 .legal-container {
8 max-width: 720px;
9 margin: 0 auto;
10 padding: 40px 24px;
11 color: rgba(255,255,255,0.8);
12 font-size: 15px;
13 line-height: 1.9;
14 }
15 .legal-container h1 {
16 font-size: 28px;
17 font-weight: 700;
18 color: white;
19 margin-bottom: 24px;
20 }
21 .legal-container h2 {
22 font-size: 18px;
23 font-weight: 600;
24 color: white;
25 margin: 28px 0 12px;
26 }
27 .legal-container p {
28 margin-bottom: 16px;
29 color: rgba(255,255,255,0.7);
30 }
31 .legal-container ul {
32 margin: 12px 0 16px 24px;
33 color: rgba(255,255,255,0.65);
34 }
35 .legal-container li {
36 margin-bottom: 6px;
37 }
38 .legal-container a {
39 color: rgba(74, 222, 128, 0.9);
40 }
41`;
42
43export function renderTermsPage() {
44 return page({
45 title: "Terms of Service",
46 css: legalCss,
47 body: `
48 <div class="legal-container">
49 <h1>Terms of Service</h1>
50 <p>Last updated: March 2026</p>
51
52 <h2>1. Acceptance</h2>
53 <p>By using this TreeOS land, you agree to these terms. If you do not agree, do not use the service.</p>
54
55 <h2>2. The Service</h2>
56 <p>TreeOS is an open source operating system for AI agents. This land is an instance operated by its owner. Your data is stored on this land's database. The land operator controls what extensions are installed and how the service runs.</p>
57
58 <h2>3. Your Data</h2>
59 <p>You own your data. Trees, notes, and contributions belong to you. The land operator stores your data to provide the service. You can export your data at any time using the seed-export extension if installed.</p>
60
61 <h2>4. AI Usage</h2>
62 <p>This service uses AI language models. AI responses are generated and may contain errors. Do not rely on AI output for medical, legal, or financial decisions. The land operator configures which AI models are used.</p>
63
64 <h2>5. Acceptable Use</h2>
65 <p>Do not use this service to:</p>
66 <ul>
67 <li>Store illegal content</li>
68 <li>Attempt to access other users' data</li>
69 <li>Abuse API rate limits or consume excessive resources</li>
70 <li>Reverse engineer the security mechanisms</li>
71 </ul>
72
73 <h2>6. Termination</h2>
74 <p>The land operator may terminate your account at any time. You may delete your account at any time.</p>
75
76 <h2>7. Open Source</h2>
77 <p>TreeOS is licensed under AGPL-3.0. The source code is available at <a href="https://github.com/taborgreat/create-treeos">GitHub</a>.</p>
78
79 <h2>8. No Warranty</h2>
80 <p>This service is provided as-is. No guarantees of uptime, data preservation, or AI accuracy.</p>
81 </div>`,
82 js: "",
83 });
84}
85
86export function renderPrivacyPage() {
87 return page({
88 title: "Privacy Policy",
89 css: legalCss,
90 body: `
91 <div class="legal-container">
92 <h1>Privacy Policy</h1>
93 <p>Last updated: March 2026</p>
94
95 <h2>1. What We Collect</h2>
96 <ul>
97 <li>Username and password (password is hashed with bcrypt)</li>
98 <li>Email address (if the email extension is installed)</li>
99 <li>Tree content: nodes, notes, contributions, metadata</li>
100 <li>AI conversation history (stored per session)</li>
101 <li>Usage patterns (if inverse-tree or analytics extensions are installed)</li>
102 </ul>
103
104 <h2>2. How We Use It</h2>
105 <p>Your data is used to provide the service. Tree content is sent to AI language models for conversation. The land operator configures which models and endpoints are used.</p>
106
107 <h2>3. Data Storage</h2>
108 <p>All data is stored in the land's MongoDB database. Data stays on the land operator's infrastructure unless federation (Canopy) is enabled, in which case data may be shared with peered lands as configured.</p>
109
110 <h2>4. Third Parties</h2>
111 <p>AI model providers receive your conversation content. The land operator chooses which providers to use. No data is sold to third parties.</p>
112
113 <h2>5. Your Rights</h2>
114 <ul>
115 <li>Access your data through the API or HTML interface</li>
116 <li>Export your trees using seed-export</li>
117 <li>Delete your account and data</li>
118 <li>Request information about what data is stored</li>
119 </ul>
120
121 <h2>6. Cookies</h2>
122 <p>A JWT authentication cookie is used for login sessions. No tracking cookies. No analytics cookies unless explicitly installed by the land operator.</p>
123
124 <h2>7. Contact</h2>
125 <p>Contact the land operator for privacy questions.</p>
126 </div>`,
127 js: "",
128 });
129}
130
| Version | Published | Downloads |
|---|---|---|
| 1.0.3 | 38d ago | 0 |
| 1.0.2 | 47d ago | 0 |
| 1.0.1 | 47d ago | 0 |
| 1.0.0 | 48d ago | 0 |
treeos ext star legal
Post comments from the CLI: treeos ext comment legal "your comment"
Max 3 comments per extension. One star and one flag per user.
Loading comments...