Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 8 additions & 10 deletions docs/instructions.md
Original file line number Diff line number Diff line change
@@ -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/).
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -20,4 +20,4 @@
"semi": false,
"singleQuote": true
}
}
}
8 changes: 4 additions & 4 deletions startos/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
53 changes: 28 additions & 25 deletions startos/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down
27 changes: 14 additions & 13 deletions startos/manifest.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
5 changes: 1 addition & 4 deletions startos/utils.ts
Original file line number Diff line number Diff line change
@@ -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