Skip to content

Commit e1724bd

Browse files
chilu18Codex
andauthored
feat: ship opencto sdk and cli v0.1.1 with byok and rate limits (#40)
* feat: implement opencto mobile app mvp v1 ios foundation * feat(landing): redesign opencto landing for conversion and trust * chore: downgrade mobile app to expo sdk 54 * feat: rebrand mobile app with opencto assets and theme * feat(sdk): scaffold @heysalad/opencto client package * feat(sdk): add mqtt transport and protocol v1 foundation * feat(sdk): add oauth device flow and token store adapters * feat(sdk): add mqtt inbound dedupe controls * feat(sdk): add mqtt publish retry delivery policy * feat(cli): scaffold opencto sdk-powered commands * feat(cli): add workflow directory commands * feat(cli): load workflow directory from json or yaml files * fix(sdk,cli): harden esm runtime imports and add workflow starter file * chore(release): bump sdk and cli to v0.1.1 * feat(api): add encrypted BYOK keys and llm endpoint rate limits * feat: add byok workspace wiring and endpoint hardening tests * fix(api): enforce workspace access for byok keys * docs: add opencto sdk-cli release runbook and script * docs: fix markdownlint formatting in opencto runbooks --------- Co-authored-by: Codex <codex@example.com>
1 parent f22e668 commit e1724bd

File tree

161 files changed

+26295
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+26295
-117
lines changed

docs/opencto/HF_CHERI_OPENVINO_EVALUATION.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ On the server:
1818
- Hugging Face token with access to the model (`HF_TOKEN`)
1919

2020
Set token:
21+
2122
```bash
2223
export HF_TOKEN='hf_...'
2324
```
@@ -53,6 +54,7 @@ pip install "torch>=2.3" "transformers>=4.50" "accelerate>=0.34" "huggingface_hu
5354
```
5455

5556
Quick latency check:
57+
5658
```bash
5759
python3 - <<'PY'
5860
import os, time
@@ -74,12 +76,14 @@ PY
7476
## 5) OpenVINO Export + Runtime
7577

7678
Install:
79+
7780
```bash
7881
source .venv-cheri/bin/activate
7982
pip install -U "optimum-intel[openvino]" "openvino>=2024.4"
8083
```
8184

8285
Export (try int8 first, then int4 if supported):
86+
8387
```bash
8488
optimum-cli export openvino \
8589
--model HeySalad/Cheri-ML-1.3B \
@@ -89,6 +93,7 @@ optimum-cli export openvino \
8993
```
9094

9195
If int8 fails or is too slow, try:
96+
9297
```bash
9398
optimum-cli export openvino \
9499
--model HeySalad/Cheri-ML-1.3B \
@@ -98,6 +103,7 @@ optimum-cli export openvino \
98103
```
99104

100105
Run OpenVINO inference benchmark:
106+
101107
```bash
102108
python3 - <<'PY'
103109
import time

docs/opencto/NEXT_STEPS_RPI.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Move from scaffolded frontend/mocks to production-ready backend-backed auth, bil
2525
## 3. RPi Execution Plan (Ordered)
2626

2727
### Step A: Sync and branch from latest main
28+
2829
```bash
2930
cd /home/admin/CTO-AI
3031
# or: cd /home/peter/CTO-AI-phase2-clean
@@ -36,6 +37,7 @@ git checkout -b feat/opencto-phase7-backend-auth-billing-compliance
3637
```
3738

3839
### Step B: Validate local baseline before edits
40+
3941
```bash
4042
cd opencto/opencto-dashboard
4143
npm install
@@ -98,6 +100,7 @@ Frontend already has `signInWithProvider(provider)` contract. Next:
98100
- CI green on lint/build/test.
99101

100102
## 5. Recommended First RPi Prompt (Copy/Paste)
103+
101104
```text
102105
Implement Phase 7 backend-live integration for OpenCTO.
103106
@@ -125,4 +128,3 @@ Rules:
125128
- Workstream 1: Backend auth/session.
126129
- Workstream 2: Billing + Stripe webhook pipeline.
127130
- Workstream 3: Jobs/compliance live data + websocket stream.
128-

docs/opencto/REALTIME_AGENT_CODEX_TASK.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ interface AudioConfig {
161161
The Cloudflare Worker backend. Relevant endpoints:
162162

163163
**Token endpoint** (already working):
164+
164165
```
165166
POST /api/v1/realtime/token
166167
Authorization: Bearer demo-token
@@ -171,6 +172,7 @@ Body: { "model": "gpt-4o-realtime-preview" }
171172
```
172173

173174
**Tool proxy endpoints** (already wired, need VERCEL_TOKEN / CF_API_TOKEN / CF_ACCOUNT_ID secrets set):
175+
174176
```
175177
GET /api/v1/cto/vercel/projects
176178
GET /api/v1/cto/vercel/projects/:id/deployments
@@ -318,6 +320,7 @@ getUserMedia({ audio: true })
318320
```
319321

320322
The worklet code (inline Blob) converts Float32 mic samples → Int16 PCM16:
323+
321324
```js
322325
class PcmCaptureProcessor extends AudioWorkletProcessor {
323326
process(inputs) {
@@ -368,7 +371,7 @@ Browser → sends { type: "response.create", response: {} }
368371
### Server events to handle
369372
370373
| Event type | What to do |
371-
|---|---|
374+
| --- | --- |
372375
| `session.created` | Log it; optionally send session.update here instead of on ws.onopen |
373376
| `session.updated` | Log it |
374377
| `conversation.item.input_audio_transcription.completed` | Emit `user_transcript` event with `event.transcript` |
@@ -385,7 +388,7 @@ Browser → sends { type: "response.create", response: {} }
385388
When `response.function_call_arguments.done` fires with `name`, dispatch to:
386389
387390
| `name` | Worker endpoint | How to call |
388-
|---|---|---|
391+
| --- | --- | --- |
389392
| `list_vercel_projects` | `GET /api/v1/cto/vercel/projects` | no args |
390393
| `list_vercel_deployments` | `GET /api/v1/cto/vercel/projects/{projectId}/deployments` | args.projectId |
391394
| `get_vercel_deployment` | `GET /api/v1/cto/vercel/deployments/{deploymentId}` | args.deploymentId |
@@ -477,11 +480,13 @@ All must pass with 0 errors.
477480
## Environment Variables
478481

479482
`.env.local` (already set, do not change):
483+
480484
```
481485
VITE_API_BASE_URL=https://opencto-api-worker.heysalad-o.workers.dev
482486
```
483487

484488
Cloudflare Worker secrets (set separately with `wrangler secret put`):
489+
485490
```
486491
OPENAI_API_KEY ← already set on the deployed worker
487492
VERCEL_TOKEN ← set this for Vercel tool calls to work

docs/opencto/VOICE_BACKEND_RUNBOOK.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,48 +64,56 @@ Expected ingress:
6464
## 6) Operations Commands
6565

6666
Service status:
67+
6768
```bash
6869
sudo systemctl status opencto-voice-backend --no-pager -n 50
6970
sudo systemctl status cloudflared --no-pager -n 50
7071
```
7172

7273
Restart services:
74+
7375
```bash
7476
sudo systemctl restart opencto-voice-backend
7577
sudo systemctl restart cloudflared
7678
```
7779

7880
Tail logs:
81+
7982
```bash
8083
journalctl -u opencto-voice-backend -f
8184
journalctl -u cloudflared -f
8285
```
8386

8487
Port checks:
88+
8589
```bash
8690
ss -ltnp | rg '8090|cloudflared|uvicorn'
8791
```
8892

8993
## 7) Smoke Tests
9094

9195
Local app health:
96+
9297
```bash
9398
curl -sS http://127.0.0.1:8090/health
9499
```
95100

96101
Public health:
102+
97103
```bash
98104
curl -sS https://cloud-services-api.opencto.works/health
99105
```
100106

101107
Local response:
108+
102109
```bash
103110
curl -sS -X POST http://127.0.0.1:8090/v1/respond \
104111
-H 'Content-Type: application/json' \
105112
-d '{"text":"Say hello in one line"}'
106113
```
107114

108115
Public response:
116+
109117
```bash
110118
curl -sS -X POST https://cloud-services-api.opencto.works/v1/respond \
111119
-H 'Content-Type: application/json' \
@@ -132,10 +140,12 @@ curl -sS -X POST https://cloud-services-api.opencto.works/v1/respond \
132140
## 10) Migration to Repo-Managed Deployment (Recommended)
133141

134142
1. Clone repo:
143+
135144
```bash
136145
cd /home/hs-chilu/heysalad-ai-projects
137146
git clone git@github.com:Hey-Salad/CTO-AI.git
138147
```
148+
139149
2. Create backend runtime dir from repo source (or update service `WorkingDirectory`).
140150
3. Validate with local health check.
141151
4. Switch systemd `WorkingDirectory` + `ExecStart` to repo-managed path.

opencto.workflows.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"workflows": [
3+
{
4+
"id": "engineering-ci",
5+
"name": "Engineering CI",
6+
"description": "Install, lint, test, and build with pnpm defaults.",
7+
"commandTemplates": [
8+
"pnpm install --frozen-lockfile",
9+
"pnpm lint",
10+
"pnpm test",
11+
"pnpm build"
12+
]
13+
},
14+
{
15+
"id": "founder-landing-launch",
16+
"name": "Founder Landing Launch",
17+
"description": "Validate and build landing page plus dashboard for deployment.",
18+
"commandTemplates": [
19+
"cd opencto/opencto-landing && npm ci",
20+
"cd opencto/opencto-landing && npm run build",
21+
"cd opencto/opencto-dashboard && npm ci",
22+
"cd opencto/opencto-dashboard && npm run lint",
23+
"cd opencto/opencto-dashboard && npm run build"
24+
]
25+
},
26+
{
27+
"id": "founder-content-seo",
28+
"name": "Founder Content SEO",
29+
"description": "Generate SEO assets and validate output artifacts.",
30+
"commandTemplates": [
31+
"npm run content:plan -- --topic \"{{topic}}\"",
32+
"npm run content:draft -- --topic \"{{topic}}\" --persona \"{{persona}}\"",
33+
"npm run content:publish -- --topic \"{{topic}}\""
34+
]
35+
},
36+
{
37+
"id": "founder-sales-outreach",
38+
"name": "Founder Sales Outreach",
39+
"description": "Generate lead list and outbound sequence assets.",
40+
"commandTemplates": [
41+
"npm run sales:leads -- --segment \"{{segment}}\"",
42+
"npm run sales:sequence -- --segment \"{{segment}}\" --offer \"{{offer}}\"",
43+
"npm run sales:send -- --segment \"{{segment}}\""
44+
]
45+
},
46+
{
47+
"id": "founder-demo-pack",
48+
"name": "Founder Demo Pack",
49+
"description": "Assemble product + GTM demo artifacts for judges or customers.",
50+
"commandTemplates": [
51+
"npm run demo:product",
52+
"npm run demo:marketing",
53+
"npm run demo:ops",
54+
"npm run demo:bundle"
55+
]
56+
},
57+
{
58+
"id": "sdk-release-check",
59+
"name": "SDK Release Check",
60+
"description": "Quality gates for sdk and cli packages before publish.",
61+
"commandTemplates": [
62+
"cd opencto/opencto-sdk-js && npm ci",
63+
"cd opencto/opencto-sdk-js && npm run lint",
64+
"cd opencto/opencto-sdk-js && npm run test",
65+
"cd opencto/opencto-sdk-js && npm run build",
66+
"cd opencto/opencto-cli && npm ci",
67+
"cd opencto/opencto-cli && npm run lint",
68+
"cd opencto/opencto-cli && npm run test",
69+
"cd opencto/opencto-cli && npm run build"
70+
]
71+
}
72+
]
73+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# OpenCTO Package Release Runbook
2+
3+
This runbook is for shipping:
4+
5+
- `@heysalad/opencto`
6+
- `@heysalad/opencto-cli`
7+
8+
## Preconditions
9+
10+
1. Work on your release branch (never `main` directly).
11+
2. `opencto/opencto-sdk-js` and `opencto/opencto-cli` must be committed and clean.
12+
3. npm auth must be active on this machine:
13+
- `npm whoami`
14+
15+
## One-command release
16+
17+
From repository root:
18+
19+
```bash
20+
./opencto/scripts/release-opencto-packages.sh
21+
```
22+
23+
What it does:
24+
25+
1. Verifies npm auth.
26+
2. Runs `lint`, `test`, `build` for SDK.
27+
3. Publishes `@heysalad/opencto`.
28+
4. Runs `lint`, `test`, `build` for CLI.
29+
5. Publishes `@heysalad/opencto-cli`.
30+
31+
## Manual fallback
32+
33+
If you want step-by-step control:
34+
35+
```bash
36+
cd opencto/opencto-sdk-js
37+
npm run lint && npm run test && npm run build
38+
npm publish --access public
39+
40+
cd ../opencto-cli
41+
npm run lint && npm run test && npm run build
42+
npm publish --access public
43+
```
44+
45+
## Post-release verification
46+
47+
```bash
48+
npm view @heysalad/opencto version
49+
npm view @heysalad/opencto-cli version
50+
```
51+
52+
## Notes
53+
54+
- `@heysalad/opencto-cli` depends on `@heysalad/opencto`, so publish SDK first.
55+
- If npm returns `ENEEDAUTH`, run `npm login` and retry.

opencto/mobile-app/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
expo-env.d.ts
11+
12+
# Native
13+
.kotlin/
14+
*.orig.*
15+
*.jks
16+
*.p8
17+
*.p12
18+
*.key
19+
*.mobileprovision
20+
21+
# Metro
22+
.metro-health-check*
23+
24+
# debug
25+
npm-debug.*
26+
yarn-debug.*
27+
yarn-error.*
28+
29+
# macOS
30+
.DS_Store
31+
*.pem
32+
33+
# local env files
34+
.env*.local
35+
36+
# typescript
37+
*.tsbuildinfo
38+
39+
# generated native folders
40+
/ios
41+
/android

0 commit comments

Comments
 (0)