@bpmsoftwaresolutions/ai-engine-client 1.0.0-beta.10 → 1.0.0-beta.11
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
CHANGED
|
@@ -10,6 +10,17 @@ No repo clone required. Install the package, point it at the Azure service, and
|
|
|
10
10
|
npm install @bpmsoftwaresolutions/ai-engine-client
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Publishing
|
|
14
|
+
|
|
15
|
+
This package is published automatically from GitHub Actions by `.github/workflows/publish-ai-engine-client.yml`.
|
|
16
|
+
|
|
17
|
+
The workflow runs on pushes to `main` when files under `packages/ai-engine-client/**` change, and it can also be started manually with `workflow_dispatch`.
|
|
18
|
+
|
|
19
|
+
Authentication supports either:
|
|
20
|
+
|
|
21
|
+
- npm trusted publishing
|
|
22
|
+
- a repository secret named `NPM_TOKEN`, `NPM_PUBLISH_TOKEN`, or `NODE_AUTH_TOKEN`
|
|
23
|
+
|
|
13
24
|
## Quick Start
|
|
14
25
|
|
|
15
26
|
```js
|
|
@@ -54,6 +65,51 @@ const persistedTurn = await client.persistAssistantTurn({
|
|
|
54
65
|
});
|
|
55
66
|
```
|
|
56
67
|
|
|
68
|
+
## Integration Notes
|
|
69
|
+
|
|
70
|
+
### Auth Modes
|
|
71
|
+
|
|
72
|
+
The package supports two authentication patterns:
|
|
73
|
+
|
|
74
|
+
1. Bearer-token auth for operator and governed routes.
|
|
75
|
+
2. Compatibility API-key auth for migration-oriented external routes and deployments that still allow shared-key access.
|
|
76
|
+
|
|
77
|
+
Header behavior is:
|
|
78
|
+
|
|
79
|
+
- If `accessToken` or `tokenProvider` is configured, the client sends `Authorization: Bearer <token>`.
|
|
80
|
+
- If bearer auth is not configured, the client sends `X-API-Key` when `apiKey` is provided.
|
|
81
|
+
- If bearer auth is not configured and `clientId` is provided, the client also sends `X-Client-Id`.
|
|
82
|
+
- The client always sends `X-Actor-Id` for audit trails unless overridden.
|
|
83
|
+
|
|
84
|
+
That means this package wraps both operator/governed routes and selected external `/api/v1/*` routes. Pick the auth mode that matches the route family exposed by your deployment.
|
|
85
|
+
|
|
86
|
+
### Route Families
|
|
87
|
+
|
|
88
|
+
- Operator and governed routes are methods such as `createProjectCharter`, `getProjectBundle`, `importImplementationPacket`, and the workflow/portfolio/governance APIs.
|
|
89
|
+
- External routes are the methods prefixed with `getExternal*`, `listExternal*`, `downloadExternal*`, plus `startSessionGovernance`, `persistAssistantTurn`, `createExternalAudioRender`, and `getLatestMemoryProjection`.
|
|
90
|
+
|
|
91
|
+
If your deployment enforces bearer auth on operator routes, API-key-only construction will not work for those methods.
|
|
92
|
+
|
|
93
|
+
### Text and Binary Downloads
|
|
94
|
+
|
|
95
|
+
Some methods do not return plain JSON:
|
|
96
|
+
|
|
97
|
+
- Markdown download helpers return `{ text, contentType, fileName }`.
|
|
98
|
+
- Binary download helpers return `{ arrayBuffer, contentType, fileName }`.
|
|
99
|
+
|
|
100
|
+
Examples:
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
import fs from 'node:fs';
|
|
104
|
+
|
|
105
|
+
const markdown = await client.downloadProjectCharterReportMarkdown(projectId);
|
|
106
|
+
console.log(markdown.fileName, markdown.contentType);
|
|
107
|
+
console.log(markdown.text);
|
|
108
|
+
|
|
109
|
+
const audio = await client.downloadExternalAudioRender(audioRenderRunId);
|
|
110
|
+
await fs.promises.writeFile('render.mp3', Buffer.from(audio.arrayBuffer));
|
|
111
|
+
```
|
|
112
|
+
|
|
57
113
|
### fromEnv
|
|
58
114
|
|
|
59
115
|
```js
|
|
@@ -101,6 +157,105 @@ const client = new AIEngineClient({
|
|
|
101
157
|
|
|
102
158
|
When `accessToken` or `tokenProvider` is present, the client prefers bearer auth. API key headers are only sent when bearer auth is not configured.
|
|
103
159
|
|
|
160
|
+
Some deployments accept a shared `X-API-Key` without `X-Client-Id`, while others require both `X-Client-Id` and `X-API-Key` for API-key auth. If your environment uses client-scoped API keys, provide both values.
|
|
161
|
+
|
|
162
|
+
### Project Chartering Contract
|
|
163
|
+
|
|
164
|
+
`createProjectCharter()` sends snake_case fields to `POST /api/projects/charter`. The method accepts:
|
|
165
|
+
|
|
166
|
+
- `projectName`, `objective`
|
|
167
|
+
- `businessContext`, `successCriteria`, `priority`
|
|
168
|
+
- `constraints`, `inScope`, `outOfScope`, `assumptions`
|
|
169
|
+
- `linkedWorkflows`, `linkedWorkflowSlug`
|
|
170
|
+
- `testingStrategy`, `initialContext`
|
|
171
|
+
- `requestedBy`
|
|
172
|
+
- `ensureTaskSurface`, `assignedTo`, `createAcceptanceSubtasks`
|
|
173
|
+
|
|
174
|
+
The response always includes the charter identifiers:
|
|
175
|
+
|
|
176
|
+
- `project_id`
|
|
177
|
+
- `workflow_id`
|
|
178
|
+
- `workflow_run_id`
|
|
179
|
+
- `implementation_packet_id`
|
|
180
|
+
- `implementation_packet_key`
|
|
181
|
+
- `status`
|
|
182
|
+
|
|
183
|
+
If `ensureTaskSurface` is left as `true`, the server also attempts to attach `task_surface` for the active roadmap item. That field is only available when the server can resolve an active implementation item from the project roadmap. If roadmap state is incomplete in the deployment, charter creation can still succeed while `task_surface` is unavailable.
|
|
184
|
+
|
|
185
|
+
Example:
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
const charter = await client.createProjectCharter({
|
|
189
|
+
projectName: 'Loga Cognitive Interface Cockpit Delivery',
|
|
190
|
+
objective: 'Deliver the operator cockpit and playback experience.',
|
|
191
|
+
businessContext: 'Ground the first playback surface in convert-document-to-audio.',
|
|
192
|
+
linkedWorkflowSlug: 'convert-document-to-audio',
|
|
193
|
+
ensureTaskSurface: true,
|
|
194
|
+
createAcceptanceSubtasks: true,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
console.log(charter.project_id);
|
|
198
|
+
console.log(charter.implementation_packet_key);
|
|
199
|
+
console.log(charter.task_surface?.active_item?.implementation_item_id ?? null);
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Implementation Packet Import Contract
|
|
203
|
+
|
|
204
|
+
`importImplementationPacket(body)` expects the engine's `implementation_plan_packet` schema, not an arbitrary roadmap-shaped JSON document.
|
|
205
|
+
|
|
206
|
+
Minimum required top-level fields:
|
|
207
|
+
|
|
208
|
+
- `packetType`
|
|
209
|
+
- `packetVersion`
|
|
210
|
+
- `packetId`
|
|
211
|
+
- `title`
|
|
212
|
+
- `phases`
|
|
213
|
+
- `governance.requiredGates`
|
|
214
|
+
|
|
215
|
+
Minimum required fields for each item:
|
|
216
|
+
|
|
217
|
+
- `itemKey`
|
|
218
|
+
- `type`
|
|
219
|
+
- `description`
|
|
220
|
+
- `acceptanceChecks`
|
|
221
|
+
|
|
222
|
+
Allowed packet statuses include `draft`, `approved`, `blocked`, `completed`, and other governed packet lifecycle states. Custom statuses such as `draft-local-artifact` are not valid for import.
|
|
223
|
+
|
|
224
|
+
Minimal example:
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
await client.importImplementationPacket({
|
|
228
|
+
packetType: 'implementation_plan_packet',
|
|
229
|
+
packetVersion: '1.0',
|
|
230
|
+
packetId: 'impl-loga-cockpit-v1',
|
|
231
|
+
title: 'Loga Cognitive Interface Cockpit Delivery',
|
|
232
|
+
status: 'draft',
|
|
233
|
+
governance: {
|
|
234
|
+
requiredGates: ['intent', 'structure', 'promotion'],
|
|
235
|
+
},
|
|
236
|
+
phases: [
|
|
237
|
+
{
|
|
238
|
+
phaseKey: 'phase_1_foundation',
|
|
239
|
+
title: 'Foundation',
|
|
240
|
+
items: [
|
|
241
|
+
{
|
|
242
|
+
itemKey: 'define-cockpit-surface',
|
|
243
|
+
type: 'ui_slice',
|
|
244
|
+
description: 'Define the first cockpit delivery slice.',
|
|
245
|
+
acceptanceChecks: [
|
|
246
|
+
{ text: 'The initial slice is explicitly bounded.' },
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
});
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The package does not auto-convert nested human planning structures like `tasks` and `subtasks` into durable implementation-item tasks. To create persisted task records after import, use `ensureProjectRoadmapTaskSurface()` or `createImplementationTask()`.
|
|
256
|
+
|
|
257
|
+
A copyable example payload is packaged at `examples/implementation-plan-packet.minimal.json`.
|
|
258
|
+
|
|
104
259
|
### External Audio Render Example
|
|
105
260
|
|
|
106
261
|
```js
|
|
@@ -449,4 +604,4 @@ Low-level compatibility methods:
|
|
|
449
604
|
|
|
450
605
|
The package talks to the AI Engine web service. All routes listed above are registered unconditionally in the Flask app and served by the deployed Azure Container App.
|
|
451
606
|
|
|
452
|
-
Operator and governed routes expect bearer-token authorization. The
|
|
607
|
+
Operator and governed routes generally expect bearer-token authorization. The package also wraps selected external `/api/v1/*` routes that support migration-oriented auth modes such as bearer or API-key compatibility, depending on deployment configuration.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packetType": "implementation_plan_packet",
|
|
3
|
+
"packetVersion": "1.0",
|
|
4
|
+
"packetId": "impl-example-governed-slice-v1",
|
|
5
|
+
"title": "Example Governed Slice Implementation Packet",
|
|
6
|
+
"status": "draft",
|
|
7
|
+
"createdBy": {
|
|
8
|
+
"kind": "operator",
|
|
9
|
+
"name": "sdk-example"
|
|
10
|
+
},
|
|
11
|
+
"sourceModel": {
|
|
12
|
+
"producer": "ai-engine-client-readme",
|
|
13
|
+
"purpose": "minimal_import_example"
|
|
14
|
+
},
|
|
15
|
+
"system": {
|
|
16
|
+
"slug": "example-governed-slice",
|
|
17
|
+
"domain": "project-chartering"
|
|
18
|
+
},
|
|
19
|
+
"scope": {
|
|
20
|
+
"productArea": "example-governed-slice",
|
|
21
|
+
"workflowIntent": "Demonstrate the minimum durable implementation packet contract.",
|
|
22
|
+
"targetSurface": "governed-project-execution",
|
|
23
|
+
"inScope": [
|
|
24
|
+
"first delivery slice"
|
|
25
|
+
],
|
|
26
|
+
"outOfScope": [
|
|
27
|
+
"full product rollout"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"northStar": {
|
|
31
|
+
"summary": "Define a small but valid governed implementation packet."
|
|
32
|
+
},
|
|
33
|
+
"governance": {
|
|
34
|
+
"requiredGates": [
|
|
35
|
+
"intent",
|
|
36
|
+
"structure",
|
|
37
|
+
"promotion"
|
|
38
|
+
],
|
|
39
|
+
"reviewRequired": true,
|
|
40
|
+
"evidenceRequiredForCompletion": true
|
|
41
|
+
},
|
|
42
|
+
"completionPolicy": {
|
|
43
|
+
"requiresEvidence": true,
|
|
44
|
+
"requiresReview": true
|
|
45
|
+
},
|
|
46
|
+
"phases": [
|
|
47
|
+
{
|
|
48
|
+
"phaseKey": "phase_1_foundation",
|
|
49
|
+
"title": "Foundation",
|
|
50
|
+
"items": [
|
|
51
|
+
{
|
|
52
|
+
"itemKey": "define-first-slice",
|
|
53
|
+
"type": "delivery_slice",
|
|
54
|
+
"priority": "high",
|
|
55
|
+
"title": "Define first governed slice",
|
|
56
|
+
"description": "Define the first durable delivery slice and bind its acceptance criteria.",
|
|
57
|
+
"status": "not_started",
|
|
58
|
+
"dependsOn": [],
|
|
59
|
+
"artifactsExpected": [
|
|
60
|
+
"delivery-slice-definition.md"
|
|
61
|
+
],
|
|
62
|
+
"acceptanceChecks": [
|
|
63
|
+
{
|
|
64
|
+
"text": "The slice is explicitly bounded.",
|
|
65
|
+
"status": "not_run"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"text": "The slice can be attached to durable task surfaces.",
|
|
69
|
+
"status": "not_run"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmsoftwaresolutions/ai-engine-client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"description": "Thin npm client for the AI Engine operator and retrieval APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"src",
|
|
15
|
-
"README.md"
|
|
15
|
+
"README.md",
|
|
16
|
+
"examples"
|
|
16
17
|
],
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=18"
|