@bpmsoftwaresolutions/ai-engine-client 1.0.0-beta.11 → 1.0.0-beta.12
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 +59 -1
- package/package.json +1 -1
- package/src/index.js +73 -0
package/README.md
CHANGED
|
@@ -94,7 +94,8 @@ If your deployment enforces bearer auth on operator routes, API-key-only constru
|
|
|
94
94
|
|
|
95
95
|
Some methods do not return plain JSON:
|
|
96
96
|
|
|
97
|
-
- Markdown download helpers return `{ text, contentType, fileName }`.
|
|
97
|
+
- Markdown download helpers return `{ text, contentType, fileName, headers }`.
|
|
98
|
+
- LOGA projection helpers return markdown plus governed projection metadata: `{ text, contentType, headers, logaContract, interactionContract, projectionType, projectionVersion, sourceTruth, sourceVersion, correlationId, refreshPolicy, generatedAt, provenance }`.
|
|
98
99
|
- Binary download helpers return `{ arrayBuffer, contentType, fileName }`.
|
|
99
100
|
|
|
100
101
|
Examples:
|
|
@@ -106,10 +107,56 @@ const markdown = await client.downloadProjectCharterReportMarkdown(projectId);
|
|
|
106
107
|
console.log(markdown.fileName, markdown.contentType);
|
|
107
108
|
console.log(markdown.text);
|
|
108
109
|
|
|
110
|
+
const logaRoadmap = await client.getLogaProjectRoadmapProjection(projectId);
|
|
111
|
+
console.log(logaRoadmap.projectionType, logaRoadmap.projectionVersion);
|
|
112
|
+
console.log(logaRoadmap.provenance.sourceTruth, logaRoadmap.correlationId);
|
|
113
|
+
console.log(logaRoadmap.text);
|
|
114
|
+
|
|
109
115
|
const audio = await client.downloadExternalAudioRender(audioRenderRunId);
|
|
110
116
|
await fs.promises.writeFile('render.mp3', Buffer.from(audio.arrayBuffer));
|
|
111
117
|
```
|
|
112
118
|
|
|
119
|
+
### LOGA Projection Contract
|
|
120
|
+
|
|
121
|
+
LOGA should use the `getLoga*Projection()` methods for runtime documents. These endpoints are governed AI Engine transformations: durable SQL state is normalized into typed projection models, transformed into versioned structured markdown, and served with provenance, refresh, and action metadata for LOGA to render.
|
|
122
|
+
|
|
123
|
+
The client exposes the transport metadata from response headers so LOGA can validate the contract before rendering:
|
|
124
|
+
|
|
125
|
+
- `logaContract`: currently `ai-engine-ui/v1`
|
|
126
|
+
- `interactionContract`: currently `loga-choreography/v1`
|
|
127
|
+
- `projectionType`: for example `operator.project_roadmap`
|
|
128
|
+
- `projectionWorkflow`: currently `loga-document-projection`
|
|
129
|
+
- `projectionVersion`
|
|
130
|
+
- `sourceTruth`: normally `sql`
|
|
131
|
+
- `sourceVersion`
|
|
132
|
+
- `correlationId`
|
|
133
|
+
- `refreshPolicy`
|
|
134
|
+
- `generatedAt`
|
|
135
|
+
- `provenance`: grouped copy of the source/projection/version fields
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
import {
|
|
141
|
+
AIEngineClient,
|
|
142
|
+
LOGA_CONTRACT,
|
|
143
|
+
LOGA_INTERACTION_CONTRACT,
|
|
144
|
+
} from '@bpmsoftwaresolutions/ai-engine-client';
|
|
145
|
+
|
|
146
|
+
const client = AIEngineClient.fromEnv();
|
|
147
|
+
const projection = await client.getLogaProjectRoadmapProjection(projectId);
|
|
148
|
+
|
|
149
|
+
if (projection.logaContract !== LOGA_CONTRACT) {
|
|
150
|
+
throw new Error(`Unsupported LOGA contract: ${projection.logaContract}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
console.log(projection.interactionContract === LOGA_INTERACTION_CONTRACT);
|
|
154
|
+
renderLogaMarkdown(projection.text, {
|
|
155
|
+
projectionType: projection.projectionType,
|
|
156
|
+
provenance: projection.provenance,
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
113
160
|
### fromEnv
|
|
114
161
|
|
|
115
162
|
```js
|
|
@@ -321,6 +368,17 @@ Low-level compatibility methods:
|
|
|
321
368
|
| `listAzureSqlBacpacBackups({ storageAccount, container, ... })` | List BACPAC exports through the legacy infra-shaped operator API. |
|
|
322
369
|
| `listAzureSqlBacpacBackupOperations({ databaseName, resourceGroup, serverName, ... })` | List Azure SQL operations through the legacy infra-shaped operator API. |
|
|
323
370
|
|
|
371
|
+
### LOGA Projections
|
|
372
|
+
| Method | Endpoint | Description |
|
|
373
|
+
|---|---|---|
|
|
374
|
+
| `getLogaOperatorHomeProjection()` | `GET /api/operator/projections/home` | Governed operator home runtime markdown document. |
|
|
375
|
+
| `getLogaProjectCatalogProjection()` | `GET /api/operator/projections/project-catalog` | Governed project catalog runtime markdown document. |
|
|
376
|
+
| `getLogaProjectRoadmapProjection(projectId)` | `GET /api/operator/projections/projects/:projectId/roadmap.md` | Governed project roadmap runtime markdown document. |
|
|
377
|
+
| `getLogaWorkflowRunProjection(workflowRunId)` | `GET /api/operator/projections/workflow-runs/:workflowRunId` | Governed workflow run runtime markdown document. |
|
|
378
|
+
| `getLogaEvidencePacketProjection(packetKey)` | `GET /api/operator/projections/evidence-packets/:packetKey` | Governed evidence packet runtime markdown document. |
|
|
379
|
+
|
|
380
|
+
These methods return markdown as `text` and expose projection headers as top-level fields plus `provenance`. LOGA should render the markdown emitted by AI Engine and use these metadata fields for contract validation, refresh behavior, evidence display, and action choreography.
|
|
381
|
+
|
|
324
382
|
### Retrieval Wrapper
|
|
325
383
|
| Method | Description |
|
|
326
384
|
|---|---|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const DEFAULT_TIMEOUT_MS = 30000;
|
|
2
2
|
|
|
3
|
+
export const LOGA_CONTRACT = 'ai-engine-ui/v1';
|
|
4
|
+
export const LOGA_INTERACTION_CONTRACT = 'loga-choreography/v1';
|
|
5
|
+
export const LOGA_PROJECTION_WORKFLOW = 'loga-document-projection';
|
|
6
|
+
|
|
3
7
|
function trimTrailingSlash(value) {
|
|
4
8
|
return String(value || '').replace(/\/+$/, '');
|
|
5
9
|
}
|
|
@@ -28,6 +32,44 @@ function parseContentDispositionFilename(headerValue) {
|
|
|
28
32
|
return plainMatch ? plainMatch[1].trim() : null;
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
function readResponseHeader(headers, name) {
|
|
36
|
+
if (!headers || typeof headers.get !== 'function') return null;
|
|
37
|
+
return headers.get(name) || headers.get(name.toLowerCase()) || null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function extractLogaProjectionMetadata(headers) {
|
|
41
|
+
const projectionWorkflow = readResponseHeader(headers, 'x-projection-workflow');
|
|
42
|
+
const projectionVersion = readResponseHeader(headers, 'x-projection-version');
|
|
43
|
+
const sourceVersion = readResponseHeader(headers, 'x-source-version');
|
|
44
|
+
const correlationId = readResponseHeader(headers, 'x-correlation-id');
|
|
45
|
+
const logaContract = readResponseHeader(headers, 'x-loga-contract');
|
|
46
|
+
const projectionType = readResponseHeader(headers, 'x-projection-type');
|
|
47
|
+
const sourceTruth = readResponseHeader(headers, 'x-source-truth');
|
|
48
|
+
const refreshPolicy = readResponseHeader(headers, 'x-refresh-policy');
|
|
49
|
+
const generatedAt = readResponseHeader(headers, 'x-generated-at');
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
logaContract,
|
|
53
|
+
interactionContract: LOGA_INTERACTION_CONTRACT,
|
|
54
|
+
projectionType,
|
|
55
|
+
projectionWorkflow,
|
|
56
|
+
projectionVersion,
|
|
57
|
+
sourceTruth,
|
|
58
|
+
sourceVersion,
|
|
59
|
+
correlationId,
|
|
60
|
+
refreshPolicy,
|
|
61
|
+
generatedAt,
|
|
62
|
+
provenance: {
|
|
63
|
+
sourceTruth,
|
|
64
|
+
sourceVersion,
|
|
65
|
+
projectionVersion,
|
|
66
|
+
projectionWorkflow,
|
|
67
|
+
correlationId,
|
|
68
|
+
generatedAt,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
31
73
|
function isFormDataBody(value) {
|
|
32
74
|
return typeof FormData !== 'undefined' && value instanceof FormData;
|
|
33
75
|
}
|
|
@@ -709,6 +751,28 @@ export class AIEngineClient {
|
|
|
709
751
|
return this._request(`/api/operator/projects/${projectId}/bundle`);
|
|
710
752
|
}
|
|
711
753
|
|
|
754
|
+
// LOGA projections are governed runtime documents, not static reports.
|
|
755
|
+
|
|
756
|
+
async getLogaOperatorHomeProjection() {
|
|
757
|
+
return this._requestLogaProjection('/api/operator/projections/home');
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
async getLogaProjectCatalogProjection() {
|
|
761
|
+
return this._requestLogaProjection('/api/operator/projections/project-catalog');
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
async getLogaProjectRoadmapProjection(projectId) {
|
|
765
|
+
return this._requestLogaProjection(`/api/operator/projections/projects/${projectId}/roadmap.md`);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
async getLogaWorkflowRunProjection(workflowRunId) {
|
|
769
|
+
return this._requestLogaProjection(`/api/operator/projections/workflow-runs/${workflowRunId}`);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
async getLogaEvidencePacketProjection(packetKey) {
|
|
773
|
+
return this._requestLogaProjection(`/api/operator/projections/evidence-packets/${packetKey}`);
|
|
774
|
+
}
|
|
775
|
+
|
|
712
776
|
// ─── Roadmaps ──────────────────────────────────────────────────────────────
|
|
713
777
|
|
|
714
778
|
async listProjectRoadmaps({ includeInactive } = {}) {
|
|
@@ -1393,12 +1457,21 @@ export class AIEngineClient {
|
|
|
1393
1457
|
text: await response.text(),
|
|
1394
1458
|
contentType,
|
|
1395
1459
|
fileName: parseContentDispositionFilename(contentDisposition),
|
|
1460
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
1396
1461
|
};
|
|
1397
1462
|
} finally {
|
|
1398
1463
|
clearTimeout(timeoutHandle);
|
|
1399
1464
|
}
|
|
1400
1465
|
}
|
|
1401
1466
|
|
|
1467
|
+
async _requestLogaProjection(path, options = {}) {
|
|
1468
|
+
const result = await this._requestText(path, options);
|
|
1469
|
+
return {
|
|
1470
|
+
...result,
|
|
1471
|
+
...extractLogaProjectionMetadata(new Headers(result.headers || {})),
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1402
1475
|
async _requestBinary(path, { method = 'GET', query, headers, body } = {}) {
|
|
1403
1476
|
const url = appendQuery(`${this.baseUrl}${path}`, query);
|
|
1404
1477
|
const controller = new AbortController();
|