@praxisui/ai 8.0.0-beta.0 → 8.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,6 @@ source_of_truth:
22
22
  - "projects/praxis-ai/README.md"
23
23
  - "projects/praxis-ai/docs/ai-deployment-flow.md"
24
24
  related_docs:
25
- - "core-public-surfaces-guide"
26
25
  - "host-integration-guide"
27
26
  ---
28
27
 
@@ -62,10 +61,65 @@ Peer dependencies (Angular v20):
62
61
  ## What this package is responsible for
63
62
 
64
63
  - assistant UX surfaces and interaction flow
64
+ - reusable assistant shell primitives such as conversation messages, quick replies, prompt composer, apply actions and drag/resize chrome
65
65
  - backend API orchestration for provider catalog, suggestions, and patch generation
66
66
  - local lightweight session history with tenant/env/user scoping
67
67
  - confirmation and risk policy integration for sensitive changes
68
68
 
69
+ `PraxisAiAssistantShellComponent` is the reusable shell for specialized authoring flows that own their own backend contract, such as Page Builder agentic authoring. It provides the conversational chrome and emits UI events; it does not resolve intent, call providers, compile Praxis JSON, or persist page configuration.
70
+
71
+ ### Canonical assistant shell
72
+
73
+ `PraxisAiAssistantShellComponent` is the canonical chrome for Praxis assistant experiences that need a conversational surface. Hosts should prefer it for new specialized flows instead of creating component-local assistant UI.
74
+
75
+ The shell owns the shared UX primitives:
76
+ - conversation messages and message actions such as edit/resend/custom actions
77
+ - prompt composer, Enter-to-submit behavior, pasted or selected file attachments, submit/apply actions and attach/remove attachment events
78
+ - active context chips for component, schema, selection, route, tenant or custom context
79
+ - attached context metadata for files, images, JSON, schema and text payloads
80
+ - mode and state labels for `config`, `agentic-authoring`, `chat`, `diagnostic`, `review` and `inline-help`
81
+ - draggable/resizable panel layout and accessibility labels
82
+
83
+ The shell intentionally does not own component semantics. Specialized flows still own their adapter/service contract:
84
+ - configuration assistants continue to use `AiConfigAdapter`, capabilities, suggestions and patch review
85
+ - Page Builder agentic authoring continues to use `/api/praxis/config/ai/authoring/**`
86
+ - future metadata/editorial flows should provide their own preview/apply contract while reusing the same shell chrome
87
+
88
+ This keeps a single assistant identity across Praxis components while preserving the canonical owner of each config or authoring document.
89
+
90
+ The shell ships with centralized PT-BR default labels and accepts the `labels` input for a flow-specific override. The override is partial: omitted labels continue to come from the shared defaults.
91
+
92
+ By default, the prompt composer submits with `Enter` and keeps `Shift+Enter` for multiline prompts. Hosts with custom composer behavior can set `submitOnEnter` to `false`.
93
+
94
+ When a user pastes an image into the prompt composer, the shell emits `attachmentsPasted` with `PraxisAssistantShellAttachment` items containing the original `File`, image metadata, `source: 'paste'` and a local preview URL.
95
+
96
+ Hosts can also enable button-based file selection with `enableFileAttachments`, `attachmentAccept` and `attachmentMultiple`. In that mode, the attach button opens the native file picker and emits `attachmentsSelected` with `source: 'file-picker'`. When file selection is disabled, the legacy `attach` event remains available for host-defined context actions. The shell does not upload or persist files; the host owns storage, redaction and backend forwarding.
97
+
98
+ Flows that forward attachments to backend authoring endpoints should send only serializable attachment summaries, such as `id`, `name`, `kind`, `mimeType`, `sizeBytes`, `source` and `hasPreview`. Do not send `File`, bytes, base64 payloads or local `blob:` URLs to the assistant contract. When a backend clarification needs to keep attachment context for the next turn, the flow can return those summaries inside `pendingClarification.diagnostics.attachmentSummaries`; the turn orchestrator preserves that pending clarification state and sends it back with the next `clarify` action.
99
+
100
+ ### Conversation turn orchestration
101
+
102
+ `PraxisAssistantTurnOrchestratorService` is the canonical frontend coordination layer between the shell and specialized assistant flows. It creates a per-host controller so state is not shared globally between components.
103
+
104
+ The orchestrator owns the turn lifecycle:
105
+ - user prompt capture and conversation messages
106
+ - stable `sessionId` creation per controller when the host does not provide one
107
+ - fresh `clientTurnId` creation for each executable submit/apply/retry/cancel turn
108
+ - LLM-assisted clarification as a first-class `clarification` state
109
+ - structured clarification questions and quick replies
110
+ - edit/resend actions for user messages, including conversation fork semantics
111
+ - attached context add/remove state
112
+ - apply/retry/cancel dispatch when the active flow supports it
113
+ - normalized shell state for `idle`, `processing`, `clarification`, `review`, `applying`, `success` and `error`
114
+
115
+ The orchestrator remains flow-agnostic. Each consumer provides a `PraxisAssistantTurnFlow` for its mode. For example, a config assistant flow can wrap `AiConfigAdapter` plus `/api/praxis/config/ai/patch`, while Page Builder agentic authoring can wrap `/api/praxis/config/ai/authoring/**`.
116
+
117
+ When a flow asks for clarification, direct user input while the controller is in `clarification` state is sent to the flow as a `clarify` action with the pending clarification context. Hosts should not rewrite short answers locally; they should pass the request context through to the backend or flow that owns the authoring semantics.
118
+
119
+ `pendingClarification.diagnostics` is opaque flow state. It is preserved across the next clarification answer so backend-owned semantics can keep metadata-only context, including attachment summaries, without the shell understanding the domain or retaining local file payloads.
120
+
121
+ When a user edits or resends an earlier user message, the controller forks the conversation from that message before invoking the flow again. Downstream assistant/user messages, quick replies, pending clarification and preview state are cleared so the backend receives the revised conversation branch instead of stale follow-up context. Hosts that expose an edit composer should call `submitEditedMessage(messageId, text)` when the revised prompt is submitted.
122
+
69
123
  ## What this package does not own
70
124
 
71
125
  - direct provider SDK integration when the backend contract already exists
@@ -84,6 +138,15 @@ ng test praxis-ai
84
138
 
85
139
  The UI uses the backend orchestration endpoints instead of calling providers directly.
86
140
 
141
+ ### Host integration tokens
142
+
143
+ Hosts configure tenant/env/user headers and global AI config through the `@praxisui/ai` tokens exported by the package:
144
+
145
+ - `AI_BACKEND_STORAGE_OPTIONS`: provides `headersFactory`, optional `defaultHeaders`, and the explicit `allowLocalIdentityFallback` demo mode.
146
+ - `AI_BACKEND_CONFIG_STORE`: provides `getAiConfigSnapshot`, `aiConfigChanges$`, and `saveAiConfig` for provider/model/global AI settings.
147
+
148
+ The library does not consume `@praxisui/core` storage tokens as a hidden fallback. Host applications should wire the AI tokens directly when integrating with `/api/praxis/config/ai/**`.
149
+
87
150
  ### Provider catalog and validation
88
151
  - `GET /api/praxis/config/ai/providers/catalog`
89
152
  - `POST /api/praxis/config/ai/providers/models`