forked from sagnik/Project_Velocity
feat: Ipad app production readiness, Colony orchestration, Social posting (#44)
#38 Ipad app production readiness, Colony orchestration, Social posting Co-authored-by: Sayan Datta <sayan@Sayans-MacBook-Air.local> Reviewed-on: sagnik/Project_Velocity#44
This commit is contained in:
25
app/dist/index.html
vendored
25
app/dist/index.html
vendored
@@ -1,16 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Velocity WebOS</title>
|
||||
<script type="module" crossorigin src="./assets/index-C0KOan5Q.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-CrH2wIGN.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Velocity WebOS</title>
|
||||
<script type="module" crossorigin src="./assets/index-DqpQquIA.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-80rkGqUG.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -22,11 +22,13 @@ import {
|
||||
X,
|
||||
MessageSquarePlus,
|
||||
Sparkles,
|
||||
Zap,
|
||||
Brain,
|
||||
PanelLeft,
|
||||
type LucideIcon,
|
||||
} from 'lucide-react';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import type { CanvasPage, CanvasPageRevision, MergeRequest, UserProfile } from '@/oracle/types/canvas';
|
||||
import type { CanvasPage, CanvasPageRevision, MergeRequest, OracleExecutionMode, UserProfile } from '@/oracle/types/canvas';
|
||||
import type { ComponentRenderContext } from '@/oracle/components/ComponentRegistry';
|
||||
import { useOraclePage } from '@/oracle/hooks/useOraclePage';
|
||||
import { useOracleExecution } from '@/oracle/hooks/useOracleExecution';
|
||||
@@ -60,6 +62,12 @@ const PROMPT_MODES: Array<{ view: string; label: string; samplePrompt: string; i
|
||||
{ view: 'kpi', label: 'KPI Summary', samplePrompt: 'Give me a KPI summary of total pipeline value today.', icon: BarChart2 },
|
||||
];
|
||||
|
||||
const EXECUTION_MODES: Array<{ value: OracleExecutionMode; label: string; icon: LucideIcon }> = [
|
||||
{ value: 'auto', label: 'Auto', icon: Sparkles },
|
||||
{ value: 'fast', label: 'Fast', icon: Zap },
|
||||
{ value: 'thinking', label: 'Thinking', icon: Brain },
|
||||
];
|
||||
|
||||
const BASE_CTX: ComponentRenderContext = {
|
||||
tenantId: '',
|
||||
actorRole: 'sales_director',
|
||||
@@ -116,6 +124,7 @@ export default function OraclePage() {
|
||||
|
||||
const [prompt, setPrompt] = useState('');
|
||||
const [selectedMode, setSelectedMode] = useState(PROMPT_MODES[0]);
|
||||
const [executionMode, setExecutionMode] = useState<OracleExecutionMode>('auto');
|
||||
const [viewDropOpen, setViewDropOpen] = useState(false);
|
||||
const [listening, setListening] = useState(false);
|
||||
const [railOpen, setRailOpen] = useState(false);
|
||||
@@ -208,6 +217,7 @@ export default function OraclePage() {
|
||||
prompt: clean,
|
||||
tenantId: me.tenantId,
|
||||
actorId: me.userId,
|
||||
executionMode,
|
||||
placementMode: me.canvasPreferences.defaultPlacementMode,
|
||||
conversationContext: history.flatMap((entry) => [
|
||||
{ role: 'user' as const, content: entry.execution.prompt },
|
||||
@@ -227,7 +237,7 @@ export default function OraclePage() {
|
||||
}
|
||||
|
||||
await Promise.all([refresh(), loadCanvasSessions()]);
|
||||
}, [prompt, inFlight, page, me, submit, history, applyRevision, refresh, loadCanvasSessions]);
|
||||
}, [prompt, inFlight, page, me, submit, history, executionMode, applyRevision, refresh, loadCanvasSessions]);
|
||||
|
||||
const handleMic = useCallback(() => {
|
||||
const browserWindow = window as Window & {
|
||||
@@ -736,6 +746,31 @@ export default function OraclePage() {
|
||||
{viewDropOpen && <div className="fixed inset-0 z-[998]" onClick={() => setViewDropOpen(false)} />}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="flex items-center rounded-full p-0.5"
|
||||
style={{ background: 'rgba(255,255,255,0.05)', border: '1px solid rgba(255,255,255,0.09)' }}
|
||||
>
|
||||
{EXECUTION_MODES.map((mode) => {
|
||||
const active = executionMode === mode.value;
|
||||
return (
|
||||
<button
|
||||
key={mode.value}
|
||||
type="button"
|
||||
onClick={() => setExecutionMode(mode.value)}
|
||||
className="flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs transition-all"
|
||||
style={{
|
||||
background: active ? 'rgba(59,130,246,0.18)' : 'transparent',
|
||||
color: active ? '#bfdbfe' : 'rgba(255,255,255,0.48)',
|
||||
}}
|
||||
title={mode.value === 'auto' ? 'Let Oracle choose the route' : mode.value === 'fast' ? 'Use Oracle directly' : 'Use Colony orchestration'}
|
||||
>
|
||||
<mode.icon className="h-3 w-3" />
|
||||
<span className={mode.value === 'thinking' ? 'hidden sm:inline' : ''}>{mode.label}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
id="oracle-rail-toggle"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* useOracleExecution — manages prompt submission and durable execution history.
|
||||
*/
|
||||
import { useState, useCallback, useRef } from 'react';
|
||||
import type { PromptExecution, CanvasComponent, PlacementMode } from '../types/canvas';
|
||||
import type { PromptExecution, CanvasComponent, PlacementMode, OracleExecutionMode } from '../types/canvas';
|
||||
import { submitPrompt } from '../lib/oracleApiClient';
|
||||
|
||||
export interface ExecutionEntry {
|
||||
@@ -20,6 +20,7 @@ export interface OracleExecutionState {
|
||||
prompt: string;
|
||||
tenantId: string;
|
||||
actorId: string;
|
||||
executionMode?: OracleExecutionMode;
|
||||
placementMode?: PlacementMode;
|
||||
conversationContext?: Array<{ role: 'user' | 'assistant'; content: string }>;
|
||||
onExecutionCommitted?: (commit: {
|
||||
@@ -45,6 +46,7 @@ export function useOracleExecution(): OracleExecutionState {
|
||||
prompt,
|
||||
tenantId,
|
||||
actorId,
|
||||
executionMode = 'auto',
|
||||
placementMode = 'append_after_last_visible_component',
|
||||
conversationContext = [],
|
||||
onExecutionCommitted,
|
||||
@@ -54,6 +56,7 @@ export function useOracleExecution(): OracleExecutionState {
|
||||
prompt: string;
|
||||
tenantId: string;
|
||||
actorId: string;
|
||||
executionMode?: OracleExecutionMode;
|
||||
placementMode?: PlacementMode;
|
||||
conversationContext?: Array<{ role: 'user' | 'assistant'; content: string }>;
|
||||
onExecutionCommitted?: (commit: {
|
||||
@@ -73,10 +76,11 @@ export function useOracleExecution(): OracleExecutionState {
|
||||
prompt,
|
||||
intentClass: 'analytical',
|
||||
status: 'planning',
|
||||
modelRuntime: 'oracle_runtime',
|
||||
modelRuntime: executionMode === 'thinking' ? 'colony_orchestrator' : 'oracle_runtime',
|
||||
semanticModelVersion: 'oracle_semantic_v2026_04_08_01',
|
||||
warnings: [],
|
||||
createdAt: now,
|
||||
executionMode,
|
||||
};
|
||||
|
||||
setInFlight(optimistic);
|
||||
@@ -91,6 +95,7 @@ export function useOracleExecution(): OracleExecutionState {
|
||||
prompt,
|
||||
conversationContext,
|
||||
placementMode,
|
||||
executionMode,
|
||||
});
|
||||
|
||||
const completed: PromptExecution = {
|
||||
@@ -100,6 +105,9 @@ export function useOracleExecution(): OracleExecutionState {
|
||||
summary: response.summary,
|
||||
warnings: response.warnings,
|
||||
componentsCreated: response.componentsCreated,
|
||||
executionMode: response.executionMode ?? executionMode,
|
||||
resolvedMode: response.resolvedMode,
|
||||
colonyMissionId: response.colonyMissionId,
|
||||
completedAt: new Date().toISOString(),
|
||||
};
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ export type ExecutionStatus =
|
||||
| 'failed'
|
||||
| 'clarification_required';
|
||||
|
||||
export type OracleExecutionMode = 'auto' | 'fast' | 'thinking';
|
||||
|
||||
export type PageType = 'main' | 'fork';
|
||||
|
||||
export type ForkStatus = 'active' | 'merged' | 'closed';
|
||||
@@ -280,6 +282,9 @@ export interface PromptExecution {
|
||||
componentsCreated?: string[];
|
||||
createdAt: string;
|
||||
completedAt?: string;
|
||||
executionMode?: OracleExecutionMode;
|
||||
resolvedMode?: 'fast' | 'thinking';
|
||||
colonyMissionId?: string;
|
||||
}
|
||||
|
||||
export interface ComponentTemplate {
|
||||
@@ -383,6 +388,7 @@ export interface PromptSubmitRequest {
|
||||
prompt: string;
|
||||
conversationContext?: Array<{ role: 'user' | 'assistant'; content: string }>;
|
||||
placementMode?: PlacementMode;
|
||||
executionMode?: OracleExecutionMode;
|
||||
}
|
||||
|
||||
export interface PromptSubmitResponse {
|
||||
@@ -395,6 +401,9 @@ export interface PromptSubmitResponse {
|
||||
components: CanvasComponent[];
|
||||
summary: string;
|
||||
warnings: string[];
|
||||
executionMode?: OracleExecutionMode;
|
||||
resolvedMode?: 'fast' | 'thinking';
|
||||
colonyMissionId?: string;
|
||||
}
|
||||
|
||||
export interface CanvasPageRevision {
|
||||
|
||||
Reference in New Issue
Block a user