@praxisui/ai 10.0.0-rc.8 → 10.0.0-rc.80
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 -10
- package/ai/component-registry.json +2 -2
- package/fesm2022/praxisui-ai.mjs +16167 -2248
- package/package.json +2 -2
- package/types/praxisui-ai.d.ts +2206 -68
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Peer dependencies:
|
|
|
34
34
|
- `@angular/forms` `^21.0.0`
|
|
35
35
|
- `@angular/material` `^21.0.0`
|
|
36
36
|
- `@google/generative-ai` `^0.24.1`
|
|
37
|
-
- `@praxisui/core` `^
|
|
37
|
+
- `@praxisui/core` `^10.0.0-rc.48`
|
|
38
38
|
- `rxjs` `~7.8.0`
|
|
39
39
|
|
|
40
40
|
## When to use
|
|
@@ -94,27 +94,27 @@ export class AiAssistantEntryComponent {
|
|
|
94
94
|
The shell owns the shared UX primitives:
|
|
95
95
|
- conversation messages and message actions such as edit/resend/custom actions
|
|
96
96
|
- prompt composer, Enter-to-submit behavior, pasted or selected file attachments, submit/apply actions and attach/remove attachment events
|
|
97
|
-
- active context chips for component, schema, selection, route, tenant or custom context
|
|
97
|
+
- active context chips rendered on demand in a header-triggered popover (`layers` toggle with active item count) for component, schema, selection, route, tenant or custom context
|
|
98
98
|
- rich quick reply chips with optional description, icon, tone and structured context hints
|
|
99
99
|
- attached context metadata for files, images, JSON, schema and text payloads
|
|
100
100
|
- mode and state labels for `config`, `agentic-authoring`, `chat`, `diagnostic`, `review` and `inline-help`
|
|
101
|
-
- viewport-level draggable/resizable panel layout, pointer
|
|
101
|
+
- viewport-level draggable/resizable panel layout (opening at 640px default width and 95% of available viewport height), pointer resize handles, separate minimize affordance (`—`, `"Minimizar assistente"`) when `[showMinimize]="true"`, and full close/dismissal (`×`, `"Fechar assistente"`)
|
|
102
102
|
|
|
103
|
-
The shell is a viewport-level assistant surface, not a component-bounded popover. A component trigger opens the assistant with local semantic context,
|
|
103
|
+
The shell is a viewport-level assistant surface, not a component-bounded popover. A component trigger opens the assistant with local semantic context, while the panel can move across the page and resize cleanly within safe viewport margins. The default close affordance is `"Fechar assistente"` (`×`), which closes and clears the active surface (and dismisses minimized dock entries when wired via `dismissSession`), while hosts that support minimizing into `PraxisAssistantSessionRegistryService` or `PraxisAiAssistantDockComponent` enable `[showMinimize]="true"` and `(minimize)` (`—`, `"Minimizar assistente"`).
|
|
104
104
|
|
|
105
105
|
The assistant chrome belongs to the platform, not to the component that opened it. Hosts should provide contextual labels, mode, state and context chips, while `PraxisAiAssistantShellComponent` keeps the shared visual hierarchy: assistant identity first, contextual title/subtitle second, and operational mode/state as compact metadata. Component-specific styling should not make the shell look owned by Page Builder, Table, Dynamic Form or any other individual runtime.
|
|
106
106
|
|
|
107
|
-
Composer actions are state-aware. The primary action
|
|
107
|
+
Composer actions are state-aware. The primary submit action (`submit-prompt`) renders by default as a compact circular icon-only control (`arrow_upward`) with localized `aria-label` and tooltip matching modern assistant conventions, changing state colors/icons (`Interpretar pedido`, clarification, review, applying, success or error) across turns. Secondary recovery actions such as retry and cancel are surfaced by the shell when the active turn can be recovered, while hosts can still opt into a labeled primary button via `primaryAction.iconOnly = false`.
|
|
108
108
|
|
|
109
|
-
Hosts can
|
|
109
|
+
Hosts can customize icon-only behavior on primary actions with `iconOnly=true` or `iconOnly=false`. Even when icon-only, the action must still provide a semantic `label` or `ariaLabel`; the shell uses it for accessibility and tooltip text while keeping any fallback visually-hidden label out of duplicate screen-reader announcements.
|
|
110
110
|
|
|
111
111
|
Message-level actions can also be rendered as icon-only controls by setting `icon` or `iconOnly=true` on `PraxisAssistantShellMessageAction`. Built-in `edit`, `resend` and `copy` actions use `edit`, `replay` and `content_copy` icons by default, with the visible label moved to tooltip and `aria-label`.
|
|
112
112
|
|
|
113
113
|
`PraxisAiAssistantDockComponent` is the companion minimized-session surface for the same assistant identity. Hosts use it when a specialized assistant session remains active but the full shell is minimized. The dock owns the shared visual language for assistant presence, state badges and reopen affordance; hosts still provide the semantic session summary and decide what reopening means.
|
|
114
114
|
|
|
115
|
-
`PraxisAssistantSessionRegistryService` is the canonical in-memory registry for assistant sessions opened by different Praxis components in the same application shell. Component hosts register their active or minimized sessions with stable `ownerId`/`ownerType` metadata so a global assistant host can present one shared experience while preserving each component's semantic context. Sessions can use the default `presence: 'global-dock'` when the App Shell should render the minimized card, or `presence: 'origin-anchor'` when the owning component keeps the minimized affordance on its original trigger. The registry accepts an optional `PraxisAssistantContextSnapshot`, normalizes it before storage and rejects snapshots whose `identity.sessionId`, `identity.ownerId` or `identity.ownerType` do not match the session descriptor. Components that already have a canonical context snapshot should prefer the context helpers: `upsertContextSession`, `openContextSession`, `minimizeContextSession`, `getContextSession` and `removeContextSession`.
|
|
115
|
+
`PraxisAssistantSessionRegistryService` is the canonical in-memory registry for assistant sessions opened by different Praxis components in the same application shell. Component hosts register their active or minimized sessions with stable `ownerId`/`ownerType` metadata so a global assistant host can present one shared experience while preserving each component's semantic context. Sessions can use the default `presence: 'global-dock'` when the App Shell should render the minimized card, or `presence: 'origin-anchor'` when the owning component keeps the minimized affordance on its original trigger. The registry accepts an optional `PraxisAssistantContextSnapshot`, normalizes it before storage and rejects snapshots whose `identity.sessionId`, `identity.ownerId` or `identity.ownerType` do not match the session descriptor. Dismissing a dock calls `dismissSession(id)` / `dismissContextSession(identity)`, removing the session and updating both `lastDismissedSession` and per-session `dismissedSessionSeqs` (`getSessionDismissalSeq(id)`) so multiple hosts never coalesce away simultaneous dismissals. Components that already have a canonical context snapshot should prefer the context helpers: `upsertContextSession`, `openContextSession`, `minimizeContextSession`, `dismissContextSession`, `getContextSession` and `removeContextSession`.
|
|
116
116
|
|
|
117
|
-
`PraxisAiAssistantSessionHostComponent` is the canonical presence host for minimized assistant sessions in an application or page shell. It reads `PraxisAssistantSessionRegistryService`, renders the shared dock for each minimized `global-dock` session,
|
|
117
|
+
`PraxisAiAssistantSessionHostComponent` is the canonical presence host for minimized assistant sessions in an application or page shell. It reads `PraxisAssistantSessionRegistryService`, renders the shared dock for each minimized `global-dock` session, emits `sessionOpen` after promoting a session to active, and emits `sessionClose` after dismissing a session via `dismissSession`. Hosts can opt into `includeOriginAnchored=true` for diagnostics or custom shells, but the default respects owner-local minimized affordances. Specialized components still own the full shell events until their authoring action contracts are promoted to shared platform contracts.
|
|
118
118
|
|
|
119
119
|
`PraxisAssistantContextSnapshot` is the canonical, UI-agnostic context contract for intelligent Praxis components. It represents safe assistant context: stable identity, current target, context chips, manifest reference, resource/schema hints, digests, governance hints, attachment summaries and declarative action contracts. It is intentionally not a raw component payload. Hosts should normalize snapshots with `normalizePraxisAssistantContextSnapshot` before storing them in a registry, passing them between components or using them as a handoff boundary.
|
|
120
120
|
|
|
@@ -144,7 +144,7 @@ The shell ships with centralized PT-BR default labels and accepts the `labels` i
|
|
|
144
144
|
|
|
145
145
|
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`.
|
|
146
146
|
|
|
147
|
-
The prompt composer supports governed provider-backed transcription with `voiceInputMode="governed-transcription"`. It captures a short audio blob with `MediaRecorder`, sends it to `POST /api/praxis/config/ai/transcriptions` using the normal tenant/user/environment scope, appends the returned text to the prompt and never auto-submits the assistant turn. Provider selection, credentials, limits and audit policy remain backend-owned by Praxis Config. The older `browser-speech` mode remains an explicit compatibility option for approved low-risk environments, but it is not the enterprise/default path because `SpeechRecognition` availability varies by browser.
|
|
147
|
+
The prompt composer supports governed provider-backed transcription with `voiceInputMode="governed-transcription"`. It captures a short audio blob with `MediaRecorder`, sends it to `POST /api/praxis/config/ai/transcriptions` using the normal tenant/user/environment scope, appends the returned text to the prompt and never auto-submits the assistant turn. The 34px desktop microphone control (44px on coarse pointers) sits beside Send and stops an active recording; pending states disable it and expose a separate Cancel dictation control. A reserved status row shows progress and recording time without announcing every timer tick. Focus moves between voice controls only when needed, preserving the editable draft's focus. Provider selection, credentials, limits and audit policy remain backend-owned by Praxis Config. The older `browser-speech` mode remains an explicit compatibility option for approved low-risk environments, but it is not the enterprise/default path because `SpeechRecognition` availability varies by browser.
|
|
148
148
|
|
|
149
149
|
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.
|
|
150
150
|
|
|
@@ -277,6 +277,28 @@ Notes:
|
|
|
277
277
|
|
|
278
278
|
`AiBackendApiService` exposes these endpoints through typed methods so hosts can inspect the executable manifest, resolve targets, validate a component edit plan and compile a backend-owned patch without routing by local keywords.
|
|
279
279
|
|
|
280
|
+
### Operational agent turn streaming, workspace orchestrator & governed blocks
|
|
281
|
+
- `POST /api/praxis/config/ai/agent/turn/stream/start`
|
|
282
|
+
- `GET /api/praxis/config/ai/agent/turn/stream/{streamId}`
|
|
283
|
+
- `GET /api/praxis/config/ai/agent/turn/stream/{streamId}/probe`
|
|
284
|
+
- `POST /api/praxis/config/ai/agent/turn/stream/{streamId}/cancel`
|
|
285
|
+
- `POST /api/praxis/config/ai/agent/proposals/from-counterfactual`
|
|
286
|
+
- `POST /api/praxis/config/ai/agent/proposals/{proposalId}/confirm`
|
|
287
|
+
- `POST /api/praxis/config/ai/agent/proposals/{proposalId}/reject`
|
|
288
|
+
- `POST /api/praxis/config/ai/agent/proposals/{proposalId}/complete-form`
|
|
289
|
+
|
|
290
|
+
`OperationalAgentTurnClientService` starts and cancels turns (forwarding `streamAccessToken`) via `HttpClient` (`withCredentials: true`, preserving CSRF and enterprise runtime context headers), probes `EventSource` readiness before opening (failing fast on `401`/`403`/`404`/`410`), and consumes SSE frames over `fetch()` `ReadableStream` or `EventSource` (`status`, `progress`, `thought.step`, `surface.create`, `surface.patch-components`, `surface.patch-data`, `result`, `error`, `cancelled`, `heartbeat`) with `Last-Event-ID` resume, bounded reconnects (`5` attempts), and an idle-aware dual watchdog (`idleTimeoutMs` reset on stream frames + `maxTurnTimeoutMs` ceiling). `WorkspaceAssistantOrchestratorService` reduces `surface.*` events (`praxis.assistant-surface/v1`) into live `activeTurnSurfaces` and `praxis.assistant-content/v2.1` message blocks during active turns while keeping `praxis.assistant-content/v2` compatibility, and bridges validated (`VALIDATED_BY_RULES_ENGINE`) counterfactual alternatives cleanly via `prepareProposalFromCounterfactual` (`POST /proposals/from-counterfactual`) into pending governed `action-proposals` requiring explicit human approval. `PraxisAiAssistantShellComponent` renders governed `assistantContent` (`v2`/`v2.1`) operational blocks and incremental surface status cards through `PraxisAssistantOperationalBlockComponent` (`alert-list`, `widget-block` via `DynamicWidgetLoaderDirective` with fail-closed `hostCapabilities`, `simulation-preview`, `action-proposals`, `calculation-memory`, `knowledge-citations`, 5-row `compact-collection`, `action-bar`, `counterfactual-recourse`, and `document-evidence`) and emits `blockAction` events.
|
|
291
|
+
|
|
292
|
+
`PraxisWorkspaceAssistantComponent` and `WorkspaceAssistantOrchestratorService` wrap the dock (respecting `allowDismissDock`, default `true`), shell (opening at 640px default width and 95% of available viewport height with distinct `minimize` (`—`) and `close` (`×`) actions across both shell and dock), grounding, runtime observations, and workspace query scope, including the full proposal lifecycle (`confirmActionProposal` with `If-Match`/`Idempotency-Key` handling `200`/`403`/`409`/`412`/`422`, `rejectActionProposal` with optional inline `reason`, `revalidate-stale-proposal` preserving `prefill`, `open-proposal-form` with `overlayInitialValueOnEdit` hints, and `completeProposalViaForm`), server proposal reconciliation (`listProposals` returning `OperationalAgentProposalListResponse` and `getProposal` returning `OperationalAgentProposalDetailResponse` via `refreshProposalStatus`), ordered multi-step chains (`sequenceOrder`/`sequenceGroupId`, `WAITING_PREREQUISITE`, root `resultingEntityId`, and `dependentProposalUpdates`), and Four-Eyes (`approvalPolicy === 'FOUR_EYES'`) where `403 FOUR_EYES_APPROVAL_REQUIRED` sets `awaitingSecondApprover: true`, hides direct confirmation/form actions for the creator, and keeps a live refresh CTA for second-reviewer completion. Workspace hosts using `<praxis-enterprise-workspace-shell>` (from `@praxisui/page-builder`) can configure the built-in assistant directly via `assistantOptions`, `assistantRouteContext`, `assistantLayout`, `showBuiltInAssistantDock`, and forwarded `assistant*` outputs.
|
|
293
|
+
|
|
294
|
+
Governed document flows keep active thread attachments inspectable and detachable (`activeThreadAttachments` / `detachThreadAttachment` -> `detachedAttachmentIds`), gate authenticated Blob previews on opt-in `enableAuthenticatedPreview` (`false` by default) routed safely through `PraxisSafeBlobPreviewService` (forcing safe downloads for unsafe active types), and expose translated i18n bundles (`assistant-attachments.i18n` and `assistant-operational-blocks.i18n`) from `@praxisui/ai`. For compliance, `AssistantHistoryService` enforces zero-storage history suppression and prunes persisted thread state whenever a `document-evidence` block carries `PERSONAL_LGPD`, `CONFIDENTIAL_FINANCIAL`, `SENSITIVE_RESTRICTED`, `sovereignOnly: true`, or `tainted: true`.
|
|
295
|
+
|
|
296
|
+
Governed document attachments are **opt-in** via `PRAXIS_FILE_UPLOAD_PORT` (provided cleanly by `@praxisui/core`'s `providePraxisHttpFileUploadPort()` or `@praxisui/files-upload`'s `providePraxisFilesApiUploadPort()` without coupling `@praxisui/ai` to `@praxisui/files-upload`) plus `providePraxisWorkspaceAssistantAttachments({ enabled: true })`. When opted in, the shell supports drag-and-drop (resetting overlays on window drop/dragend/blur or `Escape`), clipboard paste across `clipboardData.files` and `clipboardData.items` without breaking mixed text+image pastes, a composer-anchored attachment tray of category-styled document cards (`pdf`, `spreadsheet`, `document`, `image`, `data`, `file`) with clamped progress/error/retry/visible rejection notice/authenticated `Blob` preview, attachment-only submission, automatic draft restoration on cancellation, attachment preservation on retry, `STAGED` draft cleanup on remove or tenant/user switch, and `document-evidence` provenance badges (`PROCESSED`, `VERIFIED`, `REVIEW_REQUIRED`, `BLOCKED`, `QUARANTINED`, `tainted`, `sovereignOnly`, `visualPagesInspected`, SHA-256 copy, sanitized `signatureIndicators` / `evidenceWarnings`, and optional `verificationStatus`).
|
|
297
|
+
|
|
298
|
+
Governed bulk proposals in `action-proposals` disable direct single-click confirmation (`409 BULK_REQUIRES_MODAL_REVIEW`) and hand off through `PRAXIS_BULK_PROPOSAL_BRIDGE` (`providePraxisCrudBulkProposalBridge()` from `@praxisui/crud`) to the 680px modal before reconciling execution metrics back to `/complete-form`. Surfaces such as CRUD headers, quick views, and analytical drawers trigger pre-grounded assistant conversations via `PRAXIS_OPERATIONAL_ASSISTANT_LAUNCHER` (bound to `providePraxisWorkspaceAssistantLauncher()`).
|
|
299
|
+
|
|
300
|
+
`AssistantHistoryService` is exported in the public API, isolates both indexes and `getSession(sessionId, context?)` reads by active enterprise context (`{ tenantId, env, userId }`, purging cross-context stale keys on mismatch), preserves conversational paragraphs, sanitized per-message attachment summaries (without `File`, `previewUrl`, or `base64`), `sourceTurnId` on `counterfactual-recourse` blocks (filtering unvalidated candidates fail-closed), and operational block types + sanitized `praxis.assistant-content/v2.1` surface summaries in scoped local storage while redacting sensitive operational keys, tokens/JWTs, Mod-11 CPFs, and 14-digit Mod-11 CNPJs and normalizing expired `PENDING`/`EXECUTING`/`WAITING_PREREQUISITE` proposals to `EXPIRED` (`confirmBusy: false`) on restore.
|
|
301
|
+
|
|
280
302
|
### Agentic authoring turn streaming
|
|
281
303
|
- `POST /api/praxis/config/ai/authoring/turn/stream/start`
|
|
282
304
|
- `GET /api/praxis/config/ai/authoring/turn/stream/{streamId}`
|
|
@@ -321,12 +343,29 @@ The manual patch editor UI is disabled by default and can be enabled explicitly
|
|
|
321
343
|
- The assistant task flow uses a descriptive 4-step timeline (`Pedido`, `Proposta`, `Impacto`, `Aplicação`).
|
|
322
344
|
- Clarification options are rendered as decision cards with metadata labels.
|
|
323
345
|
- Review/clarification modes render a "thought + plan" summary card.
|
|
324
|
-
- All
|
|
346
|
+
- All floating shell, minimized dock, and operational block styling remains bound to host Material 3 tokens (`--md-sys-color-surface*`, `--md-sys-color-on-surface*`, `--md-sys-color-primary`, optional `--pdx-color-*` / `light-dark()` semantic status accents, and automatic `forced-colors` / `prefers-reduced-motion` support) with no independent dark theme inside the library.
|
|
325
347
|
|
|
326
348
|
## Technical Docs
|
|
327
349
|
|
|
328
350
|
- `projects/praxis-ai/docs/ai-deployment-flow.md`
|
|
329
351
|
|
|
352
|
+
### Shared assistant voice policy
|
|
353
|
+
|
|
354
|
+
Configure `{ provide: PRAXIS_ASSISTANT_VOICE_INPUT_MODE, useValue: 'governed-transcription' }` once in the host application (token from `@praxisui/ai`). The shell, Page Builder and Table inherit it; explicit component inputs can override it, including `disabled`. The default remains disabled when the host does not opt in.
|
|
355
|
+
|
|
356
|
+
The shared composer checks `GET /api/praxis/config/ai/transcriptions/capabilities` before requesting microphone permission. Readiness means local provider/credential configuration, not quota or network health. Recording, transcription and cancellation preserve the editable draft and never auto-submit. Deploy the backend capability before enabling the updated client.
|
|
357
|
+
|
|
358
|
+
Voice language also inherits `PRAXIS_ASSISTANT_VOICE_LANGUAGE`; explicit component inputs override it. Governed capture is bound to confirmed enterprise context (user/tenant/profile/version) and is cancelled when that authority is invalidated. Page Builder session resets and Table owner changes discard the old shell capture; editing the current draft does not cancel it. The host must keep its session and runtime authority coherent and invalidate it on session-generation changes.
|
|
359
|
+
|
|
360
|
+
Corporate adoption requires a ready context and current context-version headers, a host resolver bound to the server session/membership, and the correct cookie transport. The quickstart enterprise resolver applies this admission to all its AI callers. Local header-only integration cannot detect cookie changes that the host does not report. Focused/mock tests are not proof of durable session persistence, provider connectivity or published package adoption.
|
|
361
|
+
|
|
362
|
+
### CSS Custom Properties (Assistant Icon & Context Chips)
|
|
363
|
+
|
|
364
|
+
- **Header Identity Badge:** `--praxis-ai-identity-size`, `--praxis-ai-identity-radius`, `--praxis-ai-identity-bg`, `--praxis-ai-identity-color`, `--praxis-ai-identity-shadow`, and `--praxis-ai-identity-glyph-size`.
|
|
365
|
+
- **Frameless / Scoped Surface Icons:** Shared frame appearance (`--praxis-ai-icon-frame-bg`, `--praxis-ai-icon-frame-border`, `--praxis-ai-icon-frame-border-color`, `--praxis-ai-icon-frame-radius`, plus legacy size fallback `--praxis-ai-icon-frame-size`) and surface-specific sizing tokens `--praxis-ai-recommended-icon-frame-size`, `--praxis-ai-recommended-icon-glyph-size`, `--praxis-ai-block-icon-frame-size`, `--praxis-ai-block-icon-glyph-size`, `--praxis-ai-quick-reply-frame-size`, `--praxis-ai-quick-reply-mobile-frame-size`, and `--praxis-ai-quick-reply-icon-size`.
|
|
366
|
+
- **Context Chips:** `--praxis-ai-context-item-max-width`.
|
|
367
|
+
- **Operational Alert Cards (`.praxis-ai-op-alert`):** `--praxis-ai-op-alert-accent-width` (default `3px`), `--praxis-ai-op-alert-accent-opacity` (default `1`), and `--praxis-ai-op-alert-padding` (default `8px 10px 8px 13px`).
|
|
368
|
+
|
|
330
369
|
<!-- praxis-npm-catalog-links:start -->
|
|
331
370
|
## Official documentation and examples
|
|
332
371
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-
|
|
3
|
+
"generatedAt": "2026-12-01T19:14:00.841Z",
|
|
4
4
|
"packageName": "@praxisui/ai",
|
|
5
|
-
"packageVersion": "10.0.0-rc.
|
|
5
|
+
"packageVersion": "10.0.0-rc.80",
|
|
6
6
|
"sourceRegistry": "praxis-component-registry-ingestion",
|
|
7
7
|
"sourceRegistryVersion": "1.0.0",
|
|
8
8
|
"componentCount": 0,
|