max-agent-ui 0.0.13 → 0.0.14
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 +111 -65
- package/fesm2022/max-agent-ui.mjs +444 -57
- package/fesm2022/max-agent-ui.mjs.map +1 -1
- package/index.d.ts +382 -0
- package/package.json +11 -10
- package/types/max-agent-ui.d.ts +0 -204
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Max Agent UI
|
|
1
|
+
# Max Agent UI
|
|
2
2
|
|
|
3
3
|
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.2.0.
|
|
4
4
|
|
|
@@ -16,75 +16,121 @@ For a complete list of available schematics (such as `components`, `directives`,
|
|
|
16
16
|
ng generate --help
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Building
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
ng build max-agent-ui
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
-
|
|
29
|
-
## Assistant Component
|
|
30
|
-
|
|
31
|
-
This package exposes
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
24
|
+
ng build max-agent-ui
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
## Assistant Component
|
|
30
|
+
|
|
31
|
+
This package exposes the standalone chat assistant component, its typed models,
|
|
32
|
+
and `MaxAssistantService`.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { MaxAssistantComponent } from 'max-agent-ui';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Add `MaxAssistantComponent` to the consuming component imports and render:
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<max-assistant
|
|
42
|
+
assistantApiUrl="/agent-api/v1/chat"
|
|
43
|
+
app="cortex"
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For authenticated host applications, provide shared configuration once. The
|
|
48
|
+
current token and API version are sent as headers, while role, permissions,
|
|
49
|
+
route, and timezone are sent as request context:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
providers: [
|
|
53
|
+
{
|
|
54
|
+
provide: MAX_ASSISTANT_CONFIG,
|
|
55
|
+
useFactory: (session: SessionService, router: Router) => ({
|
|
56
|
+
assistantApiUrl: '/agent-api/v1/chat',
|
|
57
|
+
app: 'cortex',
|
|
58
|
+
user: () => ({
|
|
59
|
+
token: session.authToken(),
|
|
60
|
+
version: session.apiVersion()
|
|
61
|
+
}),
|
|
62
|
+
context: () => ({
|
|
63
|
+
role: session.role(),
|
|
64
|
+
permissions: session.agentPermissions(),
|
|
65
|
+
route: router.url,
|
|
66
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
deps: [SessionService, Router]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
GET actions are rendered immediately. POST and PATCH proposals are rendered
|
|
75
|
+
with Approve and Reject controls. Approval sends a structured confirmation for
|
|
76
|
+
the exact pending action; typing words such as "yes" does not execute it.
|
|
77
|
+
|
|
78
|
+
Host features that already know an action capability can bypass
|
|
79
|
+
natural-language routing without bypassing server authorization:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { MaxAssistantService } from 'max-agent-ui';
|
|
83
|
+
|
|
84
|
+
assistant.sendStructuredAction(
|
|
85
|
+
'Cancel this session',
|
|
86
|
+
{
|
|
87
|
+
capabilityKey: 'cortex.timetable.session.cancel',
|
|
88
|
+
arguments: { sessionId: 42 }
|
|
89
|
+
}
|
|
90
|
+
).subscribe();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The agent still validates the capability and permissions in Supabase, performs
|
|
94
|
+
live preflight reads, and returns the normal Approve/Reject proposal.
|
|
95
|
+
|
|
96
|
+
For another product, supply product-specific authentication headers through
|
|
97
|
+
`requestHeaders`. Cortex's existing `user.token` and `user.version` shortcuts
|
|
98
|
+
remain supported:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
requestHeaders: () => ({
|
|
102
|
+
'x-nemesys-auth-token': session.nemesysToken()
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Host apps should provide Angular `HttpClient` for real API calls and include their PrimeNG theme and PrimeIcons styles.
|
|
107
|
+
|
|
108
|
+
For local integration, install the generated tarball and peer UI dependencies in the consuming app:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm install C:/Users/Dev100/Documents/Maxtime/Projects/maxtime-ui-library/dist/max-agent-ui/max-agent-ui-0.0.24.tgz primeng primeicons @angular/cdk
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Publishing the Library
|
|
115
|
+
|
|
116
|
+
Build and package the library:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
ng build max-agent-ui
|
|
120
|
+
cd dist/max-agent-ui
|
|
121
|
+
npm pack
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Publish the generated tarball after logging in to npm:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm login
|
|
128
|
+
npm publish max-agent-ui-0.0.24.tgz
|
|
129
|
+
```
|
|
84
130
|
|
|
85
131
|
## Running unit tests
|
|
86
132
|
|
|
87
|
-
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
|
133
|
+
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
|
88
134
|
|
|
89
135
|
```bash
|
|
90
136
|
ng test
|