Compare commits

...
17 Commits
Author SHA1 Message Date
MervinPraison 78493e0e17 Release v0.3.151 2026-11-05 16:51:31 +00:00
praisonai-triage-agent[bot] bf5415555b Merge pull request #332 from MervinPraison/claude/issue-331-20261105
fix: rename sessions from the chat rail
2026-11-05 16:48:12 +00:00
MervinPraisonandClaude Opus 5.5 e69a06c2d5 fix: rename sessions from the chat rail (fixes #331)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 10:41:19 +00:00
MervinPraison 085bdd3793 Release v0.3.150 2026-11-04 12:47:04 +00:00
Superbot Helper 93abaac212 Bump @a2ui/web_core from 0.10.0 to 0.10.2 in the frontend [SECURITY] (#321)
GHSA-72qq-p3r5-f7wq: the basic catalog openUrl action accepted any URL
scheme and passed it to window.open, so an agent-supplied A2UI Button
carrying a javascript: URI would execute script in the app origin on click.
0.10.2 resolves the URL and refuses anything that is not http or https.
2026-11-04 12:45:00 +00:00
f2ecc8e39e fix: link job rows to their chat session (fixes #323) (#325)
Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-04 12:44:48 +00:00
e86b187246 fix: add in-rail session search to chat sidebar (#327)
* fix: add in-rail session search to chat sidebar (fixes #324)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: guard session rail against non-array session payloads

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-04 12:44:26 +00:00
1255f44105 fix: make dashboard chat fill the main column (#326)
* fix: make dashboard chat fill the main column (fixes #322)

Chat and Chat+Canvas built-in pages declare layout: full-bleed. selectPage()
toggles a db-fill class on #db-main-content and skips the duplicate page
header, so .chat-root sizes from flex allocation instead of
calc(100vh - 140px). Session rail stacks above the thread below 900px.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: make full-bleed page metadata test non-vacuous

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-04 12:44:10 +00:00
Mervin PraisonandClaude Opus 5.5 7002e956fb ci: bump github-automation-template to v1.1.20 (#320)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-29 02:38:22 +01:00
MervinPraison ebbb5f863e Release v0.3.149 2026-10-27 10:17:57 +00:00
Mervin Praison 34a01c1738 Merge pull request #318 from MervinPraison/fix/replay-unnamed-agents
fix(replay): map and narrate unnamed agents (Agent(instructions=...))
2026-10-27 11:14:51 +01:00
Mervin Praison 0d2b7b1d09 Merge branch 'main' into fix/replay-unnamed-agents 2026-10-27 11:13:04 +01:00
Mervin Praison 4ab1eee24f Merge pull request #319 from MervinPraison/fix/frontend-typecheck
fix(frontend): make the dashboard build pass again (26 type errors since April)
2026-10-27 11:12:54 +01:00
MervinPraisonandClaude Opus 5.5 1dad99b2c8 fix(frontend): make the dashboard build pass again (26 type errors since April)
The frontend build gate added on 2026-09-23 (166091b) has failed on every
main run since: five April PRs left code that never compiled — imports of
shadcn components that were never added (ui/alert, ui/textarea), seven
example widgets that never existed (CustomElementHost), react-router-dom
(not a dependency), a useSSE call written for a different hook, a wrong
ChatMessages prop set, and unused locals under noUnusedLocals.

- add the standard shadcn alert and textarea components
- CustomElementHost: empty registry instead of imports of missing widgets
- useWindowMessage: small local EventSource hook for /sse/window-message
- SharedThread: read the token from /shared/{token}; pass the props
  ChatMessages takes; type messages as ChatMessage[]
- drop unused imports/locals

None of these files are imported by the app today, so nothing users see
changes; the gate now builds and catches real breakage again.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-27 10:08:44 +00:00
MervinPraisonandClaude Opus 5.5 a89b00da5b fix(replay): map and narrate unnamed agents (Agent(instructions=...))
An agent created without name= records agent_name null. The Replay map
skipped every such event, so watch(Agent(instructions=...)) showed
"Nothing to map yet" and its steps were narrated as "The run".

- agentOf(ev): agent_name, else the package's id (agent:Agent from the
  companion core fix), else tool:None/<tool> or nothing in 4.7.19 traces,
  falling back to "Agent" for an agent's own run events.
- deriveGraph / nodeIdsForEvent / narrate use it, so the agent and its tools
  are drawn and lit, and steps read "Agent started.".
- Only when no graph was recorded: a team graph leaves unnamed agents out on
  purpose, and they must not reappear as "Outside the team".

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-27 09:46:43 +00:00
MervinPraison 706c934629 Release v0.3.148 2026-10-26 19:36:13 +00:00
Mervin Praison 7a22011892 Merge pull request #317 from MervinPraison/feat/replay-embed
feat(replay): embeddable Replay app, Run box, Play, and a map that follows the cursor
2026-10-26 17:35:07 +01:00
33 changed files with 606 additions and 154 deletions

No files matched your search

+2 -2
View File
@@ -27,7 +27,7 @@ jobs:
permissions:
issues: write
pull-requests: write
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].19
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].20
secrets: inherit
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
+2 -2
View File
@@ -16,8 +16,8 @@ permissions:
jobs:
recover:
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].19
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].20
secrets: inherit
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
pr_number: ${{ github.event.inputs.pr_number || '' }}
+2 -2
View File
@@ -25,8 +25,8 @@ permissions:
jobs:
detect-and-trigger:
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].19
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].20
secrets: inherit
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
pr_number: ${{ github.event.inputs.pr_number || '' }}
+4 -4
View File
@@ -43,9 +43,9 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: MervinPraison/github-automation-template/.github/actions/[email protected].19
- uses: MervinPraison/github-automation-template/.github/actions/[email protected].20
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
@@ -88,9 +88,9 @@ jobs:
actions: read
id-token: write
statuses: write # the assess job records security/outsider-review
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].19
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].20
secrets: inherit
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
pr_number: ${{ github.event.inputs.pr_number || github.event.client_payload.pr_number || '' }}
merge_method: ${{ github.event.inputs.merge_method || 'merge' }}
+2 -2
View File
@@ -18,7 +18,7 @@ jobs:
issues: write
actions: read
id-token: write
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].19
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].20
secrets: inherit
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
+2 -2
View File
@@ -25,9 +25,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: MervinPraison/github-automation-template/.github/actions/[email protected].19
- uses: MervinPraison/github-automation-template/.github/actions/[email protected].20
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
- name: Detect conflicting PRs and trigger Claude
uses: actions/github-script@v7
with:
+2 -2
View File
@@ -13,7 +13,7 @@ permissions:
jobs:
sync:
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].19
uses: MervinPraison/github-automation-template/.github/workflows/[email protected].20
secrets: inherit
with:
hub_ref: v1.1.19
hub_ref: v1.1.20
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "aiui"
version = "0.3.147"
version = "0.3.151"
description = "YAML-driven website generator - CLI and compiler"
readme = "README.md"
license = {text = "MIT"}
+87 -23
View File
@@ -82,20 +82,6 @@
}
}
},
"node_modules/@a2ui/markdown-it": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/@a2ui/markdown-it/-/markdown-it-0.0.4.tgz",
"integrity": "sha512-uaYNywdiHDH4i//pHpyckFnApvOshiUNT2Xl8awceNjL1XAX/gqtki9GRUJQ26RE7id2+aPNgOy1W6mXNBxriQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"dompurify": "^3.3.1",
"markdown-it": "^14.1.0"
},
"peerDependencies": {
"@a2ui/web_core": "^0.9.2"
}
},
"node_modules/@a2ui/react": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/@a2ui/react/-/react-0.10.0.tgz",
@@ -129,16 +115,16 @@
}
},
"node_modules/@a2ui/web_core": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/@a2ui/web_core/-/web_core-0.10.0.tgz",
"integrity": "sha512-pSieKxaB6aZWBL2LjZfKo4/1v4xMWylczpzte1ehuGH0kfNGf/iTd73PKsIKYx3b0FNWTbD8gAloOM4JCVqUig==",
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@a2ui/web_core/-/web_core-0.10.2.tgz",
"integrity": "sha512-IfS4K7baTL9P9AzUOzKRWzL9A9/+Z7TCgMY2GPwsZ0H7LgY/9/uJnlbReNhpHsAfN12KZtW9iERWkw5HOf71GA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@preact/signals-core": "^1.13.0",
"date-fns": "^4.1.0",
"@preact/signals-core": "^1.14.2",
"date-fns": "^4.4.0",
"zod": "^3.25.76",
"zod-to-json-schema": "^3.25.1"
"zod-to-json-schema": "^3.25.2"
}
},
"node_modules/@a2ui/web_core/node_modules/zod": {
@@ -5502,9 +5488,9 @@
}
},
"node_modules/date-fns": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz",
"integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.4.0.tgz",
"integrity": "sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w==",
"license": "MIT",
"funding": {
"type": "github",
@@ -9747,6 +9733,84 @@
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/@a2ui/react/node_modules/@a2ui/markdown-it": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/@a2ui/markdown-it/-/markdown-it-0.0.4.tgz",
"integrity": "sha512-uaYNywdiHDH4i//pHpyckFnApvOshiUNT2Xl8awceNjL1XAX/gqtki9GRUJQ26RE7id2+aPNgOy1W6mXNBxriQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"dompurify": "^3.3.1",
"markdown-it": "^14.1.0"
},
"peerDependencies": {
"@a2ui/web_core": "^0.9.2"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
"version": "1.8.1",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.1.0",
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
"version": "1.8.1",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
"version": "1.1.0",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
"version": "1.1.1",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "^1.7.1",
"@emnapi/runtime": "^1.7.1",
"@tybys/wasm-util": "^0.10.1"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Brooooooklyn"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
"version": "0.10.1",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
"version": "2.8.1",
"dev": true,
"inBundle": true,
"license": "0BSD",
"optional": true
}
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ interface ActionButtonsProps {
*/
export function ActionButtons({ actions, messageId, sessionId }: ActionButtonsProps) {
const [pendingActions, setPendingActions] = useState<Set<string>>(new Set())
const [hiddenActions, setHiddenActions] = useState<Set<string>>(new Set())
const [hiddenActions] = useState<Set<string>>(new Set())
const handleActionClick = useCallback(async (action: ActionButton) => {
if (pendingActions.has(action.id) || hiddenActions.has(action.id)) {
+1 -1
View File
@@ -73,7 +73,7 @@ export function AskActionPrompt({
{/* Action buttons */}
<div className="space-y-3">
{actions.map((action, index) => (
{actions.map((action) => (
<button
key={action.name}
type="button"
+2 -2
View File
@@ -15,7 +15,7 @@ import { Textarea } from '../components/ui/textarea';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../components/ui/select';
import { Slider } from '../components/ui/slider';
import { Switch } from '../components/ui/switch';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../components/ui/card';
import { Card, CardContent } from '../components/ui/card';
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from '../components/ui/sheet';
interface SettingsWidget {
@@ -74,7 +74,7 @@ const WidgetRenderer: React.FC<{
id={name}
placeholder={placeholder}
value={value || ''}
onChange={(e) => onChange(e.target.value)}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => onChange(e.target.value)}
maxLength={widget.maxLength}
rows={4}
/>
+7 -34
View File
@@ -20,43 +20,16 @@ interface CustomElementProps {
onError?: (error: Error) => void;
}
interface CustomComponentModule {
default: React.ComponentType<any>;
}
// Registry of loaded components (cache)
const componentCache = new Map<string, Promise<React.ComponentType<any>>>();
// List of available custom components (in practice, this would be populated from backend)
const availableComponents = new Set([
'ExampleWidget',
'UserCard',
'DataChart',
'FormBuilder',
'CodeEditor',
'ImageGallery',
'ChatEmbed'
]);
// Static imports for build-tool compatibility
const ExampleWidget = React.lazy(() => import('../components/custom/ExampleWidget'));
const UserCard = React.lazy(() => import('../components/custom/UserCard'));
const DataChart = React.lazy(() => import('../components/custom/DataChart'));
const FormBuilder = React.lazy(() => import('../components/custom/FormBuilder'));
const CodeEditor = React.lazy(() => import('../components/custom/CodeEditor'));
const ImageGallery = React.lazy(() => import('../components/custom/ImageGallery'));
const ChatEmbed = React.lazy(() => import('../components/custom/ChatEmbed'));
// Static mapping of component names to imports
const componentMap: Record<string, React.ComponentType<any>> = {
ExampleWidget,
UserCard,
DataChart,
FormBuilder,
CodeEditor,
ImageGallery,
ChatEmbed,
};
// Custom components available to <CustomElementHost name="..." />. The example
// widgets this once listed (ExampleWidget, UserCard, ...) were never added, and
// importing them broke the build. Register real components here as they land:
// const MyWidget = React.lazy(() => import('../components/custom/MyWidget'));
// componentMap.MyWidget = MyWidget;
const componentMap: Record<string, React.ComponentType<any>> = {};
const availableComponents = new Set(Object.keys(componentMap));
/**
* Load a custom component with static mapping for build-tool compatibility
-1
View File
@@ -4,7 +4,6 @@
* Shows live-updating task lists with states, progress bars, and click-to-jump functionality.
*/
import React from 'react'
import { ChevronRight, ChevronDown, CheckCircle, Clock, XCircle, Circle, ExternalLink } from 'lucide-react'
import { useTaskState, setTasksCollapsed, type Task, type TaskList, type TaskStatus } from '../state/tasks'
import { cn } from '../lib/utils'
+44
View File
@@ -0,0 +1,44 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const alertVariants = cva(
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
{
variants: {
variant: {
default: "bg-background text-foreground",
destructive:
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
},
defaultVariants: {
variant: "default",
},
}
)
const Alert = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
>(({ className, variant, ...props }, ref) => (
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
))
Alert.displayName = "Alert"
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
({ className, ...props }, ref) => (
<h5 ref={ref} className={cn("mb-1 font-medium leading-none tracking-tight", className)} {...props} />
)
)
AlertTitle.displayName = "AlertTitle"
const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
({ className, ...props }, ref) => (
<div ref={ref} className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
)
)
AlertDescription.displayName = "AlertDescription"
export { Alert, AlertTitle, AlertDescription }
@@ -0,0 +1,19 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<"textarea">>(
({ className, ...props }, ref) => (
<textarea
className={cn(
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className
)}
ref={ref}
{...props}
/>
)
)
Textarea.displayName = "Textarea"
export { Textarea }
+1 -1
View File
@@ -183,7 +183,7 @@ export function useMicStream(options: UseMicStreamOptions = {}): UseMicStreamRet
onConnectionChangeRef.current?.(false);
};
ws.onerror = (error) => {
ws.onerror = () => {
onErrorRef.current?.(new Error('WebSocket error'));
setConnected(false);
onConnectionChangeRef.current?.(false);
+28 -3
View File
@@ -5,8 +5,33 @@
* incoming messages from parent.
*/
import { useEffect, useCallback, useRef } from 'react';
import { useSSE } from './useSSE';
import { useEffect, useCallback, useRef, useState } from 'react';
interface EventSourceOptions {
enabled?: boolean;
onMessage?: (event: MessageEvent) => void;
onOpen?: () => void;
onError?: () => void;
}
/**
* Minimal EventSource subscription. (useSSE in this package is the chat
* streaming store, not a generic SSE hook, so it cannot open this stream.)
*/
function useEventSource(url: string, { enabled = true, onMessage, onOpen, onError }: EventSourceOptions) {
const [connected, setConnected] = useState(false);
const handlers = useRef({ onMessage, onOpen, onError });
handlers.current = { onMessage, onOpen, onError };
useEffect(() => {
if (!enabled || typeof EventSource === 'undefined') return;
const source = new EventSource(url);
source.onopen = () => { setConnected(true); handlers.current.onOpen?.(); };
source.onmessage = (event) => handlers.current.onMessage?.(event);
source.onerror = () => { setConnected(false); handlers.current.onError?.(); };
return () => { source.close(); setConnected(false); };
}, [url, enabled]);
return { connected };
}
export interface WindowMessageData {
type: string;
@@ -85,7 +110,7 @@ export function useWindowMessage(options: UseWindowMessageOptions = {}): UseWind
const isIframe = window !== window.parent;
// SSE connection for outbound messages
const { connected } = useSSE('/sse/window-message', {
const { connected } = useEventSource('/sse/window-message', {
enabled: enabled && isIframe,
onMessage: (event) => {
try {
@@ -7,9 +7,7 @@ import React, { useState } from 'react';
import { Button } from '../components/ui/button';
import { Input } from '../components/ui/input';
import { Label } from '../components/ui/label';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../components/ui/select';
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogFooter } from '../components/ui/dialog';
import { Separator } from '../components/ui/separator';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../components/ui/tabs';
interface AddMCPServerModalProps {
+9 -11
View File
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { Eye, AlertCircle } from 'lucide-react';
import { ChatMessages } from '../chat/ChatMessages';
import type { ChatMessage } from '../types';
import { Button } from '../components/ui/button';
interface SharedThreadData {
@@ -11,18 +11,13 @@ interface SharedThreadData {
title: string;
created_at: string;
};
messages: Array<{
id: string;
role: string;
content: string;
timestamp: string;
toolCalls?: any[];
}>;
messages: ChatMessage[];
read_only: boolean;
}
export function SharedThread() {
const { token } = useParams<{ token: string }>();
// Served at /shared/{token} (server.py); this app has no client-side router.
const token = decodeURIComponent(window.location.pathname.split('/shared/')[1]?.split('/')[0] ?? '');
const [threadData, setThreadData] = useState<SharedThreadData | null>(null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string>('');
@@ -128,10 +123,13 @@ export function SharedThread() {
<div className="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
{threadData.messages.length > 0 ? (
<div className="divide-y divide-gray-100">
<ChatMessages
<ChatMessages
messages={threadData.messages}
sessionId={threadData.thread_id}
isSharedView={true}
currentResponse=""
thinkingSteps={[]}
toolCalls={[]}
isStreaming={false}
/>
</div>
) : (
+1 -1
View File
@@ -1,3 +1,3 @@
"""Version information."""
__version__ = "0.3.147"
__version__ = "0.3.151"
+6 -2
View File
@@ -1303,9 +1303,11 @@ async def patch_session(request: Request) -> JSONResponse:
body = await request.json()
except Exception:
return JSONResponse({"error": "Invalid JSON"}, status_code=400)
title = body.get("title")
title = body.get("title") if isinstance(body, dict) else None
if title is not None:
await _datastore.update_session(session_id, title=title)
if not isinstance(title, str) or not title.strip():
return JSONResponse({"error": "title must be a non-empty string"}, status_code=400)
await _datastore.update_session(session_id, title=title.strip()[:200])
return JSONResponse({"status": "updated", "session_id": session_id})
@@ -3298,6 +3300,7 @@ def create_app(
"group": "Agent",
"description": "AI agent chat",
"order": 1,
"layout": "full-bleed",
},
{
"id": "chat-canvas",
@@ -3306,6 +3309,7 @@ def create_app(
"group": "Agent",
"description": "Chat with live A2UI preview panel",
"order": 2,
"layout": "full-bleed",
},
{
"id": "canvas",
@@ -378,6 +378,9 @@ const DASHBOARD_STYLE = `
.db-main { flex: 1; padding: 32px 40px; overflow-y: auto; min-width: 0; }
.db-main.db-clean { padding: 0; display: flex; flex-direction: column; overflow: hidden; height: 100vh; }
.db-main.db-clean > #db-page-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* Per-page full bleed (page.layout === 'full-bleed'): view fills the main column. */
.db-main.db-fill { display: flex; flex-direction: column; overflow: hidden; height: 100vh; box-sizing: border-box; }
.db-main.db-fill > #db-page-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.db-page-header { margin-bottom: 28px; }
.db-page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.db-page-icon svg, .db-nav-icon svg { display: inline-block; vertical-align: -0.125em; }
@@ -1992,8 +1995,12 @@ async function selectPage(pageId) {
return;
}
// Full-bleed pages (e.g. chat) fill the main column and carry their own chrome
const fullBleed = page.layout === 'full-bleed';
main.classList.toggle('db-fill', fullBleed);
// Set page header (controlled by dashboard config protocol)
const showPageHeader = main.dataset.showPageHeader !== 'false';
const showPageHeader = main.dataset.showPageHeader !== 'false' && !fullBleed;
const toolbarSlotId = `page:${pageId}:toolbar`;
const headerHtml = showPageHeader ? `
<div class="db-page-header">
@@ -164,6 +164,20 @@ function renderProgressBar(percentage) {
`;
}
function escapeAttr(value) {
return String(value).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
// Navigate to Chat and load the job's linked session (same event the
// session-search palette and run recorder use).
function openJobSession(sessionId) {
if (!sessionId) return;
const nav = (typeof window.aiui?.selectPage === 'function') ? window.aiui.selectPage('chat') : null;
Promise.resolve(nav).finally(() => {
window.dispatchEvent(new CustomEvent('aiui:session-select', { detail: { sessionId } }));
});
}
function renderJobRow(job) {
const status = job.status || 'queued';
const isTerminal = ['succeeded', 'failed', 'cancelled'].includes(status);
@@ -199,6 +213,7 @@ function renderJobRow(job) {
` : `
${_jobsCfg.backend !== 'praisonai' ? `<button class="aiui-btn aiui-btn-sm aiui-btn-delete" onclick="window.aiuiDeleteJob('${job.id}')" title="Delete">🗑️</button>` : ''}
`}
${job.session_id ? `<button class="aiui-btn aiui-btn-sm aiui-btn-open-session" data-session-id="${escapeAttr(job.session_id)}" onclick="window.aiuiOpenJobSession(this.dataset.sessionId)" title="Open session in Chat">💬</button>` : ''}
<button class="aiui-btn aiui-btn-sm aiui-btn-view" onclick="window.aiuiViewJob('${job.id}')" title="View Details">
👁️
</button>
@@ -599,6 +614,7 @@ function checkForJobsPage(root) {
window.aiuiCancelJob = cancelJob;
window.aiuiDeleteJob = deleteJob;
window.aiuiViewJob = viewJob;
window.aiuiOpenJobSession = openJobSession;
export default {
name: 'jobs',
@@ -21,6 +21,7 @@ function injectStyles() {
overflow: hidden;
}
.db-clean .chat-canvas-root { height: 100vh; }
.db-fill .chat-canvas-root { flex: 1; min-height: 0; height: auto; }
.chat-canvas-chat {
flex: 1 1 60%;
min-width: 0;
@@ -19,6 +19,7 @@ let isStreaming = false;
let streamingSessionId = null; // tracks which session is actively streaming
let currentRunId = null;
let agents = [];
let allSessions = []; // last fetched session list, filtered client-side by the rail search
let messageQueue = [];
let focusMode = false;
let sessionSelectHandler = null;
@@ -221,6 +222,11 @@ function injectStyles() {
style.textContent = `
.chat-root { display:flex; height:calc(100vh - 140px); gap:0; border-radius:12px; overflow:hidden; border:1px solid var(--db-border); background:var(--db-card-bg); }
.db-clean .chat-root { height:100%; border-radius:0; border:none; }
.db-fill .chat-root { flex:1; min-height:0; height:auto; }
@media (max-width:900px) {
.db-fill .chat-root { flex-direction:column; }
.db-fill .chat-sidebar-panel { width:100%; min-width:0; max-height:40vh; border-right:none; border-bottom:1px solid var(--db-border); }
}
.chat-root.focus-mode .chat-sidebar-panel { display:none; }
.chat-root.focus-mode .chat-main-panel { border-left:none; }
@@ -230,12 +236,17 @@ function injectStyles() {
.chat-sidebar-agent { padding:10px 16px; border-bottom:1px solid var(--db-border); }
.chat-sidebar-agent label { font-size:11px; color:var(--db-text-dim); display:block; margin-bottom:4px; text-transform:uppercase; font-weight:600; letter-spacing:.5px; }
.chat-sidebar-agent select { width:100%; padding:6px 10px; background:var(--db-card-bg); border:1px solid var(--db-border); border-radius:6px; color:var(--db-text); font-size:13px; }
.chat-sess-search { padding:8px 16px 0; }
.chat-sess-search input { width:100%; box-sizing:border-box; padding:6px 10px; background:var(--db-card-bg); border:1px solid var(--db-border); border-radius:6px; color:var(--db-text); font-size:13px; }
.chat-sess-list { flex:1; overflow-y:auto; padding:8px; }
.chat-sess-item { padding:10px 12px; border-radius:8px; cursor:pointer; margin-bottom:4px; font-size:13px; transition:background .15s; display:flex; flex-direction:column; gap:2px; }
.chat-sess-item:hover { background:rgba(var(--db-accent-rgb,100,100,255),.08); }
.chat-sess-item.active { background:rgba(var(--db-accent-rgb,100,100,255),.15); }
.chat-sess-item .sess-title { font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-sess-item .sess-meta { font-size:11px; color:var(--db-text-dim); }
.chat-sess-item { position:relative; }
.chat-sess-item .sess-rename { position:absolute; top:6px; right:6px; display:none; background:none; border:none; color:var(--db-text-dim); cursor:pointer; font-size:12px; padding:2px 4px; }
.chat-sess-item:hover .sess-rename, .chat-sess-item .sess-rename:focus { display:block; }
.chat-main-panel { flex:1; display:flex; flex-direction:column; min-width:0; }
.chat-top-bar { padding:10px 16px; border-bottom:1px solid var(--db-border); display:flex; align-items:center; justify-content:space-between; gap:10px; }
@@ -812,6 +823,9 @@ export async function render(container) {
<label>Agent</label>
<select id="chat-agent-selector"><option value="">Auto (default)</option></select>
</div>
<div class="chat-sess-search">
<input type="search" id="chat-session-search" placeholder="Search sessions…" aria-label="Search sessions" autocomplete="off">
</div>
<div class="chat-sess-list" id="chat-sessions-list"></div>
</div>
<div class="chat-main-panel">
@@ -892,6 +906,8 @@ export async function render(container) {
const agentSelector = document.getElementById('chat-agent-selector');
const attachBtn = document.getElementById('chat-attach-btn');
const fileInput = document.getElementById('chat-file-input');
const sessionSearch = document.getElementById('chat-session-search');
if (sessionSearch) sessionSearch.addEventListener('input', renderSessionList);
// Guard: if DOM elements aren't present yet (race condition), bail out
if (!input || !sendBtn) {
console.warn('[chat] DOM elements not ready — skipping event binding');
@@ -1039,47 +1055,92 @@ async function loadSessions() {
resp = await fetch('/sessions');
}
const data = await resp.json();
const sessions = data.sessions || data || [];
const list = document.getElementById('chat-sessions-list');
if (!list) return;
list.innerHTML = '';
if (sessions.length === 0) {
list.innerHTML = '<div style="padding:16px;text-align:center;color:var(--db-text-dim);font-size:12px">No sessions yet</div>';
return;
}
sessions.slice(0, 30).forEach((s) => {
const el = document.createElement('div');
const id = s.id || s.session_id || '';
el.className = 'chat-sess-item' + (id === currentSessionId ? ' active' : '');
// Show platform icon for channel sessions (e.g. Slack with SVG)
const platformName = s.platform || '';
const platSvg = _getPlatformSVG(platformName);
let title;
let titlePrefix = '';
if (platformName) {
const displayName = platformName.charAt(0).toUpperCase() + platformName.slice(1);
if (platSvg) {
titlePrefix = '<span class="sess-platform-icon ' + _getPlatformClass(platformName) + '">' + platSvg + '</span>';
}
title = displayName;
} else {
title = s.name || s.title || s.label || id.substring(0, 12) + '…';
}
const agent = s.agent_id || s.agent || '';
const time = timeAgo(s.created_at || s.updated_at);
el.innerHTML = `
<div class="sess-title">${titlePrefix}${escapeHtml(title)}</div>
<div class="sess-meta">${agent ? '🤖 ' + escapeHtml(agent) + ' · ' : ''}${time}</div>
`;
el.title = id;
el.addEventListener('click', () => loadSession(id));
list.appendChild(el);
});
const fetched = data.sessions || data || [];
allSessions = Array.isArray(fetched) ? fetched : [];
renderSessionList();
} catch (e) {
console.warn('[Chat] Failed to load sessions:', e);
}
}
function _sessionMatches(s, q) {
const fields = [s.id, s.session_id, s.name, s.title, s.label, s.agent_id, s.agent, s.platform];
return fields.some((v) => typeof v === 'string' && v.toLowerCase().includes(q));
}
function renderSessionList() {
const list = document.getElementById('chat-sessions-list');
if (!list) return;
const input = document.getElementById('chat-session-search');
const q = (input && input.value || '').trim().toLowerCase();
const sessions = q ? allSessions.filter((s) => _sessionMatches(s, q)) : allSessions;
list.innerHTML = '';
if (sessions.length === 0) {
const msg = q ? 'No matching sessions' : 'No sessions yet';
list.innerHTML = '<div style="padding:16px;text-align:center;color:var(--db-text-dim);font-size:12px">' + msg + '</div>';
return;
}
sessions.slice(0, 30).forEach((s) => {
const el = document.createElement('div');
const id = s.id || s.session_id || '';
el.className = 'chat-sess-item' + (id === currentSessionId ? ' active' : '');
// Show platform icon for channel sessions (e.g. Slack with SVG)
const platformName = s.platform || '';
const platSvg = _getPlatformSVG(platformName);
let title;
let titlePrefix = '';
if (platformName) {
const displayName = platformName.charAt(0).toUpperCase() + platformName.slice(1);
if (platSvg) {
titlePrefix = '<span class="sess-platform-icon ' + _getPlatformClass(platformName) + '">' + platSvg + '</span>';
}
title = displayName;
} else {
title = s.name || s.title || s.label || id.substring(0, 12) + '…';
}
const agent = s.agent_id || s.agent || '';
const time = timeAgo(s.created_at || s.updated_at);
el.innerHTML = `
<div class="sess-title">${titlePrefix}${escapeHtml(title)}</div>
<div class="sess-meta">${agent ? '🤖 ' + escapeHtml(agent) + ' · ' : ''}${time}</div>
`;
el.title = id;
el.addEventListener('click', () => loadSession(id));
if (!platformName && id) {
const btn = document.createElement('button');
btn.className = 'sess-rename';
btn.title = 'Rename session';
btn.setAttribute('aria-label', 'Rename session');
btn.textContent = '✎';
btn.addEventListener('click', (e) => { e.stopPropagation(); renameSession(id, title); });
el.appendChild(btn);
}
list.appendChild(el);
});
}
async function renameSession(sessionId, currentTitle) {
const next = (window.prompt('Rename session', currentTitle || '') || '').trim();
if (!next || next === currentTitle) return;
try {
const resp = await fetch('/sessions/' + encodeURIComponent(sessionId), {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: next }),
});
if (!resp.ok) throw new Error('HTTP ' + resp.status);
const s = allSessions.find((x) => (x.id || x.session_id) === sessionId);
if (s) { s.title = next; delete s.name; }
renderSessionList();
if (sessionId === currentSessionId) {
const header = document.getElementById('chat-header-title');
if (header) header.textContent = next;
}
} catch (e) {
console.warn('[Chat] Failed to rename session:', e);
}
}
async function loadSession(sessionId) {
currentSessionId = sessionId;
refreshStreamingUI();
@@ -1131,7 +1192,8 @@ async function loadSession(sessionId) {
title.textContent = (sessionIcon || '📨') + ' ' + displayName;
}
} else if (title) {
title.textContent = 'Session ' + sessionId.substring(0, 8);
const cached = allSessions.find((x) => (x.id || x.session_id) === sessionId);
title.textContent = (cached && (cached.name || cached.title)) || ('Session ' + sessionId.substring(0, 8));
}
} catch (e) {
console.warn('[Chat] Failed to load session:', e);
@@ -51,6 +51,9 @@ const PAIRS = {
};
const END_OF = Object.fromEntries(Object.entries(PAIRS).map(([s, e]) => [e, s]));
/** Events an agent run emits for itself (lifecycle, model and tool calls). */
const AGENT_RUN_EVENTS = new Set(['agent_start', 'agent_end', 'llm_request', 'llm_response', 'tool_call_start', 'tool_call_end']);
/** Approvers that mean "a person decided", anything else is an automatic source. */
const HUMAN_APPROVERS = new Set(['user', 'human', 'you', 'ui', 'replay', 'console', 'web', 'dashboard']);
@@ -172,7 +175,7 @@ export function narrate(ev, related = null) {
if (!ev || typeof ev !== 'object') return '';
const d = dataOf(ev);
const rd = dataOf(related);
const who = str(ev.agent_name) || 'The run';
const who = str(ev.agent_name) || (AGENT_RUN_EVENTS.has(ev.event_type) ? agentOf(ev) : '') || 'The run';
switch (ev.event_type) {
case 'session_start':
return 'Recording started.';
@@ -699,14 +702,32 @@ export function buildModel(events, graph = null) {
// ── graph helpers ─────────────────────────────────────────────────────
/** Graph node ids an event touches (node_id, else derived from agent/tool names). */
/**
* The agent an event belongs to. An unnamed agent (``Agent(instructions=...)``)
* has no agent_name: newer traces give it the id ``agent:Agent``, older ones
* ``tool:None/<tool>`` or nothing, so its own run events fall back to "Agent".
*/
export function agentOf(ev) {
if (!ev) return null;
if (ev.agent_name) return ev.agent_name;
const id = str(ev.node_id);
if (id.startsWith('agent:')) return id.slice(6) || 'Agent';
if (id.startsWith('tool:') && AGENT_RUN_EVENTS.has(ev.event_type)) {
const who = id.slice(5).split('/')[0];
return who && who !== 'None' ? who : 'Agent';
}
return AGENT_RUN_EVENTS.has(ev.event_type) ? 'Agent' : null;
}
export function nodeIdsForEvent(ev) {
const out = [];
if (!ev) return out;
if (ev.node_id) out.push(ev.node_id);
if (ev.node_id && !str(ev.node_id).startsWith('tool:None/')) out.push(ev.node_id);
const d = dataOf(ev);
if (ev.agent_name) {
out.push(ev.agent_name === 'Manager' ? MANAGER_LANE : `agent:${ev.agent_name}`);
if (d.tool_name) out.push(`tool:${ev.agent_name}/${d.tool_name}`);
const who = agentOf(ev);
if (who) {
out.push(who === 'Manager' ? MANAGER_LANE : `agent:${who}`);
if (d.tool_name) out.push(`tool:${who}/${d.tool_name}`);
}
if (String(ev.event_type).startsWith('approval_')) out.push(HUMAN_LANE);
return [...new Set(out)];
@@ -717,8 +738,11 @@ export function nodeIdsForEvent(ev) {
* sessions): agents, their tools, the manager and you, with hand-off/uses/reviews
* edges labelled with how often they happened.
*/
export function deriveGraph(events) {
export function deriveGraph(events, opts = {}) {
const evs = sortEvents(events);
// Unnamed agents count only when there is no recorded graph: a team graph
// leaves them out on purpose, and they must not reappear as "outside".
const nameOf = opts.unnamed === false ? (ev) => ev.agent_name || null : agentOf;
const nodes = new Map();
const edges = new Map();
const node = (id, kind, label) => { if (!nodes.has(id)) nodes.set(id, { id, kind, label, parent: null, meta: {} }); return id; };
@@ -732,16 +756,17 @@ export function deriveGraph(events) {
};
evs.forEach((ev) => {
const d = dataOf(ev);
if (ev.agent_name) agentNode(ev.agent_name);
if (ev.event_type === 'agent_handoff' && (d.from_agent || ev.agent_name) && d.to_agent) {
const who = nameOf(ev);
if (who) agentNode(who);
if (ev.event_type === 'agent_handoff' && (d.from_agent || who) && d.to_agent) {
const kind = { delegate: 'delegates', route: 'routes', spawn: 'handoff' }[d.kind] || 'handoff';
edge(agentNode(d.from_agent || ev.agent_name), agentNode(d.to_agent), kind);
} else if (ev.event_type === 'tool_call_start' && ev.agent_name && d.tool_name) {
const tool = node(`tool:${ev.agent_name}/${d.tool_name}`, 'tool', d.tool_name);
edge(agentNode(ev.agent_name), tool, 'uses');
edge(agentNode(d.from_agent || who), agentNode(d.to_agent), kind);
} else if (ev.event_type === 'tool_call_start' && who && d.tool_name) {
const tool = node(`tool:${who}/${d.tool_name}`, 'tool', d.tool_name);
edge(agentNode(who), tool, 'uses');
} else if (ev.event_type === 'approval_requested') {
const you = node(HUMAN_LANE, 'human', 'You');
const target = d.tool && ev.agent_name ? node(`tool:${ev.agent_name}/${d.tool}`, 'tool', d.tool) : (ev.agent_name ? agentNode(ev.agent_name) : null);
const target = d.tool && who ? node(`tool:${who}/${d.tool}`, 'tool', d.tool) : (who ? agentNode(who) : null);
if (target) edge(you, target, 'reviews');
}
});
@@ -929,7 +954,8 @@ export function layoutMap(graph, opts = {}) {
* them as "Outside the team". Without a recorded graph this is deriveGraph().
*/
export function observedGraph(graph, events) {
const derived = deriveGraph(events);
const hasGraph = Boolean(graph && Array.isArray(graph.nodes) && graph.nodes.length);
const derived = deriveGraph(events, { unnamed: !hasGraph });
if (!graph || !Array.isArray(graph.nodes) || !graph.nodes.length) return derived;
const nodes = graph.nodes.filter((n) => n && n.id).map((n) => ({ ...n, meta: { ...(n.meta || {}) } }));
const edges = (Array.isArray(graph.edges) ? graph.edges : []).filter((e) => e && e.source && e.target).map((e) => ({ ...e }));
@@ -1095,7 +1121,7 @@ export function edgeText(edge) {
const api = {
PALETTE, SHAPES, HUMAN_LANE, MANAGER_LANE, EDGE_WORDS,
buildModel, narrate, layoutMap, layoutRunMap, observedGraph, deriveGraph, nodeIdsForEvent, nodeStates, pairEvents, sortEvents,
buildModel, narrate, layoutMap, layoutRunMap, observedGraph, deriveGraph, nodeIdsForEvent, agentOf, nodeStates, pairEvents, sortEvents,
eventId, formatDuration, formatCost, argPreview, truncate, stripPrefix, edgeText,
};
if (typeof globalThis !== 'undefined') globalThis.PraisonReplayCore = api;
+51
View File
@@ -456,3 +456,54 @@ test('nodeStates: a recorded flow fixture ends with every visited node done or f
assert.ok(st.size > 0);
for (const [id, v] of st) assert.notEqual(v.state, 'running', `${id} still running after the run ended`);
});
// ── unnamed agents (Agent(instructions=...), agent_name null) ────────────
const unnamedRun = (newIds) => [
{ sequence_num: 0, timestamp: 1, event_type: 'session_start', agent_name: null },
{ sequence_num: 1, timestamp: 2, event_type: 'agent_start', agent_name: null, node_id: newIds ? 'agent:Agent' : null },
{ sequence_num: 2, timestamp: 3, event_type: 'llm_request', agent_name: null, node_id: newIds ? 'agent:Agent' : null },
{ sequence_num: 3, timestamp: 4, event_type: 'llm_response', agent_name: null, node_id: newIds ? 'agent:Agent' : null },
{ sequence_num: 4, timestamp: 5, event_type: 'tool_call_start', agent_name: null, node_id: newIds ? 'tool:Agent/search' : 'tool:None/search', data: { tool_name: 'search' } },
{ sequence_num: 5, timestamp: 6, event_type: 'tool_call_end', agent_name: null, node_id: newIds ? 'tool:Agent/search' : 'tool:None/search', data: { tool_name: 'search' } },
{ sequence_num: 6, timestamp: 7, event_type: 'agent_end', agent_name: null, node_id: newIds ? 'agent:Agent' : null, data: newIds ? { status: 'completed' } : {} },
{ sequence_num: 7, timestamp: 8, event_type: 'session_end', agent_name: null },
];
for (const newIds of [true, false]) {
test(`unnamed agent is mapped as "Agent" (${newIds ? 'new' : '4.7.19'} trace ids)`, () => {
const g = deriveGraph(unnamedRun(newIds));
assert.deepEqual(g.nodes.map((n) => [n.id, n.label]), [['agent:Agent', 'Agent'], ['tool:Agent/search', 'search']]);
assert.deepEqual(g.edges.map((e) => `${e.source}->${e.target}:${e.kind}`), ['agent:Agent->tool:Agent/search:uses']);
const st = core.nodeStates(unnamedRun(newIds), Infinity, g.nodes);
assert.equal(st.get('agent:Agent').state, 'done');
assert.equal(st.get('tool:Agent/search').state, 'done');
assert.ok(![...st.keys()].some((k) => k.includes('None')), 'no tool:None ids leak into the map');
});
}
test('a failed unnamed agent run is red on the map', () => {
const evs = unnamedRun(true);
evs[6] = { ...evs[6], data: { status: 'failed' } };
assert.equal(core.nodeStates(evs, Infinity, deriveGraph(evs).nodes).get('agent:Agent').state, 'failed');
});
test('unnamed agents do not reappear "outside" a recorded team graph', () => {
const graph = { schema: 'praisonai.graph/1', kind: 'team', nodes: [
{ id: 'start:begin', kind: 'start', label: 'Brief' }, { id: 'task:t', kind: 'task', label: 't' }, { id: 'end:done', kind: 'end', label: 'Delivered' }],
edges: [{ source: 'start:begin', target: 'task:t', kind: 'next' }, { source: 'task:t', target: 'end:done', kind: 'next' }] };
const og = core.observedGraph(graph, unnamedRun(true));
assert.deepEqual(og.nodes.map((n) => n.id), ['start:begin', 'task:t', 'end:done']);
assert.deepEqual(og.outside, []);
});
test('named agents are unchanged', () => {
const evs = unnamedRun(true).map((e) => ({ ...e, agent_name: e.agent_name === null && e.event_type !== 'session_start' && e.event_type !== 'session_end' ? 'Writer' : e.agent_name, node_id: e.node_id && e.node_id.replace('Agent', 'Writer') }));
assert.deepEqual(deriveGraph(evs).nodes.map((n) => n.id), ['agent:Writer', 'tool:Writer/search']);
});
test('an unnamed agent is narrated as "Agent", not "The run"', () => {
const evs = unnamedRun(true);
assert.equal(narrate(evs[1]), 'Agent started.');
assert.equal(narrate(evs[7]).startsWith('Recording'), true);
});
+54
View File
@@ -0,0 +1,54 @@
"""Regression tests for #322 — Chat must fill the dashboard main column.
Chat pages declare ``layout: "full-bleed"``; ``selectPage()`` then adds
``db-fill`` to ``#db-main-content`` and skips the duplicate page header, and
``.chat-root`` sizes from flex allocation instead of ``calc(100vh - 140px)``.
"""
from __future__ import annotations
import re
from pathlib import Path
PLUGINS = (
Path(__file__).resolve().parents[2]
/ "src" / "praisonaiui" / "templates" / "frontend" / "plugins"
)
def _select_page_body() -> str:
src = (PLUGINS / "dashboard.js").read_text(encoding="utf-8")
m = re.search(r"async function selectPage\(pageId\)\s*\{(.*?)^}", src, re.DOTALL | re.MULTILINE)
assert m
return m.group(1)
def test_chat_pages_declare_full_bleed():
from starlette.testclient import TestClient
from praisonaiui.server import create_app, reset_state
reset_state() # isolate from page whitelists set by other tests
pages = {p["id"]: p for p in TestClient(create_app()).get("/api/pages").json()["pages"]}
for pid in ("chat", "chat-canvas"):
assert pages[pid].get("layout") == "full-bleed"
assert pages["overview"].get("layout") is None
def test_select_page_toggles_fill_and_skips_header():
body = _select_page_body()
assert "page.layout === 'full-bleed'" in body
assert "classList.toggle('db-fill'" in body
assert re.search(r"showPageHeader = .*&& !fullBleed", body)
def test_fill_css_defined():
src = (PLUGINS / "dashboard.js").read_text(encoding="utf-8")
assert ".db-main.db-fill > #db-page-content" in src
def test_chat_root_fills_column_in_fill_mode():
chat = (PLUGINS / "views" / "chat.js").read_text(encoding="utf-8")
assert re.search(r"\.db-fill \.chat-root \{[^}]*flex:1;[^}]*min-height:0", chat)
canvas = (PLUGINS / "views" / "chat-canvas.js").read_text(encoding="utf-8")
assert ".db-fill .chat-canvas-root" in canvas
@@ -0,0 +1,31 @@
"""Tests for the in-rail session search in the chat view (issue #324).
The chat sidebar must expose a search input that filters the already
fetched session list client-side, without refetching from the API.
"""
from pathlib import Path
CHAT = Path("src/praisonaiui/templates/frontend/plugins/views/chat.js")
class TestChatSessionRailSearch:
def test_search_input_rendered_in_rail(self):
src = CHAT.read_text()
assert 'id="chat-session-search"' in src
assert src.index('id="chat-session-search"') < src.index('id="chat-sessions-list"')
def test_input_wired_to_client_side_render(self):
src = CHAT.read_text()
assert "sessionSearch.addEventListener('input', renderSessionList)" in src
def test_load_sessions_caches_and_delegates_render(self):
src = CHAT.read_text()
assert "allSessions = Array.isArray(fetched) ? fetched : [];" in src
body = src.split("async function loadSessions()", 1)[1].split("\n}\n", 1)[0]
assert "renderSessionList();" in body
def test_filter_matches_title_and_id_fields(self):
src = CHAT.read_text()
assert "function _sessionMatches(s, q)" in src
assert "No matching sessions" in src
+49
View File
@@ -0,0 +1,49 @@
"""Issue #331 — rename a session from the chat rail via the existing PATCH route."""
from __future__ import annotations
import asyncio
from pathlib import Path
from starlette.applications import Starlette
from starlette.routing import Route
from starlette.testclient import TestClient
import praisonaiui.server as server
from praisonaiui.datastore import MemoryDataStore
CHAT = Path("src/praisonaiui/templates/frontend/plugins/views/chat.js")
def _client(monkeypatch):
ds = MemoryDataStore()
monkeypatch.setattr(server, "_datastore", ds)
app = Starlette(routes=[Route("/sessions/{session_id}", server.patch_session, methods=["PATCH"])])
sid = asyncio.run(ds.create_session())["id"]
return TestClient(app), ds, sid
def test_patch_renames_and_trims(monkeypatch):
client, ds, sid = _client(monkeypatch)
r = client.patch(f"/sessions/{sid}", json={"title": " My chat "})
assert r.status_code == 200
assert asyncio.run(ds.get_session(sid))["title"] == "My chat"
def test_patch_rejects_blank_or_non_string_title(monkeypatch):
client, _, sid = _client(monkeypatch)
assert client.patch(f"/sessions/{sid}", json={"title": " "}).status_code == 400
assert client.patch(f"/sessions/{sid}", json={"title": 123}).status_code == 400
def test_patch_unknown_session_404(monkeypatch):
client, _, _ = _client(monkeypatch)
assert client.patch("/sessions/nope", json={"title": "x"}).status_code == 404
def test_rail_has_rename_button_wired_to_patch():
src = CHAT.read_text()
assert "async function renameSession(sessionId, currentTitle)" in src
assert "method: 'PATCH'" in src
assert "renameSession(id, title)" in src
assert "e.stopPropagation()" in src
+31
View File
@@ -0,0 +1,31 @@
"""Issue #323 — Jobs rows link to their chat session when ``session_id`` is set.
Source-parsing test, mirroring ``test_session_search_dashboard.py``.
"""
from __future__ import annotations
from pathlib import Path
JOBS_JS = (
Path(__file__).resolve().parents[2]
/ "src" / "praisonaiui" / "templates" / "frontend" / "plugins" / "jobs.js"
)
def _src() -> str:
return JOBS_JS.read_text(encoding="utf-8")
def test_open_session_button_only_when_session_id():
src = _src()
assert "job.session_id ? `<button" in src
assert 'data-session-id="${escapeAttr(job.session_id)}"' in src
def test_open_session_reuses_session_select_event():
src = _src()
assert "function openJobSession(sessionId)" in src
assert "selectPage('chat')" in src
assert "'aiui:session-select'" in src
assert "window.aiuiOpenJobSession = openJobSession;" in src
Generated
+2 -2
View File
@@ -1,5 +1,5 @@
version = 1
revision = 3
revision = 5
requires-python = ">=3.10"
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'win32'",
@@ -207,7 +207,7 @@ wheels = [
[[package]]
name = "aiui"
version = "0.3.147"
version = "0.3.151"
source = { editable = "." }
dependencies = [
{ name = "pydantic" },