@bpmsoftwaresolutions/ai-engine-client 1.0.0-beta.4 → 1.0.0-beta.6
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 +8 -0
- package/package.json +27 -27
- package/src/index.js +83 -0
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ const client = AIEngineClient.fromEnv();
|
|
|
76
76
|
| `currentSecurityGovernanceStatus({ environment, topN })` | Security governance findings. |
|
|
77
77
|
| `currentCodebaseShapeStatus()` | Codebase shape analysis. |
|
|
78
78
|
| `getLatestMemoryProjection()` | Current SQL memory projection (startup hydration source). |
|
|
79
|
+
| `currentProjectStatus({ projectId })` | Current project status projection from SQL memory. |
|
|
79
80
|
| `getDashboard()` | Operator dashboard payload. |
|
|
80
81
|
|
|
81
82
|
### Retrieval Wrapper
|
|
@@ -172,6 +173,11 @@ const client = AIEngineClient.fromEnv();
|
|
|
172
173
|
| `createProjectCharter({ projectName, objective, businessContext, successCriteria, priority, constraints, inScope, outOfScope, assumptions, linkedWorkflows, testingStrategy, initialContext, requestedBy })` | Charter a project (writes to durable SQL memory). |
|
|
173
174
|
| `listProjects({ limit, includeInactive, processStatus, charterStatus })` | List projects. |
|
|
174
175
|
| `getProject(projectId)` | Get project detail. |
|
|
176
|
+
| `getProjectCharterReport(projectId)` | Get the SQL-backed charter report payload for a project. |
|
|
177
|
+
| `createProjectMarkdownDownload(projectId, { reportType, includeMarkdown })` | Create a markdown download descriptor for `charter` or `implementation_roadmap`. |
|
|
178
|
+
| `downloadProjectMarkdownReport(projectId, reportType)` | Download a rendered markdown report as text plus filename metadata. |
|
|
179
|
+
| `downloadProjectCharterReportMarkdown(projectId)` | Download the charter markdown report. |
|
|
180
|
+
| `getProjectBundle(projectId)` | Get current status, charter report, and roadmap report in one payload. |
|
|
175
181
|
|
|
176
182
|
### Roadmaps
|
|
177
183
|
| Method | Description |
|
|
@@ -180,6 +186,8 @@ const client = AIEngineClient.fromEnv();
|
|
|
180
186
|
| `getProjectRoadmap(projectId)` | Get full roadmap for a project. |
|
|
181
187
|
| `getProjectRoadmapSummary(projectId)` | Roadmap summary. |
|
|
182
188
|
| `getProjectRoadmapActiveItem(projectId)` | Current active roadmap item. |
|
|
189
|
+
| `getProjectImplementationRoadmapReport(projectId)` | Get the SQL-backed implementation roadmap report payload. |
|
|
190
|
+
| `downloadProjectImplementationRoadmapReportMarkdown(projectId)` | Download the implementation roadmap markdown report. |
|
|
183
191
|
| `ensureProjectRoadmapTaskSurface(projectId, { requestedBy, assignedTo, createAcceptanceSubtasks })` | Materialize the active roadmap item's parent task and acceptance subtasks. |
|
|
184
192
|
| `listProjectOpenTasks(projectId)` | Open tasks for a project. |
|
|
185
193
|
| `getProjectPerformanceMetrics(projectId, { workflowId, workflowRunId, sinceUtc })` | Performance metrics. |
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bpmsoftwaresolutions/ai-engine-client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "Thin npm client for the AI Engine operator and retrieval APIs",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./src/index.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./src/index.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=18"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"ai-engine",
|
|
19
|
-
"sdk",
|
|
20
|
-
"client",
|
|
21
|
-
"retrieval",
|
|
22
|
-
"workflow"
|
|
23
|
-
],
|
|
24
|
-
"license": "UNLICENSED",
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bpmsoftwaresolutions/ai-engine-client",
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
|
+
"description": "Thin npm client for the AI Engine operator and retrieval APIs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"ai-engine",
|
|
19
|
+
"sdk",
|
|
20
|
+
"client",
|
|
21
|
+
"retrieval",
|
|
22
|
+
"workflow"
|
|
23
|
+
],
|
|
24
|
+
"license": "UNLICENSED",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
28
|
}
|
package/src/index.js
CHANGED
|
@@ -20,6 +20,14 @@ async function readJson(response) {
|
|
|
20
20
|
return { message: text };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function parseContentDispositionFilename(headerValue) {
|
|
24
|
+
const value = String(headerValue || '');
|
|
25
|
+
const quotedMatch = value.match(/filename="([^"]+)"/i);
|
|
26
|
+
if (quotedMatch) return quotedMatch[1];
|
|
27
|
+
const plainMatch = value.match(/filename=([^;]+)/i);
|
|
28
|
+
return plainMatch ? plainMatch[1].trim() : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
export class AIEngineClient {
|
|
24
32
|
constructor({ baseUrl, apiKey, actorId, fetchImpl, timeoutMs } = {}) {
|
|
25
33
|
if (!baseUrl) throw new Error('baseUrl is required.');
|
|
@@ -80,6 +88,12 @@ export class AIEngineClient {
|
|
|
80
88
|
return this._request('/api/operator/latest-memory-projection');
|
|
81
89
|
}
|
|
82
90
|
|
|
91
|
+
async currentProjectStatus({ projectId } = {}) {
|
|
92
|
+
return this._request('/api/operator/current-project-status', {
|
|
93
|
+
query: { project_id: projectId },
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
async getDashboard() {
|
|
84
98
|
return this._request('/api/dashboard');
|
|
85
99
|
}
|
|
@@ -472,6 +486,29 @@ export class AIEngineClient {
|
|
|
472
486
|
return this._request(`/api/operator/projects/${projectId}`);
|
|
473
487
|
}
|
|
474
488
|
|
|
489
|
+
async getProjectCharterReport(projectId) {
|
|
490
|
+
return this._request(`/api/operator/projects/${projectId}/charter/report`);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
async createProjectMarkdownDownload(projectId, { reportType, includeMarkdown = false } = {}) {
|
|
494
|
+
return this._request(`/api/operator/projects/${projectId}/markdown-report-downloads`, {
|
|
495
|
+
method: 'POST',
|
|
496
|
+
body: { report_type: reportType, include_markdown: includeMarkdown },
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
async downloadProjectMarkdownReport(projectId, reportType) {
|
|
501
|
+
return this._requestText(`/api/operator/projects/${projectId}/markdown-reports/${reportType}/download`);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
async downloadProjectCharterReportMarkdown(projectId) {
|
|
505
|
+
return this.downloadProjectMarkdownReport(projectId, 'charter');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
async getProjectBundle(projectId) {
|
|
509
|
+
return this._request(`/api/operator/projects/${projectId}/bundle`);
|
|
510
|
+
}
|
|
511
|
+
|
|
475
512
|
// ─── Roadmaps ──────────────────────────────────────────────────────────────
|
|
476
513
|
|
|
477
514
|
async listProjectRoadmaps({ includeInactive } = {}) {
|
|
@@ -492,6 +529,14 @@ export class AIEngineClient {
|
|
|
492
529
|
return this._request(`/api/operator/projects/${projectId}/implementation-roadmap/active-item`);
|
|
493
530
|
}
|
|
494
531
|
|
|
532
|
+
async getProjectImplementationRoadmapReport(projectId) {
|
|
533
|
+
return this._request(`/api/operator/projects/${projectId}/implementation-roadmap/report`);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
async downloadProjectImplementationRoadmapReportMarkdown(projectId) {
|
|
537
|
+
return this.downloadProjectMarkdownReport(projectId, 'implementation_roadmap');
|
|
538
|
+
}
|
|
539
|
+
|
|
495
540
|
async ensureProjectRoadmapTaskSurface(projectId, {
|
|
496
541
|
requestedBy,
|
|
497
542
|
assignedTo,
|
|
@@ -1092,6 +1137,44 @@ export class AIEngineClient {
|
|
|
1092
1137
|
clearTimeout(timeoutHandle);
|
|
1093
1138
|
}
|
|
1094
1139
|
}
|
|
1140
|
+
|
|
1141
|
+
async _requestText(path, { method = 'GET', query, headers, body } = {}) {
|
|
1142
|
+
const url = appendQuery(`${this.baseUrl}${path}`, query);
|
|
1143
|
+
const controller = new AbortController();
|
|
1144
|
+
const timeoutHandle = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
1145
|
+
try {
|
|
1146
|
+
const response = await this.fetchImpl(url, {
|
|
1147
|
+
method,
|
|
1148
|
+
headers: {
|
|
1149
|
+
accept: 'text/markdown, text/plain;q=0.9, application/json;q=0.8',
|
|
1150
|
+
'content-type': body ? 'application/json' : undefined,
|
|
1151
|
+
'x-actor-id': this.actorId,
|
|
1152
|
+
authorization: this.apiKey ? `Bearer ${this.apiKey}` : undefined,
|
|
1153
|
+
...headers,
|
|
1154
|
+
},
|
|
1155
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
1156
|
+
signal: controller.signal,
|
|
1157
|
+
});
|
|
1158
|
+
const contentType = response.headers.get('content-type') || '';
|
|
1159
|
+
const contentDisposition = response.headers.get('content-disposition') || '';
|
|
1160
|
+
if (!response.ok) {
|
|
1161
|
+
const payload = contentType.includes('application/json')
|
|
1162
|
+
? await response.json()
|
|
1163
|
+
: { message: await response.text() };
|
|
1164
|
+
const error = new Error(payload?.message || payload?.error || `Request failed with status ${response.status}.`);
|
|
1165
|
+
error.status = response.status;
|
|
1166
|
+
error.payload = payload;
|
|
1167
|
+
throw error;
|
|
1168
|
+
}
|
|
1169
|
+
return {
|
|
1170
|
+
text: await response.text(),
|
|
1171
|
+
contentType,
|
|
1172
|
+
fileName: parseContentDispositionFilename(contentDisposition),
|
|
1173
|
+
};
|
|
1174
|
+
} finally {
|
|
1175
|
+
clearTimeout(timeoutHandle);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1095
1178
|
}
|
|
1096
1179
|
|
|
1097
1180
|
export function createAIEngineClient(options) {
|