@meshmakers/octo-ai-console 3.3.1190
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.
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { Observable, Subject, ReplaySubject } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Status names emitted by the adapter's session lifecycle (RtSessionStatusEnum in C#).
|
|
7
|
+
* Wire format is the enum name so the UI does not need to know the underlying integer
|
|
8
|
+
* mapping — this union mirrors the values currently emitted on the wire.
|
|
9
|
+
*/
|
|
10
|
+
type AiSessionStatus = 'Queued' | 'Running' | 'Paused' | 'Completed' | 'Failed' | 'Cancelled' | 'QuotaBlocked' | 'RateLimited';
|
|
11
|
+
/**
|
|
12
|
+
* Job kinds classify the prompt-template family + tool-policy track. Mirrors
|
|
13
|
+
* RtJobKindEnum in System.Ai-3. Phase-1 default is `DataModel`.
|
|
14
|
+
*/
|
|
15
|
+
type AiJobKind = 'DataModel' | 'Application' | 'Deployment' | 'Investigation';
|
|
16
|
+
/**
|
|
17
|
+
* Wire shape returned from every adapter session endpoint. Mirrors
|
|
18
|
+
* `SessionResponse` on the C# side (src/AiServices/TenantApi/v1/Models).
|
|
19
|
+
*/
|
|
20
|
+
interface AiSessionDto {
|
|
21
|
+
readonly sessionRtId: string;
|
|
22
|
+
readonly jobRtId: string;
|
|
23
|
+
readonly goalSummary: string;
|
|
24
|
+
readonly status: AiSessionStatus;
|
|
25
|
+
readonly startedAt: string;
|
|
26
|
+
readonly completedAt?: string | null;
|
|
27
|
+
readonly tokensConsumed: number;
|
|
28
|
+
readonly ownerUserId: string;
|
|
29
|
+
/**
|
|
30
|
+
* Per-session preview URL (#4136) — present on sessions whose worker pod
|
|
31
|
+
* has the preview-deploy sidecar enabled AND the agent's
|
|
32
|
+
* `npm run build:prod` has emitted a dist under the convention path
|
|
33
|
+
* (`/workspaces/preview/{sessionRtId}/dist`). The server composes the URL
|
|
34
|
+
* via `AiWorkspaceOptions.PreviewUrlPattern`; absent / empty when the
|
|
35
|
+
* feature is off or no build is ready yet.
|
|
36
|
+
*/
|
|
37
|
+
readonly previewUrl?: string | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Quota gate decision snapshot as observed at the moment a session was created (or
|
|
41
|
+
* polled). Mirrors `QuotaSnapshot` server-side. `decision` is the enum name; useful
|
|
42
|
+
* values are `Admit` / `Queue` / `BlockMonthlyCap` etc.
|
|
43
|
+
*/
|
|
44
|
+
interface AiQuotaSnapshotDto {
|
|
45
|
+
readonly decision: string;
|
|
46
|
+
readonly concurrentJobsCap: number;
|
|
47
|
+
readonly maxSessionsQueuedCap: number;
|
|
48
|
+
readonly currentActive: number;
|
|
49
|
+
readonly currentQueued: number;
|
|
50
|
+
readonly queuePosition: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Body for `POST /{tenantId}/v1/sessions`. The owning user is taken from the JWT
|
|
54
|
+
* subject claim — clients never send a user id on the request.
|
|
55
|
+
*/
|
|
56
|
+
interface CreateSessionRequestDto {
|
|
57
|
+
readonly goal: string;
|
|
58
|
+
readonly jobKind?: AiJobKind;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Response for `POST /{tenantId}/v1/sessions`. Carries the freshly persisted
|
|
62
|
+
* session plus the quota decision so the UI can render a "Running" pill or a
|
|
63
|
+
* "Queued (3 / 10)" pill without a second round-trip.
|
|
64
|
+
*/
|
|
65
|
+
interface CreateSessionResponseDto {
|
|
66
|
+
readonly session: AiSessionDto;
|
|
67
|
+
readonly quota: AiQuotaSnapshotDto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Event kinds emitted as stream-json lines by the Claude Code worker (and synthetic
|
|
72
|
+
* lines from the orchestrator). Mirrors `RtAiSessionEventKindEnum` in System.Ai-3.
|
|
73
|
+
*/
|
|
74
|
+
type AiSessionEventKind = 'Message' | 'ToolCall' | 'ToolResult' | 'StatusChange' | 'Hook' | 'Error';
|
|
75
|
+
/**
|
|
76
|
+
* Payload pushed by the adapter's SignalR `OnSessionEventAsync` callback. Mirrors
|
|
77
|
+
* `SessionEventEnvelope` on the C# side.
|
|
78
|
+
*/
|
|
79
|
+
interface AiSessionEventDto {
|
|
80
|
+
readonly sessionId: string;
|
|
81
|
+
readonly kind: AiSessionEventKind;
|
|
82
|
+
readonly sequence: number;
|
|
83
|
+
readonly payload: string;
|
|
84
|
+
readonly actorRef: string;
|
|
85
|
+
readonly at: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Payload pushed by `OnSessionStatusChangedAsync`. Mirrors
|
|
89
|
+
* `SessionStatusChangedEnvelope` on the C# side.
|
|
90
|
+
*/
|
|
91
|
+
interface AiSessionStatusChangedDto {
|
|
92
|
+
readonly sessionId: string;
|
|
93
|
+
readonly newStatus: AiSessionStatus;
|
|
94
|
+
readonly reason?: string | null;
|
|
95
|
+
readonly at: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Decoded tool-call lifted from an `AiSessionEvent` payload. Owned by the UI
|
|
99
|
+
* because the adapter wire format is a stream-json string and the components
|
|
100
|
+
* render structured fields.
|
|
101
|
+
*/
|
|
102
|
+
interface AiToolCallDto {
|
|
103
|
+
readonly sessionId: string;
|
|
104
|
+
readonly callId: string;
|
|
105
|
+
readonly toolName: string;
|
|
106
|
+
readonly arguments: unknown;
|
|
107
|
+
readonly result?: unknown;
|
|
108
|
+
readonly status: 'Pending' | 'Approved' | 'Rejected' | 'Succeeded' | 'Failed';
|
|
109
|
+
readonly startedAt: string;
|
|
110
|
+
readonly completedAt?: string | null;
|
|
111
|
+
readonly durationMs?: number | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Approval outcome — mirrors the `ApprovalOutcome` enum the adapter writes back
|
|
116
|
+
* after the user decides. The hub serialises the enum name on the wire.
|
|
117
|
+
*/
|
|
118
|
+
type AiApprovalOutcome = 'Approved' | 'Rejected';
|
|
119
|
+
/**
|
|
120
|
+
* Why the approval gate fired. Mirrors `RtApprovalReasonEnum` in System.Ai-3.
|
|
121
|
+
* The strings match the C# enum value names verbatim — the adapter serialises
|
|
122
|
+
* the enum name, not its integer value, on the wire.
|
|
123
|
+
*/
|
|
124
|
+
type AiApprovalReason = 'HighRiskTool' | 'PerToolOverride' | 'PolicyDenied' | 'TenantOverride' | 'TimeoutResume';
|
|
125
|
+
/**
|
|
126
|
+
* Payload pushed by `OnApprovalRequestedAsync`. Mirrors
|
|
127
|
+
* `ApprovalRequestedEnvelope` on the C# side.
|
|
128
|
+
*/
|
|
129
|
+
interface AiApprovalRequestedDto {
|
|
130
|
+
readonly requestId: string;
|
|
131
|
+
readonly sessionId: string;
|
|
132
|
+
readonly toolName: string;
|
|
133
|
+
readonly payload: string;
|
|
134
|
+
readonly reason: AiApprovalReason | string;
|
|
135
|
+
readonly at: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Payload pushed by `OnApprovalDecidedAsync`. Mirrors `ApprovalDecidedEnvelope`
|
|
139
|
+
* on the C# side. Fanned to every connection so a UI in a sibling browser tab
|
|
140
|
+
* dismisses its modal too.
|
|
141
|
+
*/
|
|
142
|
+
interface AiApprovalDecidedDto {
|
|
143
|
+
readonly requestId: string;
|
|
144
|
+
readonly outcome: AiApprovalOutcome;
|
|
145
|
+
readonly comment?: string | null;
|
|
146
|
+
readonly decidedBy: string;
|
|
147
|
+
readonly at: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Body for `POST /{tenantId}/v1/sessions/{sessionId}/approvals/{requestId}`.
|
|
151
|
+
* The UI sends the user's decision; the server fans out
|
|
152
|
+
* `OnApprovalDecidedAsync` to every connection.
|
|
153
|
+
*/
|
|
154
|
+
interface AiApprovalDecisionDto {
|
|
155
|
+
readonly outcome: AiApprovalOutcome;
|
|
156
|
+
readonly comment?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Severity of a quota warning. `Warning` fires at 80% of the daily-tokens cap,
|
|
161
|
+
* `Critical` fires at 100%. Mirrors the C# discriminator string.
|
|
162
|
+
*/
|
|
163
|
+
type AiQuotaSeverity = 'Warning' | 'Critical';
|
|
164
|
+
/**
|
|
165
|
+
* Payload pushed by the adapter's `OnQuotaWarningAsync` SignalR callback.
|
|
166
|
+
* Broadcast to every connection for the tenant when the daily-tokens budget
|
|
167
|
+
* crosses 80% or 100%. UI renders a banner with the embedded numbers.
|
|
168
|
+
*/
|
|
169
|
+
interface AiQuotaWarningDto {
|
|
170
|
+
readonly severity: AiQuotaSeverity;
|
|
171
|
+
readonly thresholdPercent: number;
|
|
172
|
+
readonly tokensConsumed: number;
|
|
173
|
+
readonly tokensPerDayCap: number;
|
|
174
|
+
readonly at: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Scopes a one-time credential-registration ticket authorises. Mirrors
|
|
179
|
+
* `RtTicketScopeEnum` in System.Ai-3 (C# side: enum members
|
|
180
|
+
* `CredentialRegister`, `DevSshKeyRegister`).
|
|
181
|
+
*/
|
|
182
|
+
type AiCredentialTicketScope = 'CredentialRegister' | 'DevSshKeyRegister';
|
|
183
|
+
/**
|
|
184
|
+
* Body for `POST /{tenantId}/v1/credentials/tickets`. The admin in Refinery
|
|
185
|
+
* Studio fills this in to mint a one-time code the developer / operator
|
|
186
|
+
* redeems from their own machine (#4133). `ttlMinutes` is clamped server-side
|
|
187
|
+
* to 60 minutes; omitting it defaults to 5 minutes.
|
|
188
|
+
*/
|
|
189
|
+
interface IssueAiCredentialTicketRequestDto {
|
|
190
|
+
readonly scope: AiCredentialTicketScope;
|
|
191
|
+
readonly ttlMinutes?: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Wire shape returned from `POST /{tenantId}/v1/credentials/tickets`. The
|
|
195
|
+
* plaintext `code` is shown to the admin once and discarded after display —
|
|
196
|
+
* the server stores only the SHA-256 hash, so a future GET cannot re-derive
|
|
197
|
+
* it (#4133, concept §10).
|
|
198
|
+
*/
|
|
199
|
+
interface IssueAiCredentialTicketResponseDto {
|
|
200
|
+
readonly rtId: string;
|
|
201
|
+
readonly code: string;
|
|
202
|
+
readonly expiresAt: string;
|
|
203
|
+
readonly scope: AiCredentialTicketScope;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Configuration the host application supplies via {@link provideOctoAiConsole}.
|
|
208
|
+
* Every field is required so the library never falls back to a hard-coded URL or
|
|
209
|
+
* tenant id — host apps that wire the library through their own DI container can
|
|
210
|
+
* surface placeholders explicitly instead.
|
|
211
|
+
*/
|
|
212
|
+
interface AiAdapterOptions {
|
|
213
|
+
/**
|
|
214
|
+
* Absolute base URL of the AI Adapter REST API, e.g. `https://ai.acme.cloud`.
|
|
215
|
+
* Must NOT include a trailing slash. The library appends
|
|
216
|
+
* `/{tenantId}/v1/sessions...` itself.
|
|
217
|
+
*/
|
|
218
|
+
readonly baseUrl: string;
|
|
219
|
+
/**
|
|
220
|
+
* Tenant whose sessions the host wants to surface. The library renders the
|
|
221
|
+
* tenant id into every REST URL. Host apps that have multiple tenants must
|
|
222
|
+
* compose the provider with the tenant id from their routing context.
|
|
223
|
+
*/
|
|
224
|
+
readonly tenantId: string;
|
|
225
|
+
/**
|
|
226
|
+
* SignalR hub path, relative to the base URL, e.g. `/hubs/ai`. Used by
|
|
227
|
+
* `AiSessionStreamService` to connect when a host calls
|
|
228
|
+
* `streamSession(sessionId)`.
|
|
229
|
+
*/
|
|
230
|
+
readonly hubPath: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* DI token the services in this library read at construction time.
|
|
234
|
+
* Provided by {@link provideOctoAiConsole}.
|
|
235
|
+
*/
|
|
236
|
+
declare const AI_ADAPTER_OPTIONS: InjectionToken<AiAdapterOptions>;
|
|
237
|
+
/**
|
|
238
|
+
* Minimal subset of the `@microsoft/signalr` `HubConnection` surface the library
|
|
239
|
+
* exercises. The interface stays in the public API so host apps can supply
|
|
240
|
+
* either the real SignalR connection (Refinery Studio, bastion CLI), a test
|
|
241
|
+
* mock, or no factory at all — in which case {@link AiSessionStreamService}
|
|
242
|
+
* falls back to REST-only backfill (Phase-1 stub behaviour). Keeping the type
|
|
243
|
+
* structural lets the library stay agnostic of the `@microsoft/signalr` major
|
|
244
|
+
* version line the host has installed.
|
|
245
|
+
*/
|
|
246
|
+
interface AiHubConnectionLike {
|
|
247
|
+
on(methodName: string, handler: (payload: unknown) => void): void;
|
|
248
|
+
start(): Promise<void>;
|
|
249
|
+
stop(): Promise<void>;
|
|
250
|
+
invoke<T = unknown>(methodName: string, ...args: unknown[]): Promise<T>;
|
|
251
|
+
onreconnected(handler: (connectionId?: string) => void): void;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Builds a hub connection against the resolved URL. Return null when streaming
|
|
255
|
+
* is not wired in this deployment yet — the stream service then quietly skips
|
|
256
|
+
* the live channel and behaves exactly like the Phase-1 stub.
|
|
257
|
+
*/
|
|
258
|
+
type AiSessionStreamConnectionFactory = (hubUrl: string) => AiHubConnectionLike | null;
|
|
259
|
+
/**
|
|
260
|
+
* Optional DI token a host application provides to enable the live SignalR
|
|
261
|
+
* channel on {@link AiSessionStreamService}. When absent, the service degrades
|
|
262
|
+
* to REST-only backfill.
|
|
263
|
+
*/
|
|
264
|
+
declare const AI_SESSION_STREAM_CONNECTION_FACTORY: InjectionToken<AiSessionStreamConnectionFactory>;
|
|
265
|
+
/**
|
|
266
|
+
* Composable provider that surfaces the library's adapter configuration to the
|
|
267
|
+
* Angular DI container. Host applications call this once in `app.config.ts`:
|
|
268
|
+
*
|
|
269
|
+
* ```ts
|
|
270
|
+
* providers: [
|
|
271
|
+
* provideOctoAiConsole({
|
|
272
|
+
* baseUrl: 'https://ai.acme.cloud',
|
|
273
|
+
* tenantId: 'acme',
|
|
274
|
+
* hubPath: '/hubs/ai',
|
|
275
|
+
* }),
|
|
276
|
+
* ]
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
declare function provideOctoAiConsole(options: AiAdapterOptions): EnvironmentProviders;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Typed REST client for the AI Adapter's session endpoints. Every method maps
|
|
283
|
+
* 1:1 to a controller route on the C# side
|
|
284
|
+
* (`src/AiServices/TenantApi/v1/Controllers/SessionsController.cs`).
|
|
285
|
+
*
|
|
286
|
+
* The service does NOT cache responses or hold session state — each call is a
|
|
287
|
+
* pure pass-through to `HttpClient`. Components that need a derived view (e.g.
|
|
288
|
+
* a session list with status counts) should compose over the returned
|
|
289
|
+
* observables themselves; that keeps the client free of UI concerns and lets
|
|
290
|
+
* host apps mix Apollo / GraphQL state in the same component without dueling
|
|
291
|
+
* caches.
|
|
292
|
+
*/
|
|
293
|
+
/**
|
|
294
|
+
* Not `providedIn: 'root'` — `AI_ADAPTER_OPTIONS` is provided per-route in host
|
|
295
|
+
* apps (the tenant id is read from the route param, which the root injector
|
|
296
|
+
* doesn't see). A root-provided service would resolve through the root injector
|
|
297
|
+
* and fail with NG0201 on `AI_ADAPTER_OPTIONS`. Standalone components that
|
|
298
|
+
* inject this service pick up the route-level provider via the element
|
|
299
|
+
* injector hierarchy.
|
|
300
|
+
*/
|
|
301
|
+
declare class AiAdapterClientService {
|
|
302
|
+
private readonly http;
|
|
303
|
+
private readonly options;
|
|
304
|
+
/**
|
|
305
|
+
* `GET /{tenantId}/v1/sessions` — list all sessions for the configured tenant.
|
|
306
|
+
* Optional `status` filter narrows to one lifecycle state when present.
|
|
307
|
+
*/
|
|
308
|
+
listSessions(status?: string): Observable<AiSessionDto[]>;
|
|
309
|
+
/** `GET /{tenantId}/v1/sessions/{sessionId}` — single session by rtId. */
|
|
310
|
+
getSession(sessionId: string): Observable<AiSessionDto>;
|
|
311
|
+
/**
|
|
312
|
+
* `POST /{tenantId}/v1/sessions` — start a new session. Returns the persisted
|
|
313
|
+
* session plus the quota gate's decision so the caller can render either a
|
|
314
|
+
* "Running" pill or a "Queued (n)" pill without a second round-trip.
|
|
315
|
+
*/
|
|
316
|
+
createSession(request: CreateSessionRequestDto): Observable<CreateSessionResponseDto>;
|
|
317
|
+
/**
|
|
318
|
+
* `POST /{tenantId}/v1/sessions/{sessionId}/cancel` — request graceful
|
|
319
|
+
* cancellation; the orchestrator transitions the session to `Cancelled`
|
|
320
|
+
* once the worker has acknowledged.
|
|
321
|
+
*/
|
|
322
|
+
cancelSession(sessionId: string): Observable<AiSessionDto>;
|
|
323
|
+
/**
|
|
324
|
+
* `GET /{tenantId}/v1/sessions/{sessionId}/events?sinceSequence=N` — replay
|
|
325
|
+
* persisted events for a session. UI uses this on reconnect to backfill any
|
|
326
|
+
* events SignalR missed while disconnected (drives the resume-from-sequence
|
|
327
|
+
* path in {@link AiSessionStreamService}).
|
|
328
|
+
*/
|
|
329
|
+
listEvents(sessionId: string, sinceSequence?: number): Observable<AiSessionEventDto[]>;
|
|
330
|
+
/**
|
|
331
|
+
* `POST /{tenantId}/v1/sessions/{sessionId}/approvals/{requestId}` — submit
|
|
332
|
+
* the user's decision on a paused approval gate. Server fans
|
|
333
|
+
* `OnApprovalDecidedAsync` to every connection on the session.
|
|
334
|
+
*/
|
|
335
|
+
decideApproval(sessionId: string, requestId: string, decision: AiApprovalDecisionDto): Observable<void>;
|
|
336
|
+
/**
|
|
337
|
+
* `POST /{tenantId}/v1/credentials/tickets` — mint a one-time credential-
|
|
338
|
+
* registration ticket (#4133). The admin sees the plaintext code once in
|
|
339
|
+
* the response; the server stores only the SHA-256 hash. The matching
|
|
340
|
+
* redemption call (`POST /v1/credentials/tickets/redeem`) is anonymous and
|
|
341
|
+
* NOT in this client because the redeemer is by design a different person
|
|
342
|
+
* on a different machine — they use the bastion CLI, not the Studio.
|
|
343
|
+
*/
|
|
344
|
+
issueCredentialTicket(request: IssueAiCredentialTicketRequestDto): Observable<IssueAiCredentialTicketResponseDto>;
|
|
345
|
+
private tenantBase;
|
|
346
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiAdapterClientService, never>;
|
|
347
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AiAdapterClientService>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* One open SignalR connection's worth of streams. Sessions get one
|
|
352
|
+
* `SessionStream` per `streamSession()` call; closing the returned subscription
|
|
353
|
+
* tears the connection down.
|
|
354
|
+
*/
|
|
355
|
+
interface AiSessionStream {
|
|
356
|
+
/** Stream-json lines plus orchestrator markers, ordered by `sequence`. */
|
|
357
|
+
readonly events$: Observable<AiSessionEventDto>;
|
|
358
|
+
/** Lifecycle transitions for the session. */
|
|
359
|
+
readonly statusChanges$: Observable<AiSessionStatusChangedDto>;
|
|
360
|
+
/** Approval gate fired — UI opens the modal. */
|
|
361
|
+
readonly approvalsRequested$: Observable<AiApprovalRequestedDto>;
|
|
362
|
+
/** Approval resolved — UI dismisses the modal in every tab. */
|
|
363
|
+
readonly approvalsDecided$: Observable<AiApprovalDecidedDto>;
|
|
364
|
+
/** Tenant-wide quota threshold crossed — UI renders a banner. */
|
|
365
|
+
readonly quotaWarnings$: Observable<AiQuotaWarningDto>;
|
|
366
|
+
/** Tear down the underlying SignalR connection and complete all observables. */
|
|
367
|
+
disconnect(): void;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Internal wrapper around the SignalR connection. The library does not pin a
|
|
371
|
+
* SignalR version — host applications inject a `HubConnectionBuilder` they
|
|
372
|
+
* already use, which keeps the library agnostic of the
|
|
373
|
+
* `@microsoft/signalr` major version line (six and seven have diverged on the
|
|
374
|
+
* `withAutomaticReconnect()` defaults).
|
|
375
|
+
*
|
|
376
|
+
* For now the connection is constructed deferred — `streamSession` builds it on
|
|
377
|
+
* demand so the host can defer the SignalR JS bundle behind a route lazy-load.
|
|
378
|
+
* Phase-1 ships a stub backed by `ReplaySubject` so demo apps can drive
|
|
379
|
+
* components without a live hub; the real connection wiring lives behind a
|
|
380
|
+
* `connectionFactory` provider the host overrides.
|
|
381
|
+
*/
|
|
382
|
+
/**
|
|
383
|
+
* Not `providedIn: 'root'` — see <see cref="AiAdapterClientService"/> for the
|
|
384
|
+
* rationale: `AI_ADAPTER_OPTIONS` is a per-route token, the root injector
|
|
385
|
+
* cannot resolve it. Element-level injection picks up the route-level provider.
|
|
386
|
+
*/
|
|
387
|
+
declare class AiSessionStreamService {
|
|
388
|
+
private readonly options;
|
|
389
|
+
private readonly client;
|
|
390
|
+
private readonly connectionFactory;
|
|
391
|
+
/**
|
|
392
|
+
* Open a streaming session. Returns the per-stream subjects and a
|
|
393
|
+
* `disconnect()` closer. When the host has provided an
|
|
394
|
+
* {@link AI_SESSION_STREAM_CONNECTION_FACTORY}, a live SignalR connection is
|
|
395
|
+
* built against {@link hubUrl} and the five hub callbacks
|
|
396
|
+
* (`OnSessionEventAsync`, `OnSessionStatusChangedAsync`,
|
|
397
|
+
* `OnApprovalRequestedAsync`, `OnApprovalDecidedAsync`, `OnQuotaWarningAsync`)
|
|
398
|
+
* are routed into the matching subject. Without a factory, the service
|
|
399
|
+
* degrades to REST-only backfill — the original Phase-1 stub contract.
|
|
400
|
+
*
|
|
401
|
+
* Tracking the highest sequence we've emitted lets the host reconnect after a
|
|
402
|
+
* network blip by passing `sinceSequence` to {@link replay} (the SignalR
|
|
403
|
+
* `onreconnected` hook fires that with the highest seen sequence).
|
|
404
|
+
*/
|
|
405
|
+
streamSession(sessionId: string): AiSessionStream;
|
|
406
|
+
/**
|
|
407
|
+
* Backfill missing events from a known sequence number and push them into
|
|
408
|
+
* the host's existing stream. Used by a SignalR `onreconnected` hook the
|
|
409
|
+
* host wires up.
|
|
410
|
+
*/
|
|
411
|
+
replay(sessionId: string, sinceSequence: number, sink: Subject<AiSessionEventDto> | ReplaySubject<AiSessionEventDto>): void;
|
|
412
|
+
/**
|
|
413
|
+
* Tenant-scoped hub URL. Composition matches the AI Adapter's hub map —
|
|
414
|
+
* `app.MapHub<AiHub>("/{tenantId:tenantId}/aiHub")` — so the host's
|
|
415
|
+
* `hubPath` is appended after the tenant segment. Host apps that mount the
|
|
416
|
+
* hub at a different relative path override `hubPath` via
|
|
417
|
+
* `AI_ADAPTER_OPTIONS`.
|
|
418
|
+
*/
|
|
419
|
+
get hubUrl(): string;
|
|
420
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiSessionStreamService, never>;
|
|
421
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AiSessionStreamService>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* List view of an AI Adapter tenant's sessions. The host owns data fetching —
|
|
426
|
+
* the component takes the array as an input signal and emits the rtId on
|
|
427
|
+
* row click. Keeping it data-source-agnostic lets refinery wire its own
|
|
428
|
+
* Apollo cache while a bastion CLI could pass static fixtures in a Storybook.
|
|
429
|
+
*/
|
|
430
|
+
declare class AiSessionListComponent {
|
|
431
|
+
readonly sessions: _angular_core.InputSignal<AiSessionDto[]>;
|
|
432
|
+
readonly selectedSessionId: _angular_core.InputSignal<string | null>;
|
|
433
|
+
readonly sessionSelected: _angular_core.OutputEmitterRef<string>;
|
|
434
|
+
protected readonly orderedSessions: _angular_core.Signal<AiSessionDto[]>;
|
|
435
|
+
protected onSelect(sessionRtId: string): void;
|
|
436
|
+
protected age(startedAt: string): string;
|
|
437
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiSessionListComponent, never>;
|
|
438
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiSessionListComponent, "mm-ai-session-list", never, { "sessions": { "alias": "sessions"; "required": true; "isSignal": true; }; "selectedSessionId": { "alias": "selectedSessionId"; "required": false; "isSignal": true; }; }, { "sessionSelected": "sessionSelected"; }, never, never, true, never>;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Read-only transcript of a session, derived from the events stream. The
|
|
443
|
+
* component takes the events as an input signal so the host owns lifetime —
|
|
444
|
+
* a parent that's already wired `AiSessionStreamService.events$` into a
|
|
445
|
+
* `toSignal()` just hands the same signal in.
|
|
446
|
+
*
|
|
447
|
+
* Markdown rendering is deliberately minimal in Phase 1: the component shows
|
|
448
|
+
* the raw payload (already JSON or stream-json) in a `<pre>` block. The
|
|
449
|
+
* concept §10 calls for proper markdown + code-block highlighting; that
|
|
450
|
+
* upgrade lands behind a `markdown` Input once we've picked a renderer
|
|
451
|
+
* (markdown-it vs marked) and verified its CSP behaviour.
|
|
452
|
+
*/
|
|
453
|
+
declare class AiChatStreamComponent {
|
|
454
|
+
readonly events: _angular_core.InputSignal<AiSessionEventDto[]>;
|
|
455
|
+
/**
|
|
456
|
+
* Sorted by sequence so out-of-order arrival (the SignalR + REST backfill
|
|
457
|
+
* union) renders deterministically.
|
|
458
|
+
*/
|
|
459
|
+
protected readonly orderedEvents: _angular_core.Signal<AiSessionEventDto[]>;
|
|
460
|
+
protected variant(kind: AiSessionEventDto['kind']): string;
|
|
461
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiChatStreamComponent, never>;
|
|
462
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiChatStreamComponent, "mm-ai-chat-stream", never, { "events": { "alias": "events"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Expandable card surface for one tool invocation in a session transcript.
|
|
467
|
+
* Click the header to toggle arguments + result; the body is rendered as
|
|
468
|
+
* pretty-printed JSON so the host doesn't need its own json formatter.
|
|
469
|
+
*/
|
|
470
|
+
declare class AiToolCallComponent {
|
|
471
|
+
readonly call: _angular_core.InputSignal<AiToolCallDto>;
|
|
472
|
+
protected readonly expanded: _angular_core.WritableSignal<boolean>;
|
|
473
|
+
protected readonly statusVariant: _angular_core.Signal<"failed" | "succeeded" | "rejected" | "pending">;
|
|
474
|
+
protected readonly argumentsJson: _angular_core.Signal<string>;
|
|
475
|
+
protected readonly resultJson: _angular_core.Signal<string | null>;
|
|
476
|
+
protected toggleExpanded(): void;
|
|
477
|
+
private format;
|
|
478
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiToolCallComponent, never>;
|
|
479
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiToolCallComponent, "mm-ai-tool-call", never, { "call": { "alias": "call"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Approval modal. The host opens it when a `AiApprovalRequestedDto` arrives on
|
|
484
|
+
* the SignalR stream, fills the `request` input, and listens for the `decide`
|
|
485
|
+
* output to call `AiAdapterClientService.decideApproval`. The modal itself is
|
|
486
|
+
* presentation-only: no networking, no global state, no portal magic.
|
|
487
|
+
*
|
|
488
|
+
* The host is expected to wrap the modal in its own backdrop / focus-trap so
|
|
489
|
+
* the library doesn't pull in a positioning dependency (CDK overlay, Kendo
|
|
490
|
+
* window, ng-bootstrap, …) — each host shop already has one.
|
|
491
|
+
*/
|
|
492
|
+
declare class AiApprovalModalComponent {
|
|
493
|
+
readonly request: _angular_core.InputSignal<AiApprovalRequestedDto>;
|
|
494
|
+
readonly decide: _angular_core.OutputEmitterRef<AiApprovalDecisionDto>;
|
|
495
|
+
readonly dismiss: _angular_core.OutputEmitterRef<void>;
|
|
496
|
+
protected readonly comment: _angular_core.WritableSignal<string>;
|
|
497
|
+
protected readonly prettyPayload: _angular_core.Signal<string>;
|
|
498
|
+
protected approve(): void;
|
|
499
|
+
protected reject(): void;
|
|
500
|
+
protected onDismiss(): void;
|
|
501
|
+
private commentOrUndefined;
|
|
502
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiApprovalModalComponent, never>;
|
|
503
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiApprovalModalComponent, "mm-ai-approval-modal", never, { "request": { "alias": "request"; "required": true; "isSignal": true; }; }, { "decide": "decide"; "dismiss": "dismiss"; }, never, never, true, never>;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Two-bar usage indicator (daily + monthly) with threshold colour state.
|
|
508
|
+
* Inputs are unit-agnostic counts and caps; the component does not parse the
|
|
509
|
+
* tenant's `AiQuotaLimit` itself — the host is expected to feed numbers the
|
|
510
|
+
* adapter already aggregated.
|
|
511
|
+
*/
|
|
512
|
+
declare class AiQuotaIndicatorComponent {
|
|
513
|
+
readonly dailyConsumed: _angular_core.InputSignal<number>;
|
|
514
|
+
readonly dailyCap: _angular_core.InputSignal<number>;
|
|
515
|
+
readonly monthlyConsumed: _angular_core.InputSignal<number | null>;
|
|
516
|
+
readonly monthlyCap: _angular_core.InputSignal<number | null>;
|
|
517
|
+
protected readonly dailyPercent: _angular_core.Signal<number>;
|
|
518
|
+
protected readonly monthlyPercent: _angular_core.Signal<number | null>;
|
|
519
|
+
protected readonly dailyState: _angular_core.Signal<"ok" | "warning" | "critical">;
|
|
520
|
+
protected readonly monthlyState: _angular_core.Signal<"ok" | "warning" | "critical" | null>;
|
|
521
|
+
private percent;
|
|
522
|
+
private toState;
|
|
523
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiQuotaIndicatorComponent, never>;
|
|
524
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiQuotaIndicatorComponent, "mm-ai-quota-indicator", never, { "dailyConsumed": { "alias": "dailyConsumed"; "required": true; "isSignal": true; }; "dailyCap": { "alias": "dailyCap"; "required": true; "isSignal": true; }; "monthlyConsumed": { "alias": "monthlyConsumed"; "required": false; "isSignal": true; }; "monthlyCap": { "alias": "monthlyCap"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Status pill that mirrors the eight values `AiSessionStatus` carries on the
|
|
529
|
+
* wire. The component is purely visual — it takes a status string in and emits
|
|
530
|
+
* a CSS class + display label that the host's stylesheet can theme via the
|
|
531
|
+
* `--mm-ai-status-*` custom properties.
|
|
532
|
+
*/
|
|
533
|
+
declare class AiJobStatusBadgeComponent {
|
|
534
|
+
readonly status: _angular_core.InputSignal<AiSessionStatus>;
|
|
535
|
+
protected readonly variant: _angular_core.Signal<"running" | "queued" | "paused" | "completed" | "failed" | "blocked">;
|
|
536
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiJobStatusBadgeComponent, never>;
|
|
537
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiJobStatusBadgeComponent, "mm-ai-job-status-badge", never, { "status": { "alias": "status"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Self-service credential-ticket issuer (#4133, concept §10). Admin picks a
|
|
542
|
+
* scope + TTL, hits **Issue ticket**, copies the displayed code, hands it to
|
|
543
|
+
* a developer / operator out-of-band. The plaintext code is shown exactly
|
|
544
|
+
* once — refreshing the panel after issue clears it so a careless screenshot
|
|
545
|
+
* doesn't leak.
|
|
546
|
+
*
|
|
547
|
+
* Theme-neutral by design: visuals use CSS custom properties with neutral
|
|
548
|
+
* defaults so the host (Refinery Studio LCARS, demo-app, etc.) can override
|
|
549
|
+
* them via `--mm-ai-ticket-*` variables without touching the component.
|
|
550
|
+
*/
|
|
551
|
+
declare class AiCredentialTicketIssueComponent {
|
|
552
|
+
private readonly client;
|
|
553
|
+
protected readonly scope: _angular_core.WritableSignal<AiCredentialTicketScope>;
|
|
554
|
+
protected readonly ttlMinutes: _angular_core.WritableSignal<number>;
|
|
555
|
+
protected readonly issuing: _angular_core.WritableSignal<boolean>;
|
|
556
|
+
protected readonly issued: _angular_core.WritableSignal<IssueAiCredentialTicketResponseDto | null>;
|
|
557
|
+
protected readonly error: _angular_core.WritableSignal<string | null>;
|
|
558
|
+
protected readonly copied: _angular_core.WritableSignal<boolean>;
|
|
559
|
+
/** Available scope choices — kept in sync with `AiCredentialTicketScope`. */
|
|
560
|
+
protected readonly scopes: readonly {
|
|
561
|
+
value: AiCredentialTicketScope;
|
|
562
|
+
label: string;
|
|
563
|
+
hint: string;
|
|
564
|
+
}[];
|
|
565
|
+
protected onIssue(): void;
|
|
566
|
+
protected onCopy(): void;
|
|
567
|
+
protected onClear(): void;
|
|
568
|
+
private normalizedTtl;
|
|
569
|
+
private formatError;
|
|
570
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AiCredentialTicketIssueComponent, never>;
|
|
571
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AiCredentialTicketIssueComponent, "mm-ai-credential-ticket-issue", never, {}, {}, never, never, true, never>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export { AI_ADAPTER_OPTIONS, AI_SESSION_STREAM_CONNECTION_FACTORY, AiAdapterClientService, AiApprovalModalComponent, AiChatStreamComponent, AiCredentialTicketIssueComponent, AiJobStatusBadgeComponent, AiQuotaIndicatorComponent, AiSessionListComponent, AiSessionStreamService, AiToolCallComponent, provideOctoAiConsole };
|
|
575
|
+
export type { AiAdapterOptions, AiApprovalDecidedDto, AiApprovalDecisionDto, AiApprovalOutcome, AiApprovalReason, AiApprovalRequestedDto, AiCredentialTicketScope, AiHubConnectionLike, AiJobKind, AiQuotaSeverity, AiQuotaSnapshotDto, AiQuotaWarningDto, AiSessionDto, AiSessionEventDto, AiSessionEventKind, AiSessionStatus, AiSessionStatusChangedDto, AiSessionStream, AiSessionStreamConnectionFactory, AiToolCallDto, CreateSessionRequestDto, CreateSessionResponseDto, IssueAiCredentialTicketRequestDto, IssueAiCredentialTicketResponseDto };
|