@praxisui/ai 0.0.1

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/.npmrc.npmjs ADDED
@@ -0,0 +1,3 @@
1
+ registry=https://registry.npmjs.org/
2
+ //registry.npmjs.org/:_authToken=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
3
+ @praxisui:registry=https://registry.npmjs.org/
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # PraxisAi
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build praxis-ai
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/praxis-ai
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
42
+
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
+
61
+ ## Additional Resources
62
+
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
64
+
65
+ ## Backend AI endpoints (Praxis Config)
66
+
67
+ The UI uses the backend orchestration endpoints instead of calling providers directly.
68
+
69
+ ### Provider catalog and validation
70
+ - `GET /api/praxis/config/ai/providers/catalog`
71
+ - `POST /api/praxis/config/ai/providers/models`
72
+ - `POST /api/praxis/config/ai/providers/test`
73
+
74
+ `models`/`test` accept `{ provider, apiKey?, model? }`. When `apiKey` is omitted, the backend uses the encrypted key stored in global config.
75
+
76
+ ### Suggestions (deterministic)
77
+ - `POST /api/praxis/config/ai/suggestions`
78
+
79
+ Example payload:
80
+ ```json
81
+ {
82
+ "componentId": "praxis-table",
83
+ "componentType": "table",
84
+ "currentState": {
85
+ "config": { "columns": [] },
86
+ "capabilities": [],
87
+ "runtimeState": { "rowsTotal": 120 }
88
+ },
89
+ "dataProfile": { "rowCount": 120 },
90
+ "maxSuggestions": 5,
91
+ "locale": "pt-BR"
92
+ }
93
+ ```
94
+
95
+ ### Patch generation
96
+ - `POST /api/praxis/config/ai/patch`
97
+
98
+ Payload:
99
+ ```json
100
+ {
101
+ "componentId": "praxis-table",
102
+ "componentType": "table",
103
+ "userPrompt": "Habilitar paginacao com 10 itens por pagina",
104
+ "currentState": { "columns": [] },
105
+ "dataProfile": { "rowCount": 120, "columns": { "status": { "inferredType": "string", "cardinality": 3 } } },
106
+ "schemaFields": [{ "name": "status", "type": "string", "options": ["Ativo", "Inativo"] }],
107
+ "runtimeState": { "rowsTotal": 120, "pageIndex": 0 }
108
+ }
109
+ ```
110
+
111
+ Notes:
112
+ - `currentState` must be the config root (not wrapped under `config`).
113
+ - Clarifications may return `{ type: "clarification", message, options }`.
114
+
115
+ ## Assistant local history (UI)
116
+
117
+ The assistant stores a lightweight local history in the browser using `localStorage`. It is scoped by
118
+ `{ tenantId, env, userId }` derived from the same headers used by the API (`X-Tenant-ID`, `X-Env`, `X-User-ID`).
119
+
120
+ Storage keys:
121
+ - `praxis.ai.history.index:{tenantId}:{env}:{userId}`
122
+ - `praxis.ai.history.session:{sessionId}`
123
+
124
+ Retention:
125
+ - Sessions older than 30 days are removed on read.
126
+ - Only user prompts and short assistant summaries are stored (no full config payloads or diffs).
127
+ - Sensitive tokens/credentials are redacted before persistence.
128
+
129
+ ## Assistant risk policy (tenant-aware)
130
+
131
+ The assistant supports a risk confirmation policy resolved per tenant from global config:
132
+
133
+ - `ai.riskPolicy = "strict"` (default): medium/high risk requires explicit confirmation (fail-safe).
134
+ - `ai.riskPolicy = "standard"`: explicit backend `requiresConfirmation=false` is respected.
135
+
136
+ You can also override this at component level using `@Input() riskPolicy`.
137
+
138
+ For enterprise safety, manual patch reapply flows (JSON/path editor) are also confirmation-gated
139
+ and follow the same resolved risk policy.
140
+
141
+ The manual patch editor UI is disabled by default and can be enabled explicitly with
142
+ `@Input() allowManualPatchEdit = true`.
143
+
144
+ ## Assistant UX surfaces (Material 3 host-aware)
145
+
146
+ - The assistant task flow uses a descriptive 4-step timeline (`Pedido`, `Proposta`, `Impacto`, `Aplicação`).
147
+ - Clarification options are rendered as decision cards with metadata labels.
148
+ - Review/clarification modes render a "thought + plan" summary card.
149
+ - All premium styling remains bound to Material 3 host tokens (no independent dark theme inside the lib).