Skip to content

Commit c2750bc

Browse files
ahmad-ajmalCraftBotclaudemakiroll1125zfoong
authored
Session native redesign (#404)
* New session logic revamp * UI update for chat session update * Added end turn action * remove GUI mode entirely * session improvement on ui and prompt * trigger aggregation update * trigger aggregation update and fix idempotency guard issue, turn it off for now * Session UI iteration: always-Working live row, chunked activity view, reply-to-bubble, activity restore, title fallback, run-end flicker fix Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Session update * remove task end action and ui fix * UI fixes for session revamp * Fix: requestChatHistory applied message limit per session, correct loading * Revert "Fix: requestChatHistory applied message limit per session, correct loading" This reverts commit abf402f. * fix cached tokens and percentage calculator * new tokens command and fix on token calculation * Livingui redesign (#399) * Living UI V2: replace FastAPI/Vite system with PocketBase + vendored-kit platform - New standalone living-ui-v2/ workspace: versioned React kit (realtime PB hooks, theme packs, console relay), project blueprint, and `lui` CLI (create/validate/dev/kit-sync/pb/ops/run/data/verify/probe) - Validation gate: types, build, migrations-on-fresh-db, ops manifest, ownership hashes — with source-annotated errors and a same-error breaker - walk_verify sub-agent: drives the running app in a real browser (playwright MCP) and blocks launch on observed defects (PR #388 contract) - Manager/actions rewritten for single-process PB apps; V1 template, importer, and sidecar removed; ZIP import is deterministic code - Creation wizard (layout/theme/reference files), option-chip QnA, session handoff, spec suite under living-ui-v2/spec/ * Add form and QnA workflow, some UI update * Theme fix * Living UI: shadcn-conventional kit APIs + approved npm dependency gate * living UI building visualizer * living UI visual update during creation * separate walk verify + headless browser * living UI import * Add more ShadCN compatible UI component * allow installing any npm * auth fix * fix cli issue * Fix: Hide terminal pop ups * Fix: Revert dev branch for living ui repo URL * Fix: Chat panel shows after installing Living UI for the first time * Fix: Include sessionId in both places that broadcast living_ui_ready * Fix: Make ensure_project_session() checks non-fatal * Fix: Assign env vars for callLLM() for Living UIs * Revert changes Living UI marketplace links * Error Catalogue revamp. �gent_core/core/errors.py provides new shared error formatting and cataloguing. Add immediate aborting of AUTH/CREDIT/QUOTA/MODEL/BLOCKED/BAD_REQUEST errors instead of silent retries. * Fix: Ensure no consecutive errors, revert system error changes * Add A2APP — make agent writes to Living UIs verifiable An agent asked to "add a todo for tomorrow" wrote due_date: "tomorrow". PocketBase returned 200, stored an empty string, and the agent told the user it was scheduled. It had to guess what the app contained, the write silently failed, and nothing stopped it claiming otherwise. All three are now handled in the app, so any agent benefits — verified by driving an app with curl alone, after deleting .superuser. In the app (new pb_hooks, adapter 1.6.0): - describe: entities, protocol types, conventions, from the live schema - identity: PocketBase answers 200 for unknown paths, so an "a2app" marker is the only reliable probe - write guard as router middleware, not a record hook — PocketBase coerces first, after which "tomorrow" and "" are indistinguishable - read-back backstop; errors carry a code and list every violation - origin guard, agent token, ops auth, rate limits, idempotency In the CLI: - reads describe, not PocketBase's superuser-only admin endpoint, so it holds no privilege an outside agent lacks - resolves dates and labels client-side, where a clock and Intl exist - adapter-sync ships hooks without re-vendoring the kit - a valueless --flag now errors instead of becoming `true` - gate rejects e.app inside runInTransaction, which deadlocks the process while /api/health still returns 200 In CraftBot: - the system reports what changed, from the stored record; a false claim is withheld and handed back rather than corrected in front of the user - the data model is inlined into the prompt — three attempts became one - skills load per run, so operating an app no longer carries the build recipe that rebuilt a live app after one row insert - integration bridge: capability gate, destination allowlist, no redirects adapter-sync runs at create, install, import and launch — launch is the only path reaching an app a user already had. Adds spec/OVERVIEW.md and scripts/a2app-selfcheck.sh (21 checks). * lint fixes * Split error messages into two presentation tiers based level of important + Fix Chat persistency * Fix: Testing and edge case fixes (blocked content error, NoneType crashes) * Improvement: Sync test between ErrorCategory and ERROR_CATEGORY_STYLE * Port error catalogue to Provider interfaces (embedding interface, image gen, video gen, factory + plan migration to actions, browser_adapter, CLI commands * Add the Factory — deterministic build orchestration for weak models Weak models write code well but manage themselves badly: 26 logged builds, and every failure was self-management — churning on one dead end, fabricating causes where evidence was blank, shrinking "email me" into "logs it", announcing success after failed verification, or quitting unnoticed. The model keeps the hands; this takes away the clipboard. - app/factory: stdlib-pure Machine (persisted arc, 3×/12 retry caps, escalation, redispatch-on-surrender, honest stuck reports), defect cards (cause = quoted evidence or "unknown" — theories unrepresentable), build graph as a pure transition (only a parsed PASS reaches done), distiller, cookbooks (one generic callAction pattern + dry-run param discovery, email as the proven worked example), CraftBot host adapter; layering lint + 3 test suites incl. replays of two real incidents. - Fix missions are fresh runs carrying cards; ready/stuck messages are machine-composed — agent-authored status is retired. - Evidence everywhere the platform was silent: gate stderr, response bodies, refused-request URLs, boot-log excerpts, handler exceptions, migrate-hang kills, pre-boot migration-rename check, CLI error.cause unwrapping. - Integrations: bridge action endpoint runs CraftBot's own implementations (send_gmail, semantic params), grants derived from code by the gate, irreversible-confirm + dry-run; omitted `to` = account owner — apps never hold identity. Wizard offers marketplace matches; capability map injected. - Verifier: full spec coverage required, value plausibility, fail-closed verdict parsing. * Removed false claim gate --------- Co-authored-by: CraftBot <craftbot@craftbot.dev> Co-authored-by: Tobias Garcia <iguana3000tg@gmail.com> Co-authored-by: イツミネ <tham_yikfoong@outlook.com> * expose raw_input in /tokens data Input is displayed as input - cached, which is lossy; include the pre-subtraction value for debugging and event consumers. * Fixed Uneven Ratio Bar, All Ratios add to 100% and Bar Displays Input, Output and Cached * Fix living UI data update flashing issue * Fix working status issue * minor side panel UI update * show event summarization in chat session * fix chat session naming issue * Living UI Workflows + DB Snapshot * Add force-stop for in-flight runs (#403) Co-authored-by: CraftBot <craftbot@craftbot.dev> * CraftBot version on marketplace apps * Fix whatsapp issue * Version Change --------- Co-authored-by: CraftBot <craftbot@craftbot.dev> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Tobias Garcia <iguana3000tg@gmail.com> Co-authored-by: イツミネ <tham_yikfoong@outlook.com> Co-authored-by: AlanAAG <alanayalag@gmail.com> Co-authored-by: RooberSmoth <96537304+RooberSmoth@users.noreply.github.com>
1 parent 9fcab95 commit c2750bc

489 files changed

Lines changed: 41940 additions & 35446 deletions

File tree

Some content is hidden

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

.github/workflows/living-ui-v2.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: living-ui-v2
2+
3+
# Self-test for the Living UI TEMPLATE code (kit/blueprint/tools) in this repo.
4+
# Scaffolds a throwaway project and runs the local validation gate on it.
5+
# User-made Living UIs never touch this workflow — they validate locally.
6+
7+
on:
8+
push:
9+
paths:
10+
- 'living-ui-v2/**'
11+
- '.github/workflows/living-ui-v2.yml'
12+
pull_request:
13+
paths:
14+
- 'living-ui-v2/**'
15+
- '.github/workflows/living-ui-v2.yml'
16+
17+
defaults:
18+
run:
19+
working-directory: living-ui-v2
20+
21+
jobs:
22+
gate:
23+
name: gate (${{ matrix.os }})
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest, macos-latest, windows-latest]
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 24
35+
36+
- name: Cache PocketBase binary
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/Library/Caches/craftos-living-ui/pb
41+
~/.cache/craftos-living-ui/pb
42+
~\AppData\Local\craftos-living-ui\pb
43+
key: pb-${{ runner.os }}-${{ hashFiles('living-ui-v2/spec/pocketbase.version') }}
44+
45+
- name: Install workspace
46+
run: npm install
47+
48+
- name: Typecheck (kit + tools)
49+
run: npm run typecheck
50+
51+
- name: Lint
52+
run: npx eslint .
53+
54+
- name: Scaffold demo project
55+
run: node tools/src/cli.ts create "CI Demo" --description "CI validation project" --port 8090
56+
57+
- name: Link demo workspace
58+
run: npm install
59+
60+
- name: Validation gate
61+
run: node tools/src/cli.ts validate examples/ci-demo

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ docs/LIVING_UI_DEVELOPER_GUIDE.md
5858
agent_file_system/ACTIONS.md
5959
agent_bundle/
6060
**/.craftbot/
61-
app/data/.file_index/
61+
app/data/.file_index/
62+
.playwright-mcp

.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ extend-exclude = [
1212
"agents/dog_agent/data/action/dog_behaviour.py" = ["E402"]
1313
"app/action/action_framework/run_actions_tests.py" = ["E402"]
1414
"app/config.py" = ["E402"]
15-
"app/llm_interface.py" = ["E402"]
1615
"app/main.py" = ["E402"]
1716
"craftos_integrations/__init__.py" = ["E402"]

agent_core/__init__.py

Lines changed: 21 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
get_state_or_none,
1717
AgentProperties,
1818
ReasoningResult,
19-
TaskSummary,
2019
MainState,
2120
DEFAULT_MAX_ACTIONS_PER_TASK,
2221
DEFAULT_MAX_TOKEN_PER_TASK,
@@ -34,7 +33,13 @@
3433
from agent_core.core.image_gen_interface import ImageGenInterface
3534
from agent_core.core.database_interface import DatabaseInterface
3635
from agent_core.core.trigger import Trigger
37-
from agent_core.core.task import Task, TodoItem, TodoStatus
36+
from agent_core.core.session import (
37+
Session,
38+
SessionType,
39+
TodoItem,
40+
TodoStatus,
41+
MAIN_SESSION_ID,
42+
)
3843
from agent_core.core.action_framework import (
3944
ActionRegistry,
4045
ActionMetadata,
@@ -113,10 +118,10 @@
113118
get_event_stream_or_none,
114119
get_event_stream_manager,
115120
get_event_stream_manager_or_none,
116-
# Task manager
117-
TaskManagerRegistry,
118-
get_task_manager,
119-
get_task_manager_or_none,
121+
# Session manager
122+
SessionManagerRegistry,
123+
get_session_manager,
124+
get_session_manager_or_none,
120125
# State manager
121126
StateManagerRegistry,
122127
get_state_manager,
@@ -125,15 +130,8 @@
125130
ContextEngineRegistry,
126131
get_context_engine,
127132
get_context_engine_or_none,
128-
# Trigger queue
129-
TriggerQueueRegistry,
130-
get_trigger_queue,
131-
get_trigger_queue_or_none,
132133
)
133134
from agent_core.core.hooks import (
134-
OnTaskCreatedHook,
135-
OnTaskEndedHook,
136-
OnTodoTransitionHook,
137135
OnActionStartHook,
138136
OnActionEndHook,
139137
OnEventLoggedHook,
@@ -152,18 +150,15 @@
152150
ActionLibrary,
153151
ActionRouter,
154152
ActionManager,
155-
set_gui_execute_hook,
156153
)
157154
from agent_core.core.impl.memory import (
158155
MemoryManager,
159156
MemoryFileWatcher,
160157
MemoryPointer,
161158
MemoryChunk,
162-
create_memory_processing_task,
163159
)
164160
from agent_core.core.impl.llm import LLMCallType
165-
from agent_core.core.impl.trigger import TriggerQueue
166-
from agent_core.core.impl.workflow_lock import WorkflowLockManager
161+
from agent_core.core.impl.trigger import SessionTriggerQueue, QueueClosed
167162
from agent_core.core.impl.event_stream import (
168163
EventStream,
169164
EventStreamManager,
@@ -180,28 +175,13 @@
180175
EVENT_STREAM_SUMMARIZATION_PROMPT,
181176
# Action prompts
182177
SELECT_ACTION_PROMPT,
183-
SELECT_ACTION_IN_TASK_PROMPT,
184-
SELECT_ACTION_IN_GUI_PROMPT,
185-
SELECT_ACTION_IN_SIMPLE_TASK_PROMPT,
186-
GUI_ACTION_SPACE_PROMPT,
187178
# Context prompts
188179
AGENT_ROLE_PROMPT,
189180
AGENT_INFO_PROMPT,
190181
POLICY_PROMPT,
191182
USER_PROFILE_PROMPT,
192183
ENVIRONMENTAL_CONTEXT_PROMPT,
193184
AGENT_FILE_SYSTEM_CONTEXT_PROMPT,
194-
# Routing prompts
195-
ROUTE_TO_SESSION_PROMPT,
196-
# GUI prompts
197-
GUI_REASONING_PROMPT,
198-
GUI_REASONING_PROMPT_OMNIPARSER,
199-
GUI_QUERY_FOCUSED_PROMPT,
200-
GUI_PIXEL_POSITION_PROMPT,
201-
# Skill selection prompts
202-
SKILLS_AND_ACTION_SETS_SELECTION_PROMPT,
203-
SKILL_SELECTION_PROMPT,
204-
ACTION_SET_SELECTION_PROMPT,
205185
)
206186

207187
# MCP
@@ -259,7 +239,6 @@
259239
"get_state_or_none",
260240
"AgentProperties",
261241
"ReasoningResult",
262-
"TaskSummary",
263242
"MainState",
264243
"DEFAULT_MAX_ACTIONS_PER_TASK",
265244
"DEFAULT_MAX_TOKEN_PER_TASK",
@@ -300,10 +279,12 @@
300279
"PLATFORM_LINUX",
301280
"PLATFORM_WINDOWS",
302281
"PLATFORM_DARWIN",
303-
# Task management
304-
"Task",
282+
# Session management
283+
"Session",
284+
"SessionType",
305285
"TodoItem",
306286
"TodoStatus",
287+
"MAIN_SESSION_ID",
307288
# Event stream
308289
"Event",
309290
"EventRecord",
@@ -354,32 +335,27 @@
354335
"get_event_stream_or_none",
355336
"get_event_stream_manager",
356337
"get_event_stream_manager_or_none",
357-
"TaskManagerRegistry",
358-
"get_task_manager",
359-
"get_task_manager_or_none",
338+
"SessionManagerRegistry",
339+
"get_session_manager",
340+
"get_session_manager_or_none",
360341
"StateManagerRegistry",
361342
"get_state_manager",
362343
"get_state_manager_or_none",
363344
"ContextEngineRegistry",
364345
"get_context_engine",
365346
"get_context_engine_or_none",
366-
"TriggerQueueRegistry",
367-
"get_trigger_queue",
368-
"get_trigger_queue_or_none",
369347
# Implementations
370348
"ActionExecutor",
371349
"ActionLibrary",
372350
"ActionRouter",
373351
"ActionManager",
374-
"set_gui_execute_hook",
375352
"MemoryManager",
376353
"MemoryFileWatcher",
377354
"MemoryPointer",
378355
"MemoryChunk",
379-
"create_memory_processing_task",
380356
"LLMCallType",
381-
"TriggerQueue",
382-
"WorkflowLockManager",
357+
"SessionTriggerQueue",
358+
"QueueClosed",
383359
"EventStream",
384360
"EventStreamManager",
385361
# Prompts - Registry
@@ -391,32 +367,14 @@
391367
"EVENT_STREAM_SUMMARIZATION_PROMPT",
392368
# Prompts - Action
393369
"SELECT_ACTION_PROMPT",
394-
"SELECT_ACTION_IN_TASK_PROMPT",
395-
"SELECT_ACTION_IN_GUI_PROMPT",
396-
"SELECT_ACTION_IN_SIMPLE_TASK_PROMPT",
397-
"GUI_ACTION_SPACE_PROMPT",
398370
# Prompts - Context
399371
"AGENT_ROLE_PROMPT",
400372
"AGENT_INFO_PROMPT",
401373
"POLICY_PROMPT",
402374
"USER_PROFILE_PROMPT",
403375
"ENVIRONMENTAL_CONTEXT_PROMPT",
404376
"AGENT_FILE_SYSTEM_CONTEXT_PROMPT",
405-
# Prompts - Routing
406-
"ROUTE_TO_SESSION_PROMPT",
407-
# Prompts - GUI
408-
"GUI_REASONING_PROMPT",
409-
"GUI_REASONING_PROMPT_OMNIPARSER",
410-
"GUI_QUERY_FOCUSED_PROMPT",
411-
"GUI_PIXEL_POSITION_PROMPT",
412-
# Prompts - Skill selection
413-
"SKILLS_AND_ACTION_SETS_SELECTION_PROMPT",
414-
"SKILL_SELECTION_PROMPT",
415-
"ACTION_SET_SELECTION_PROMPT",
416377
# Hooks
417-
"OnTaskCreatedHook",
418-
"OnTaskEndedHook",
419-
"OnTodoTransitionHook",
420378
"OnActionStartHook",
421379
"OnActionEndHook",
422380
"OnEventLoggedHook",

agent_core/core/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
from agent_core.core.vlm_interface import VLMInterface
1313
from agent_core.core.database_interface import DatabaseInterface
1414
from agent_core.core.trigger import Trigger
15-
from agent_core.core.task import Task, TodoItem, TodoStatus
15+
from agent_core.core.session import (
16+
Session,
17+
SessionType,
18+
TodoItem,
19+
TodoStatus,
20+
MAIN_SESSION_ID,
21+
)
1622
from agent_core.core.action_framework import (
1723
ActionRegistry,
1824
ActionMetadata,
@@ -55,10 +61,12 @@
5561
"get_cache_metrics",
5662
# Trigger
5763
"Trigger",
58-
# Task
59-
"Task",
64+
# Session
65+
"Session",
66+
"SessionType",
6067
"TodoItem",
6168
"TodoStatus",
69+
"MAIN_SESSION_ID",
6270
# Action framework
6371
"ActionRegistry",
6472
"ActionMetadata",

0 commit comments

Comments
 (0)