feat: AIUI chat mode integration with iframe, context broker, overnight loop

- Chat mode: AIUI loads in sandboxed iframe at /dashboard/chat with transparent bg
- Mode switcher: Easy + Pro tabs only, Chat is a launcher button
- Keyboard shortcuts: Cmd+1 (Easy), Cmd+2 (Pro), Cmd+3 (Chat), Cmd+M (cycle)
- Directional transitions: chat slides from/to left, dashboard from/to right
- Context broker: postMessage protocol for quarantined AIUI communication
- AI permissions store: user-controlled toggles for data access categories
- Settings UI: AI Data Access section with per-category toggles
- AIUI container manifest and nginx proxy config for /aiui/
- Deploy script builds AIUI with /aiui/ base path
- Overnight loop infrastructure (loop.sh, prepare.sh, plan.md, prompt.md)
- Security hooks for autonomous overnight runs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-04 12:06:20 +00:00
parent 7b044d22ef
commit 584ce646e1
23 changed files with 1528 additions and 77 deletions

View File

@@ -0,0 +1,87 @@
/**
* AIUI ↔ Archy postMessage Protocol
*
* AIUI (iframe) communicates with Archy (host) via structured messages.
* Archy acts as a context broker — AIUI never directly accesses node data.
*/
/** Data categories that AIUI can request access to */
export type AIContextCategory = 'apps' | 'system' | 'network' | 'wallet' | 'files'
/** Actions AIUI can request Archy to perform */
export type AIActionType = 'install-app' | 'open-app' | 'navigate'
// ─── AIUI → Archy (Requests) ───────────────────────────────────────────────
export interface AIUIContextRequest {
type: 'context:request'
id: string
category: AIContextCategory
query?: string
}
export interface AIUIActionRequest {
type: 'action:request'
id: string
action: AIActionType
params: Record<string, string>
}
export interface AIUIReadyMessage {
type: 'ready'
}
export interface AIUIThemeRequest {
type: 'theme:request'
}
export type AIUIRequest =
| AIUIContextRequest
| AIUIActionRequest
| AIUIReadyMessage
| AIUIThemeRequest
// ─── Archy → AIUI (Responses) ──────────────────────────────────────────────
export interface ArchyContextResponse {
type: 'context:response'
id: string
data: unknown
permitted: boolean
}
export interface ArchyActionResponse {
type: 'action:response'
id: string
success: boolean
error?: string
}
export interface ArchyThemeResponse {
type: 'theme:response'
theme: {
accent: string
mode: 'dark'
}
}
export interface ArchyPermissionsUpdate {
type: 'permissions:update'
categories: AIContextCategory[]
}
export type ArchyResponse =
| ArchyContextResponse
| ArchyActionResponse
| ArchyThemeResponse
| ArchyPermissionsUpdate
// ─── All messages ───────────────────────────────────────────────────────────
export type AIUIMessage = AIUIRequest | ArchyResponse
/** Protocol version for compatibility checks */
export const AIUI_PROTOCOL_VERSION = '1.0.0'
/** Message origin prefix used for validation */
export const AIUI_MESSAGE_PREFIX = 'aiui:'