@praxisui/ai 8.0.0-beta.99 → 9.0.0-beta.0
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 +49 -6
- package/fesm2022/praxisui-ai.mjs +1003 -81
- package/package.json +2 -2
- package/types/praxisui-ai.d.ts +159 -10
package/README.md
CHANGED
|
@@ -37,20 +37,27 @@ Short mental model:
|
|
|
37
37
|
|
|
38
38
|
## Documentation
|
|
39
39
|
|
|
40
|
-
- Official documentation: https://praxisui.dev
|
|
40
|
+
- Official documentation: https://praxisui.dev/components/ai
|
|
41
|
+
- AI docs: https://praxisui.dev/docs/ai
|
|
41
42
|
- Quickstart reference app: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
43
|
+
- Live Praxis UI demo: https://praxis-ui-4e602.web.app
|
|
42
44
|
- Recommended for: Angular hosts that need AI-assisted configuration flows with provider orchestration and enterprise guardrails
|
|
43
45
|
|
|
44
46
|
## Install
|
|
45
47
|
|
|
46
48
|
```bash
|
|
47
|
-
npm i @praxisui/ai
|
|
49
|
+
npm i @praxisui/ai@beta
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
Peer dependencies
|
|
51
|
-
- `@angular/core` `^
|
|
52
|
-
- `@angular/common` `^
|
|
53
|
-
- `@
|
|
52
|
+
Peer dependencies:
|
|
53
|
+
- `@angular/core` `^21.0.0`
|
|
54
|
+
- `@angular/common` `^21.0.0`
|
|
55
|
+
- `@angular/cdk` `^21.0.0`
|
|
56
|
+
- `@angular/forms` `^21.0.0`
|
|
57
|
+
- `@angular/material` `^21.0.0`
|
|
58
|
+
- `@google/generative-ai` `^0.24.1`
|
|
59
|
+
- `@praxisui/core` `^9.0.0-beta.0`
|
|
60
|
+
- `rxjs` `~7.8.0`
|
|
54
61
|
|
|
55
62
|
## When to use
|
|
56
63
|
|
|
@@ -58,6 +65,38 @@ Peer dependencies (Angular v20):
|
|
|
58
65
|
- Centralize provider and model validation behind backend-controlled endpoints
|
|
59
66
|
- Apply tenant-aware confirmation and risk policies in enterprise environments
|
|
60
67
|
|
|
68
|
+
## Minimal standalone shell
|
|
69
|
+
|
|
70
|
+
Use the shell for governed assistant UX. The host still owns the backend flow,
|
|
71
|
+
safe context, storage, and apply semantics.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { Component } from '@angular/core';
|
|
75
|
+
import { PraxisAiAssistantShellComponent } from '@praxisui/ai';
|
|
76
|
+
|
|
77
|
+
@Component({
|
|
78
|
+
selector: 'app-ai-assistant-entry',
|
|
79
|
+
standalone: true,
|
|
80
|
+
imports: [PraxisAiAssistantShellComponent],
|
|
81
|
+
template: `
|
|
82
|
+
<praxis-ai-assistant-shell
|
|
83
|
+
mode="agentic-authoring"
|
|
84
|
+
state="idle"
|
|
85
|
+
[messages]="messages"
|
|
86
|
+
[contextItems]="contextItems"
|
|
87
|
+
(submitPrompt)="submitPrompt($event)" />
|
|
88
|
+
`,
|
|
89
|
+
})
|
|
90
|
+
export class AiAssistantEntryComponent {
|
|
91
|
+
messages = [];
|
|
92
|
+
contextItems = [{ label: 'Surface', value: 'Page Builder' }];
|
|
93
|
+
|
|
94
|
+
submitPrompt(prompt: string): void {
|
|
95
|
+
// Forward to the backend-owned Praxis Config AI flow.
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
61
100
|
## What this package is responsible for
|
|
62
101
|
|
|
63
102
|
- assistant UX surfaces and interaction flow
|
|
@@ -150,6 +189,8 @@ The orchestrator owns the turn lifecycle:
|
|
|
150
189
|
|
|
151
190
|
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/**`.
|
|
152
191
|
|
|
192
|
+
When `@praxisui/core` runtime component observations are registered, the orchestrator attaches them to `PraxisAssistantTurnRequest.runtimeComponentObservations` as untrusted frontend evidence. Stream clients forward non-empty observations with `runtimeComponentObservationTrustBoundary="untrusted_frontend_observation"`. This field is transport-only in `@praxisui/ai`: it does not resolve intent, promote capabilities, select quick replies, alter previews or bypass backend grounding.
|
|
193
|
+
|
|
153
194
|
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.
|
|
154
195
|
|
|
155
196
|
`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.
|
|
@@ -264,6 +305,8 @@ Notes:
|
|
|
264
305
|
|
|
265
306
|
`AiBackendApiService.startAgenticAuthoringTurnStream`, `connectAgenticAuthoringTurnStream` and `cancelAgenticAuthoringTurnStream` use the same SSE envelope contract as patch streaming. Browser `EventSource` cannot send custom headers, so signed stream tokens returned by the backend should be passed to `connectAgenticAuthoringTurnStream` and `cancelAgenticAuthoringTurnStream` when the backend uses signed-url stream auth.
|
|
266
307
|
|
|
308
|
+
`AgenticAuthoringTurnClientService` is the shared client for assistant turn flows that consume this canonical stream. It starts the turn, connects SSE and exposes two levels: `streamEvents()` for component flows that already own rich preview/apply semantics, and `streamTurn()` for flows that can consume normalized `PraxisAssistantTurnResult` values directly. The client can emit shared lifecycle status for silent streams, enforce a terminal-result timeout and surface transport lifecycle events such as probe readiness, transport opening and first-event receipt. `AiBackendApiService.connectAgenticAuthoringTurnStream` also falls back to `fetch` SSE parsing when `EventSource` is unavailable. Per-call `baseUrl` and header overrides allow component services with existing endpoint options to migrate without losing host configuration. Component-specific flows should use this shared client when migrating away from `/patch`, then add only component-owned context assembly and apply semantics locally.
|
|
309
|
+
|
|
267
310
|
## Assistant local history (UI)
|
|
268
311
|
|
|
269
312
|
The assistant stores a lightweight local history in the browser using `localStorage`. It is scoped by
|