diff --git a/Makefile b/Makefile index 295e219..8dda798 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,9 @@ node_modules: package-lock.json package-lock.json: package.json npm i +check-ts : javascript/index.js + @npm run check + clean: @echo "Cleaning up build artifacts..." @rm -rf $(PACKAGE_ID).s9pk $(PACKAGE_ID)_x86_64.s9pk $(PACKAGE_ID)_aarch64.s9pk $(PACKAGE_ID)_riscv64.s9pk javascript node_modules diff --git a/docs/instructions.md b/docs/instructions.md index 315002e..45b6cff 100644 --- a/docs/instructions.md +++ b/docs/instructions.md @@ -1,17 +1,15 @@ -# Instructions for Hello World on StartOS +# Maple Proxy for StartOS -Hello World is a bare bones template for bootstrapping packages for StartOS. +Maple Proxy provides a local API proxy for encrypted, privacy-preserving AI services. -## How to use the template +## Usage -1. Access [hello-world-startos](https://github.com/Start9Labs/hello-world-startos). +Once installed, Maple Proxy exposes an API endpoint that you can use to interact with Maple AI encrypted models. Maple is compatible with tools that use the OpenAI API format. -1. Click "Use this template", then "Create new repository". You must be signed into Github to see this button. +## Configuration -1. Name your repository. The name should be `[service-name]-startos`. For example, `NextCloud` is `nextcloud-startos` and `Lightning Terminal` is `lightning-terminal-startos`. +API keys can be configured through the service settings or provided per-request via the `Authorization` header. -1. For the repository description, enter "StartOS package for [Service Name]". +## Documentation -1. Make sure the repository is Public. - -1. Click "Create Repository". +For full documentation, visit the [Maple Proxy Documentation](https://blog.trymaple.ai/maple-proxy-documentation/). diff --git a/icon.png b/icon.png index 9c8bbdd..6309c9d 100644 Binary files a/icon.png and b/icon.png differ diff --git a/package-lock.json b/package-lock.json index 99287e6..4d4e3d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "hello-world-startos", "dependencies": { - "@start9labs/start-sdk": "^0.4.0-beta.46" + "@start9labs/start-sdk": "^0.4.0-beta.47" }, "devDependencies": { "@types/node": "^22.19.0", @@ -49,9 +49,9 @@ } }, "node_modules/@start9labs/start-sdk": { - "version": "0.4.0-beta.46", - "resolved": "https://registry.npmjs.org/@start9labs/start-sdk/-/start-sdk-0.4.0-beta.46.tgz", - "integrity": "sha512-RG3l8wCSdKvrXxDXwFBvcbyFZRrn8XqxbrFDl2scHWOQAPmqlH8QGBgsF/LkycElVHZlzNLRl5shx4eNA5DJjQ==", + "version": "0.4.0-beta.47", + "resolved": "https://registry.npmjs.org/@start9labs/start-sdk/-/start-sdk-0.4.0-beta.47.tgz", + "integrity": "sha512-GhnKJ8F/aEuW4gu0GxHXcSDrj69+H+Dysr0a743q7Hy2HZQSvndAy0B3cPmqz+0oaHKXnCL5r8nicgH8zXlENw==", "license": "MIT", "dependencies": { "@iarna/toml": "^3.0.0", @@ -73,9 +73,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.19.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz", - "integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==", + "version": "22.19.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.7.tgz", + "integrity": "sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==", "dev": true, "license": "MIT", "dependencies": { @@ -165,9 +165,9 @@ } }, "node_modules/prettier": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", - "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", + "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index 246062a..eb587ea 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "hello-world-startos", + "name": "maple-proxy-startos", "scripts": { "build": "rm -rf ./javascript && ncc build startos/index.ts -o ./javascript", "prettier": "prettier --write startos", "check": "tsc --noEmit" }, "dependencies": { - "@start9labs/start-sdk": "^0.4.0-beta.46" + "@start9labs/start-sdk": "^0.4.0-beta.47" }, "devDependencies": { "@types/node": "^22.19.0", @@ -20,4 +20,4 @@ "semi": false, "singleQuote": true } -} \ No newline at end of file +} diff --git a/startos/interfaces.ts b/startos/interfaces.ts index da45ae9..7eaf601 100644 --- a/startos/interfaces.ts +++ b/startos/interfaces.ts @@ -7,10 +7,10 @@ export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => { protocol: 'http', }) const ui = sdk.createInterface(effects, { - name: 'Web UI', - id: 'ui', - description: 'The web interface of Hello World', - type: 'ui', + name: 'API', + id: 'api', + description: '', + type: 'api', masked: false, schemeOverride: null, username: null, diff --git a/startos/main.ts b/startos/main.ts index 41f2166..e21f962 100644 --- a/startos/main.ts +++ b/startos/main.ts @@ -2,39 +2,42 @@ import { sdk } from './sdk' import { uiPort } from './utils' export const main = sdk.setupMain(async ({ effects }) => { - /** - * ======================== Setup (optional) ======================== - * - * In this section, we fetch any resources or run any desired preliminary commands. - */ - console.info('Starting Hello World!') - /** - * ======================== Daemons ======================== - * - * In this section, we create one or more daemons that define the service runtime. - * - * Each daemon defines its own health check, which can optionally be exposed to the user. - */ + console.info(' ... Starting Maple Proxy ... ') + + const proxyEnv: { + MAPLE_HOST: string, + MAPLE_PORT: string, + MAPLE_ENABLE_CORS: string, + MAPLE_API_KEY?: string, + } = { + MAPLE_HOST: '0.0.0.0', + MAPLE_PORT: '8080', + MAPLE_ENABLE_CORS: 'true', + } + + const apiKey = undefined // @TODO: store + if (apiKey) { + proxyEnv.MAPLE_API_KEY = apiKey + } + return sdk.Daemons.of(effects).addDaemon('primary', { subcontainer: await sdk.SubContainer.of( effects, - { imageId: 'hello-world' }, - sdk.Mounts.of().mountVolume({ - volumeId: 'main', - subpath: null, - mountpoint: '/data', - readonly: false, - }), - 'hello-world-sub', + { imageId: 'maple-proxy' }, + sdk.Mounts.of(), + 'proxy-sub', ), - exec: { command: ['hello-world'] }, + exec: { + command: sdk.useEntrypoint(), + env: proxyEnv + }, ready: { - display: 'Web Interface', + display: 'API', fn: () => sdk.healthCheck.checkPortListening(effects, uiPort, { - successMessage: 'The web interface is ready', - errorMessage: 'The web interface is not ready', + successMessage: 'OK', + errorMessage: 'Error', }), }, requires: [], diff --git a/startos/manifest.ts b/startos/manifest.ts index e5a9a44..507d4a9 100644 --- a/startos/manifest.ts +++ b/startos/manifest.ts @@ -1,24 +1,25 @@ import { setupManifest } from '@start9labs/start-sdk' export const manifest = setupManifest({ - id: 'hello-world', - title: 'Hello World', + id: 'maple-proxy', + title: 'Maple Proxy', license: 'MIT', - wrapperRepo: 'https://github.com/Start9Labs/hello-world-startos', - upstreamRepo: 'https://github.com/Start9Labs/hello-world', - supportSite: 'https://docs.start9.com/', - marketingSite: 'https://start9.com/', - donationUrl: 'https://donate.start9.com/', - docsUrl: - 'https://github.com/Start9Labs/hello-world-startos/blob/master/instructions.md', + wrapperRepo: 'https://github.com/OpenSecretCloud/maple-proxy-startos', + upstreamRepo: 'https://github.com/OpenSecretCloud/maple-proxy', + supportSite: 'https://trymaple.ai', + marketingSite: 'https://trymaple.ai', + donationUrl: null, + docsUrl: 'https://blog.trymaple.ai/maple-proxy-documentation/', description: { - short: 'Bare bones example of a StartOS service', - long: 'Hello World is a template service that provides examples of basic StartOS features.', + short: 'Local API proxy for encrypted, privacy-preserving AI services', + long: 'Maple Proxy provides a local API proxy for encrypted, privacy-preserving AI services.', }, volumes: ['main'], images: { - 'hello-world': { - source: { dockerTag: 'start9/hello-world' }, + 'maple-proxy': { + source: { + dockerTag: 'ghcr.io/opensecretcloud/maple-proxy:0.1.5' + }, }, }, alerts: { diff --git a/startos/utils.ts b/startos/utils.ts index 004fc96..fcec7fc 100644 --- a/startos/utils.ts +++ b/startos/utils.ts @@ -1,4 +1 @@ -// Here we define any constants or functions that are shared by multiple components -// throughout the package codebase. This file will be unnecessary for many packages. - -export const uiPort = 80 +export const uiPort = 8080