diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5ec8190 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,4 @@ +## How the upstream version is pulled +- dockerTag in `startos/manifest/index.ts`: `ghcr.io/opensecretcloud/maple-proxy:` + +> Fork of islandbitcoin/maple-proxy-startos. diff --git a/README.md b/README.md index 99acd5a..98e2dc0 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,22 @@ Configuration is stored in `store.json` on the `main` volume and read by the map ## Actions (StartOS UI) -| Action | Description | Allowed States | -| ---------------- | ------------------------------- | -------------- | -| Configure | Set API key and backend URL | Any | -| Proxy Properties | Display API and UI port numbers | Any | +### Configure + +| Property | Value | +|----------|-------| +| ID | `configure` | +| Availability | Any status | +| Visibility | Enabled | + +**Inputs:** + +| Field | Type | Required | Default | Description | +|-------|------|----------|---------|-------------| +| Backend URL | Text | Yes | `https://enclave.trymaple.ai` | Maple/OpenSecret backend URL | +| API Key | Text (masked) | No | _(empty)_ | Your Maple API key; if empty, clients must provide their own via Authorization header | + +**Output:** None (service restarts to apply new configuration) --- @@ -122,20 +134,18 @@ The `main` volume is included in backups, preserving your `store.json` configura ## Health Checks -| Check | Daemon | Method | Grace Period | -| ------------- | --------- | --------------------- | ------------ | -| API Interface | `primary` | Port listening (8080) | 10s | -| Web Interface | `ui` | Port listening (80) | — | +| Check | Daemon | Method | Display | +| ------------ | -------------- | --------------------- | -------------- | +| Proxy Server | `maple-proxy` | Port listening (8080) | Proxy Server | +| Web UI | `ui` | Port listening (80) | Web UI | --- ## Limitations and Differences -| Area | Upstream | StartOS | -| ------------- | --------------------- | --------------------------------- | -| Configuration | Environment variables | `store.json` via Configure action | -| Web UI | Not included | Bundled nginx chat interface | -| Networking | Direct port binding | StartOS multi-host interfaces | +1. **Configuration via action only** — upstream uses environment variables directly; on StartOS, all configuration is managed through `store.json` via the Configure action +2. **Bundled web UI** — StartOS adds a custom nginx chat interface not included in the upstream project +3. **StartOS networking** — uses StartOS multi-host interfaces instead of direct port binding --- @@ -161,3 +171,35 @@ make x86 # x86_64 only ``` Requires [start-cli](https://github.com/Start9Labs/start-os) v0.4.0+ and Docker. + +--- + +## Quick Reference for AI Consumers + +```yaml +package_id: maple-proxy +images: + maple-proxy: ghcr.io/opensecretcloud/maple-proxy (upstream, unmodified) + maple-ui: custom nginx build (assets/ui/) +architectures: [x86_64, aarch64] +volumes: + main: /data +ports: + api: 8080 + ui: 80 +dependencies: none +startos_managed_env_vars: + - MAPLE_HOST + - MAPLE_PORT + - MAPLE_ENABLE_CORS + - RUST_LOG + - MAPLE_BACKEND_URL (user-configurable via action) + - MAPLE_API_KEY (user-configurable via action) +actions: + - configure +health_checks: + - port_listening: 8080 (maple-proxy) + - port_listening: 80 (maple-ui) +backup_volumes: + - main +``` diff --git a/package-lock.json b/package-lock.json index 9d83fa5..8562f9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "maple-proxy-startos", "dependencies": { - "@start9labs/start-sdk": "^0.4.0-beta.58" + "@start9labs/start-sdk": "1.0.0" }, "devDependencies": { "@types/node": "^22.19.0", @@ -49,9 +49,9 @@ } }, "node_modules/@start9labs/start-sdk": { - "version": "0.4.0-beta.58", - "resolved": "https://registry.npmjs.org/@start9labs/start-sdk/-/start-sdk-0.4.0-beta.58.tgz", - "integrity": "sha512-d8R+g9WNpdxvvPyBDL2VGVJjmhleIV0JEOKm28JrhnfmNSf9gOLY40QzUV1PuSCNXl50dYiom/SXab1q0faidw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@start9labs/start-sdk/-/start-sdk-1.0.0.tgz", + "integrity": "sha512-rtAfumVbMy90iw2WRbWH7fGcuwAvvuFfR4YwgSsh5R2Bz9MXtcEfmznwhnrp+ntQ6BOUSQ0wLzePbfsS6kUagg==", "license": "MIT", "dependencies": { "@iarna/toml": "^3.0.0", @@ -59,6 +59,7 @@ "@noble/hashes": "^1.7.2", "@types/ini": "^4.1.1", "deep-equality-data-structures": "^2.0.0", + "fast-xml-parser": "^5.5.6", "ini": "^5.0.0", "isomorphic-fetch": "^3.0.0", "mime": "^4.0.7", @@ -102,6 +103,41 @@ "object-hash": "^3.0.0" } }, + "node_modules/fast-xml-builder": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.4.tgz", + "integrity": "sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "path-expression-matcher": "^1.1.3" + } + }, + "node_modules/fast-xml-parser": { + "version": "5.5.9", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.9.tgz", + "integrity": "sha512-jldvxr1MC6rtiZKgrFnDSvT8xuH+eJqxqOBThUVjYrxssYTo1avZLGql5l0a0BAERR01CadYzZ83kVEkbyDg+g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "fast-xml-builder": "^1.1.4", + "path-expression-matcher": "^1.2.0", + "strnum": "^2.2.2" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/ini": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ini/-/ini-5.0.0.tgz", @@ -165,6 +201,21 @@ "node": ">= 6" } }, + "node_modules/path-expression-matcher": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.2.0.tgz", + "integrity": "sha512-DwmPWeFn+tq7TiyJ2CxezCAirXjFxvaiD03npak3cRjlP9+OjTmSy1EpIrEbh+l6JgUundniloMLDQ/6VTdhLQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/prettier": { "version": "3.8.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", @@ -181,6 +232,18 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/strnum": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.2.tgz", + "integrity": "sha512-DnR90I+jtXNSTXWdwrEy9FakW7UX+qUZg28gj5fk2vxxl7uS/3bpI4fjFYVmdK9etptYBPNkpahuQnEwhwECqA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -231,9 +294,9 @@ } }, "node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz", + "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", "license": "ISC", "bin": { "yaml": "bin.mjs" diff --git a/package.json b/package.json index 2b6714f..09c6b5c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "check": "tsc --noEmit" }, "dependencies": { - "@start9labs/start-sdk": "^0.4.0-beta.58" + "@start9labs/start-sdk": "1.0.0" }, "devDependencies": { "@types/node": "^22.19.0", diff --git a/startos/index.ts b/startos/index.ts index 5bc2685..7af589b 100644 --- a/startos/index.ts +++ b/startos/index.ts @@ -7,5 +7,5 @@ export { init, uninit } from './init' export { actions } from './actions' import { buildManifest } from '@start9labs/start-sdk' import { manifest as sdkManifest } from './manifest' -import { versionGraph } from './install/versionGraph' +import { versionGraph } from './versions' export const manifest = buildManifest(versionGraph, sdkManifest) diff --git a/startos/init/index.ts b/startos/init/index.ts index 70ba047..a121be3 100644 --- a/startos/init/index.ts +++ b/startos/init/index.ts @@ -1,18 +1,20 @@ -import { sdk } from '../sdk' -import { setDependencies } from '../dependencies' -import { setInterfaces } from '../interfaces' -import { versionGraph } from '../install/versionGraph' import { actions } from '../actions' import { restoreInit } from '../backups' -import { initializeService } from './initializeService' +import { setDependencies } from '../dependencies' +import { setInterfaces } from '../interfaces' +import { sdk } from '../sdk' +import { versionGraph } from '../versions' +import { seedFiles } from './seedFiles' +import { taskConfigure } from './taskConfigure' export const init = sdk.setupInit( - initializeService, restoreInit, versionGraph, + seedFiles, setInterfaces, setDependencies, actions, + taskConfigure, ) export const uninit = sdk.setupUninit(versionGraph) diff --git a/startos/init/initializeService.ts b/startos/init/initializeService.ts deleted file mode 100644 index 8968021..0000000 --- a/startos/init/initializeService.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { configure } from '../actions/configure' -import { storeJson } from '../fileModels/store.json' -import { i18n } from '../i18n' -import { sdk } from '../sdk' - -export const initializeService = sdk.setupOnInit(async (effects, kind) => { - if (kind !== 'install') return - - // Seed store with defaults - await storeJson.merge(effects, {}) - - // Prompt user to configure their API key - await sdk.action.createOwnTask(effects, configure, 'important', { - reason: i18n('Set your Maple API key'), - }) -}) diff --git a/startos/init/seedFiles.ts b/startos/init/seedFiles.ts new file mode 100644 index 0000000..bf5e790 --- /dev/null +++ b/startos/init/seedFiles.ts @@ -0,0 +1,6 @@ +import { storeJson } from '../fileModels/store.json' +import { sdk } from '../sdk' + +export const seedFiles = sdk.setupOnInit(async (effects) => { + await storeJson.merge(effects, {}) +}) diff --git a/startos/init/taskConfigure.ts b/startos/init/taskConfigure.ts new file mode 100644 index 0000000..b2dcf87 --- /dev/null +++ b/startos/init/taskConfigure.ts @@ -0,0 +1,11 @@ +import { configure } from '../actions/configure' +import { i18n } from '../i18n' +import { sdk } from '../sdk' + +export const taskConfigure = sdk.setupOnInit(async (effects, kind) => { + if (kind === 'install') { + await sdk.action.createOwnTask(effects, configure, 'important', { + reason: i18n('Set your Maple API key'), + }) + } +}) diff --git a/startos/install/versions/index.ts b/startos/install/versions/index.ts deleted file mode 100644 index d13d93a..0000000 --- a/startos/install/versions/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { v_0_1_7_0_4_b0 as current } from './v_0_1_7_0_4_b0' -export const other = [] diff --git a/startos/install/versions/v_0_1_7_0_4_b0.ts b/startos/install/versions/v_0_1_7_0_4_b0.ts deleted file mode 100644 index e9e9a7d..0000000 --- a/startos/install/versions/v_0_1_7_0_4_b0.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { VersionInfo } from '@start9labs/start-sdk' - -export const v_0_1_7_0_4_b0 = VersionInfo.of({ - version: '0.1.7:0.4-beta.0', - releaseNotes: { - en_US: - 'Update to upstream v0.1.7 (security patches, streaming fix) and StartOS SDK beta.58', - }, - migrations: { - up: async ({ effects }) => {}, - down: async ({ effects }) => {}, - }, -}) diff --git a/startos/manifest/index.ts b/startos/manifest/index.ts index 350a50c..ccba370 100644 --- a/startos/manifest/index.ts +++ b/startos/manifest/index.ts @@ -6,7 +6,7 @@ export const manifest = setupManifest({ title: 'Maple Proxy', license: 'MIT', packageRepo: - 'https://github.com/islandbitcoin/maple-proxy-startos/tree/update/040', + 'https://github.com/islandbitcoin/maple-proxy-startos', upstreamRepo: 'https://github.com/OpenSecretCloud/maple-proxy', marketingUrl: 'https://trymaple.ai/', donationUrl: null, diff --git a/startos/install/versionGraph.ts b/startos/versions/index.ts similarity index 58% rename from startos/install/versionGraph.ts rename to startos/versions/index.ts index 5a4fad7..53b6882 100644 --- a/startos/install/versionGraph.ts +++ b/startos/versions/index.ts @@ -1,7 +1,7 @@ import { VersionGraph } from '@start9labs/start-sdk' -import { current, other } from './versions' +import { v_0_1_7_4 } from './v0.1.7.4' export const versionGraph = VersionGraph.of({ - current, - other, + current: v_0_1_7_4, + other: [], }) diff --git a/startos/versions/v0.1.7.4.ts b/startos/versions/v0.1.7.4.ts new file mode 100644 index 0000000..6229567 --- /dev/null +++ b/startos/versions/v0.1.7.4.ts @@ -0,0 +1,16 @@ +import { VersionInfo } from '@start9labs/start-sdk' + +export const v_0_1_7_4 = VersionInfo.of({ + version: '0.1.7:4', + releaseNotes: { + en_US: 'Update to upstream v0.1.7 (security patches, streaming fix)', + es_ES: 'Actualización a upstream v0.1.7 (parches de seguridad, corrección de streaming)', + de_DE: 'Update auf Upstream v0.1.7 (Sicherheitspatches, Streaming-Fix)', + pl_PL: 'Aktualizacja do upstream v0.1.7 (łatki bezpieczeństwa, naprawa streamingu)', + fr_FR: 'Mise à jour vers upstream v0.1.7 (correctifs de sécurité, correction du streaming)', + }, + migrations: { + up: async ({ effects }) => {}, + down: async ({ effects }) => {}, + }, +})