@bpmsoftwaresolutions/ai-engine-client 0.1.0 → 1.0.0-beta.1

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.
Files changed (3) hide show
  1. package/README.md +342 -69
  2. package/package.json +1 -1
  3. package/src/index.js +1012 -162
package/README.md CHANGED
@@ -1,69 +1,342 @@
1
- # @bpmsoftwaresolutions/ai-engine-client
2
-
3
- Thin npm client for AI Engine's supported operator and retrieval APIs.
4
-
5
- ## Why this package exists
6
-
7
- This package is the no-clone distribution shape for coworkers and other consumers.
8
-
9
- It does not embed the full AI Engine runtime. It talks to a running AI Engine service over its stable HTTP surfaces.
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm install @bpmsoftwaresolutions/ai-engine-client
15
- ```
16
-
17
- ## Usage
18
-
19
- ```js
20
- import { AIEngineClient } from '@bpmsoftwaresolutions/ai-engine-client';
21
-
22
- const client = new AIEngineClient({
23
- baseUrl: 'https://resume-generator-api.politehill-3458aba1.eastus.azurecontainerapps.io'
24
- });
25
-
26
- const health = await client.ping();
27
- const workflowStatus = await client.currentWorkflowStatus();
28
- const procedure = await client.resolveOperatingProcedure({ intentText: 'startup' });
29
- ```
30
-
31
- The Azure-hosted base URL above is the current working no-clone path.
32
-
33
- ## Supported methods
34
-
35
- - `ping()`
36
- - `currentWorkflowStatus()`
37
- - `currentArchitectureIntegrityStatus()`
38
- - `currentSecurityGovernanceStatus()`
39
- - `getCommandCard()`
40
- - `resolveOperatingProcedure()`
41
- - `getSymbolDefinition()`
42
- - `getRelatedCode()`
43
-
44
- ## Runtime contract
45
-
46
- The package expects a running AI Engine web service. The preferred production-style path is the Azure-hosted deployment at:
47
-
48
- ```text
49
- https://resume-generator-api.politehill-3458aba1.eastus.azurecontainerapps.io
50
- ```
51
-
52
- You can also point it at the Flask app from this repo or another deployment exposing the same routes.
53
-
54
- Current required HTTP surfaces:
55
-
56
- - `/healthz`
57
- - `/api/operator/current-workflow-status`
58
- - `/api/operator/current-architecture-integrity-status`
59
- - `/api/operator/current-security-governance-status`
60
- - `/api/operator/retrieval/wrapper/command-card`
61
- - `/api/operator/retrieval/wrapper/operating-procedure`
62
- - `/api/operator/retrieval/wrapper/symbol-definition`
63
- - `/api/operator/retrieval/wrapper/related-code`
64
-
65
- ## Distribution note
66
-
67
- This is the preferred distribution shape when the consumer should not clone the full repo. The full repo is still required only when the consumer is running or developing the backend itself.
68
-
69
- Known limitation: `getRelatedCode()` is available on the hosted surface, but it currently returns `blocked_insufficient_data` until the relationship index is populated.
1
+ # @bpmsoftwaresolutions/ai-engine-client
2
+
3
+ Full-surface npm client for the AI Engine. Covers every operator, workflow, project, retrieval, performance, and governance endpoint exposed by the deployed service.
4
+
5
+ No repo clone required. Install the package, point it at the Azure service, and call any method.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @bpmsoftwaresolutions/ai-engine-client
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```js
16
+ import { AIEngineClient } from '@bpmsoftwaresolutions/ai-engine-client';
17
+
18
+ const client = new AIEngineClient({
19
+ baseUrl: 'https://resume-generator-api.politehill-3458aba1.eastus.azurecontainerapps.io'
20
+ });
21
+
22
+ // Health
23
+ const health = await client.ping();
24
+
25
+ // Load current SQL memory projection (startup hydration)
26
+ const memory = await client.getLatestMemoryProjection();
27
+
28
+ // Create a project charter (writes to durable SQL memory)
29
+ const charter = await client.createProjectCharter({
30
+ projectName: 'Data-Driven UI',
31
+ objective: 'Build a Postgres-backed data-driven UI system with a stable renderer and live operator panel.',
32
+ businessContext: 'Enables live demo edits during sales calls without code deploys.',
33
+ successCriteria: 'Pages, blocks, and tokens are fully CRUD-managed via API. Renderer is frozen.',
34
+ priority: 'high',
35
+ inScope: ['pages', 'blocks', 'style tokens', 'versions', 'operator panel'],
36
+ outOfScope: ['drag-and-drop builder', 'custom animation engine'],
37
+ });
38
+
39
+ // Read the resulting project roadmap
40
+ const roadmap = await client.getProjectRoadmap(charter.project_id);
41
+ ```
42
+
43
+ ### fromEnv
44
+
45
+ ```js
46
+ const client = AIEngineClient.fromEnv();
47
+ // Reads: AI_ENGINE_BASE_URL, AI_ENGINE_API_KEY, AI_ENGINE_ACTOR_ID
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Constructor Options
53
+
54
+ | Option | Type | Description |
55
+ |---|---|---|
56
+ | `baseUrl` | string | **Required.** Base URL of the AI Engine service. |
57
+ | `apiKey` | string | Bearer token sent as `Authorization` header. |
58
+ | `actorId` | string | Sent as `X-Actor-Id` for audit trails. Default: `sdk:npm-ai-engine-client`. |
59
+ | `fetchImpl` | function | Custom fetch (Node 18+ built-in used by default). |
60
+ | `timeoutMs` | number | Per-request timeout in ms. Default: 30000. |
61
+
62
+ ---
63
+
64
+ ## Methods
65
+
66
+ ### Health
67
+ | Method | Description |
68
+ |---|---|
69
+ | `ping()` | Health check + current workflow name/status. |
70
+
71
+ ### Operator Status
72
+ | Method | Description |
73
+ |---|---|
74
+ | `currentWorkflowStatus()` | Current workflow run state. |
75
+ | `currentArchitectureIntegrityStatus()` | Architecture integrity scan results. |
76
+ | `currentSecurityGovernanceStatus({ environment, topN })` | Security governance findings. |
77
+ | `currentCodebaseShapeStatus()` | Codebase shape analysis. |
78
+ | `getLatestMemoryProjection()` | Current SQL memory projection (startup hydration source). |
79
+ | `getDashboard()` | Operator dashboard payload. |
80
+
81
+ ### Retrieval Wrapper
82
+ | Method | Description |
83
+ |---|---|
84
+ | `getCommandCard({ commandKey, alias, intentText, requestedBy })` | Resolve a command card by key, alias, or intent. |
85
+ | `resolveOperatingProcedure({ procedureKey, intentText, requestedBy })` | Resolve an operating procedure. |
86
+ | `getSymbolDefinition({ symbolName, qualifiedName, ... })` | Symbol/code definition lookup. |
87
+ | `getRelatedCode({ symbolKey, qualifiedName, relationshipType, ... })` | Related code lookup. |
88
+
89
+ ### Repo Inventory
90
+ | Method | Description |
91
+ |---|---|
92
+ | `listRepositories({ limit })` | List inventoried repositories. |
93
+ | `getRepository(repositoryId)` | Get repository detail. |
94
+ | `listProjects({ repositoryId, repoKey, limit })` | List inventoried projects. |
95
+ | `getProject(projectId)` | Get project detail. |
96
+ | `listCodeFiles({ repositoryId, projectId, language, pathPrefix, page, pageSize })` | Page through inventoried code files. |
97
+ | `getCodeFile(fileId)` | Get file detail. |
98
+ | `listCodeSymbolsByFile(fileId, { limit })` | List symbols discovered in a file. |
99
+ | `getCodeSymbol(symbolId, { includeCode, maxLines })` | Get symbol detail. |
100
+ | `searchSymbols({ query, projectScope, maxResults })` | Search inventoried symbols. |
101
+ | `getSymbolRelationships(symbolId, { relationshipType, depth })` | Read symbol relationships from the inventory graph. |
102
+
103
+ ### Retrieval Management
104
+ | Method | Description |
105
+ |---|---|
106
+ | `getRetrievalStatus()` | Retrieval status dashboard. |
107
+ | `getRetrievalProfileMetrics()` | Profile-level retrieval metrics. |
108
+ | `getRetrievalFeedbackMetrics()` | Feedback signal metrics. |
109
+ | `getRetrievalQuery(id)` | Get retrieval query detail. |
110
+ | `getRetrievalPacket(id)` | Get retrieval packet detail. |
111
+ | `generateRetrievalCandidates(body)` | Generate candidate packets. |
112
+ | `selectRetrievalPacket(body)` | Select a packet for use. |
113
+ | `recordRetrievalFeedback(body)` | Record feedback on a retrieval result. |
114
+ | `deriveRetrievalOptimizationCandidates(body)` | Derive optimization candidates. |
115
+ | `validatePromptAssembly(body)` | Validate a prompt assembly. |
116
+
117
+ ### Workflows
118
+ | Method | Description |
119
+ |---|---|
120
+ | `listWorkflows({ status, includeSteps })` | List workflows. |
121
+ | `createWorkflow({ name, slug, description, goal, ... })` | Create a workflow draft. |
122
+ | `getWorkflow(workflowId)` | Get workflow detail. |
123
+ | `replaceWorkflowSteps(workflowId, steps)` | Replace workflow steps. |
124
+ | `publishWorkflow(workflowId)` | Publish a workflow. |
125
+ | `cloneWorkflow(workflowId)` | Clone a workflow. |
126
+
127
+ ### Workflow Governance
128
+ | Method | Description |
129
+ |---|---|
130
+ | `evaluateWorkflowGovernance(workflowId)` | Run governance evaluation. |
131
+ | `listWorkflowGovernanceDecisions(workflowId)` | List governance decisions. |
132
+ | `getWorkflowGovernanceSimulation(workflowId)` | Governance simulation packet. |
133
+ | `listWorkflowGovernanceBundles(workflowId)` | Gate bundles. |
134
+ | `listWorkflowGovernanceApprovals(workflowId)` | Gate approvals. |
135
+ | `listWorkflowGovernanceEvents(workflowId)` | Gate events. |
136
+ | `getWorkflowGovernanceReview(workflowId)` | Governance review. |
137
+ | `createWorkflowGovernanceReviewDecision(workflowId, body)` | Record a review decision. |
138
+
139
+ ### Workflow Runs
140
+ | Method | Description |
141
+ |---|---|
142
+ | `createWorkflowRun(body)` | Start a workflow run. |
143
+ | `getWorkflowRun(workflowRunId)` | Get run detail. |
144
+ | `listWorkflowArtifacts(workflowRunId)` | List run artifacts. |
145
+ | `getWorkflowRunSubstrate(workflowRunId)` | Get run substrate (sessions, turns). |
146
+ | `resumeWorkflowRun(workflowRunId, body)` | Resume a paused run. |
147
+ | `listRecentInspectorRuns({ limit })` | List recent runs via inspector. |
148
+ | `inspectWorkflowRun(workflowRunId)` | Full inspector view of a run. |
149
+
150
+ ### Manual & Approval Tasks
151
+ | Method | Description |
152
+ |---|---|
153
+ | `listManualTasks()` | List tasks awaiting manual completion. |
154
+ | `listApprovalTasks()` | List tasks awaiting approval. |
155
+ | `completeManualTask(stepRunId, body)` | Complete a manual step. |
156
+ | `approveTask(stepRunId, body)` | Approve a step. |
157
+
158
+ ### Projects & Chartering
159
+ | Method | Description |
160
+ |---|---|
161
+ | `createProjectCharter({ projectName, objective, businessContext, successCriteria, priority, constraints, inScope, outOfScope, assumptions, linkedWorkflows, testingStrategy, initialContext, requestedBy })` | Charter a project (writes to durable SQL memory). |
162
+ | `listProjects({ limit, includeInactive, processStatus, charterStatus })` | List projects. |
163
+ | `getProject(projectId)` | Get project detail. |
164
+
165
+ ### Roadmaps
166
+ | Method | Description |
167
+ |---|---|
168
+ | `listProjectRoadmaps({ includeInactive })` | List all project roadmaps. |
169
+ | `getProjectRoadmap(projectId)` | Get full roadmap for a project. |
170
+ | `getProjectRoadmapSummary(projectId)` | Roadmap summary. |
171
+ | `getProjectRoadmapActiveItem(projectId)` | Current active roadmap item. |
172
+ | `listProjectOpenTasks(projectId)` | Open tasks for a project. |
173
+ | `getProjectPerformanceMetrics(projectId, { workflowId, workflowRunId, sinceUtc })` | Performance metrics. |
174
+
175
+ ### Implementation Tasks
176
+ | Method | Description |
177
+ |---|---|
178
+ | `createImplementationTask(implementationItemId, { title, implementationPacketId, ... })` | Create a task on a roadmap item. |
179
+ | `listImplementationTasks(implementationItemId)` | List tasks. |
180
+ | `listImplementationSubtasks(taskId)` | List subtasks. |
181
+ | `updateImplementationTask(taskId, updates)` | Update a task. |
182
+ | `assignImplementationTask(taskId, { assignedTo, assignedBy })` | Assign a task. |
183
+ | `completeImplementationTask(taskId, { completedBy })` | Mark complete. |
184
+
185
+ ### Governed Implementation
186
+ | Method | Description |
187
+ |---|---|
188
+ | `importImplementationPacket(body)` | Import an implementation packet. |
189
+ | `listImplementationPackets({ status, packetType })` | List packets. |
190
+ | `getImplementationPacket(packetId)` | Packet detail. |
191
+ | `updateImplementationItemStatus(itemId, body)` | Update item status. |
192
+ | `addImplementationItemEvidence(itemId, body)` | Add evidence link. |
193
+ | `addImplementationItemActivity(itemId, body)` | Add activity entry. |
194
+ | `listImplementationItemActivity(itemId)` | List item activity. |
195
+ | `updateAcceptanceCheckStatus(itemId, checkId, body)` | Update acceptance check. |
196
+ | `createImplementationPacketGateDecision(packetId, body)` | Record gate decision. |
197
+ | `bindImplementationPacketToWorkflow(workflowId, body)` | Bind packet to workflow. |
198
+ | `getWorkflowImplementationRoadmap(workflowId)` | Workflow-linked roadmap. |
199
+ | `getWorkflowResumeContext(workflowId)` | Resume context. |
200
+
201
+ ### Skills
202
+ | Method | Description |
203
+ |---|---|
204
+ | `currentSkillRegistryStatus()` | Current skill registry status. |
205
+ | `getSkillContract({ skillId, skillKey })` | Skill contract. |
206
+ | `getSkillGovernance({ skillId, skillKey, skillVersionId })` | Skill governance posture. |
207
+ | `createSkillContractDraft(body)` | Create a skill contract draft. |
208
+ | `recordSkillPatternReview(skillVersionId, body)` | Record pattern review. |
209
+ | `approveSkillContract(skillVersionId, body)` | Approve skill contract. |
210
+ | `createWorkflowSkillContract(body)` | Create workflow skill contract. |
211
+ | `listWorkflowSkillBindings(workflowId, { workflowStepId })` | List skill bindings. |
212
+ | `seedFrequentOperationSkills({ createdBy })` | Seed frequent operation skills. |
213
+
214
+ ### Skill Governance
215
+ | Method | Description |
216
+ |---|---|
217
+ | `createSkillGovernanceChange(body)` | Create a skill governance change. |
218
+ | `listSkillGovernanceChanges({ limit, processStatus, changeStatus })` | List changes. |
219
+ | `getSkillGovernanceChange(governanceChangeId)` | Change detail. |
220
+
221
+ ### Capabilities
222
+ | Method | Description |
223
+ |---|---|
224
+ | `listCapabilities()` | List capabilities. |
225
+ | `createCapability(body)` | Create a capability. |
226
+ | `testCapability(capabilityId, body)` | Test a capability. |
227
+
228
+ ### Tool Registry
229
+ | Method | Description |
230
+ |---|---|
231
+ | `currentToolRegistryStatus()` | Current tool registry status. |
232
+ | `getWorkflowToolRegistry({ workflowId, workflowSlug })` | Workflow-scoped tool registry. |
233
+ | `currentAssistantToolContext()` | Current assistant tool context. |
234
+ | `getTool(toolKey)` | Tool definition detail. |
235
+ | `getToolHistory(toolKey)` | Tool version history. |
236
+ | `getToolInvocations(toolKey)` | Tool invocation history. |
237
+ | `getToolGovernance(toolKey)` | Tool governance posture. |
238
+ | `getToolEventReplayBundle(toolEventSummaryId)` | Tool execution replay bundle. |
239
+ | `createToolReviewDecision(toolKey, body)` | Create tool review decision. |
240
+ | `createToolGateDecision(toolKey, body)` | Create tool gate decision. |
241
+
242
+ ### Context Assembly
243
+ | Method | Description |
244
+ |---|---|
245
+ | `getContextAssemblyContract(workflowRunId, { stepRunId })` | Context assembly contract. |
246
+ | `getContextAssemblyStatus(workflowRunId, { stepRunId })` | Context assembly status. |
247
+ | `getOperatorContext(workflowRunId, { stepRunId })` | Operator context for a run. |
248
+ | `getContextFragments(workflowRunId, { stepRunId })` | Context fragments. |
249
+ | `getContextReuse(workflowRunId, { stepRunId })` | Context reuse metrics. |
250
+ | `listPromptAssemblies(workflowRunId)` | Prompt assembly history. |
251
+
252
+ ### Performance
253
+ | Method | Description |
254
+ |---|---|
255
+ | `getSessionPerformanceMetrics({ clientType, workflowRunId, sessionId })` | Session metrics. |
256
+ | `captureBenchmarkSnapshot(body)` | Capture benchmark snapshot. |
257
+ | `listBenchmarks({ benchmarkScope })` | List benchmarks. |
258
+ | `getBenchmarkMetrics(benchmarkName)` | Metrics for a benchmark. |
259
+ | `getBenchmarkDelta({ baseline, current })` | Compare two benchmarks. |
260
+ | `getBenchmarkTrend({ metricKey, dimensionValue, limit })` | Metric trend. |
261
+ | `getPerformanceDashboard({ clientType, workflowRunId })` | Performance dashboard. |
262
+
263
+ ### Portfolio
264
+ | Method | Description |
265
+ |---|---|
266
+ | `getPortfolioStatus({ projectId })` | Portfolio status. |
267
+ | `getPortfolioSummary()` | Portfolio summary. |
268
+ | `getPortfolioExceptions()` | Portfolio exceptions. |
269
+ | `getPortfolioProject(projectId)` | Project detail via portfolio. |
270
+ | `getPortfolioReport()` | Full portfolio report. |
271
+ | `getPortfolioBundle()` | Portfolio bundle. |
272
+
273
+ ### Self-Learning
274
+ | Method | Description |
275
+ |---|---|
276
+ | `getSelfLearningPosture({ workflowRunId, limit })` | Self-learning posture. |
277
+ | `listLearningRecords({ workflowRunId, learningCategory, promotionReadiness, limit })` | Learning records. |
278
+ | `getLearningRecord(learningRecordId)` | Learning record detail. |
279
+ | `listPromotionCandidates({ workflowRunId, learningCategory, promotionReadiness, limit })` | Promotion candidates. |
280
+ | `getPromotionCandidate(candidateKey)` | Candidate detail. |
281
+ | `listPromotionFlows({ flowStatus, targetType, candidateKey, limit })` | Promotion flows. |
282
+
283
+ ### Self-Optimization
284
+ | Method | Description |
285
+ |---|---|
286
+ | `getSelfOptimizationDashboard()` | Self-optimization dashboard. |
287
+ | `getSelfOptimizationCandidateQueue({ objectiveCategory, impactPosture, blockedByDefault, limit })` | Candidate queue. |
288
+ | `getSelfOptimizationBacklogPosture({ snapshotKey })` | Backlog posture. |
289
+ | `getSelfOptimizationPendingHandoffs({ downstreamLane })` | Pending handoffs. |
290
+
291
+ ### Design Intelligence
292
+ | Method | Description |
293
+ |---|---|
294
+ | `getDesignIntelligenceDashboard()` | Design intelligence dashboard. |
295
+ | `listDesignDecisions()` | List design decisions. |
296
+ | `getDesignDecision(decisionId)` | Decision detail. |
297
+ | `getDesignDecisionVariants(decisionId)` | Decision variants. |
298
+ | `getDesignDecisionCritique(decisionId)` | Decision critique. |
299
+ | `getDesignDecisionLineage(decisionId)` | Decision lineage. |
300
+ | `listDesignPatterns()` | Design patterns. |
301
+ | `getDecisionLabCanvas()` | Decision lab canvas. |
302
+ | `getDesignRecommendations()` | Design recommendations. |
303
+ | `getDesignPromotions()` | Design promotions. |
304
+ | `previewDesignPromotion(body)` | Preview promotion action. |
305
+ | `getDesignIntelligenceMetrics()` | Design intelligence metrics. |
306
+
307
+ ### Script Discovery
308
+ | Method | Description |
309
+ |---|---|
310
+ | `scanScripts(body)` | Scan for discoverable scripts. |
311
+ | `listDiscoveredScriptAssets({ limit })` | Discovered script assets. |
312
+ | `listDiscoveredCapabilities({ limit })` | Discovered capabilities. |
313
+ | `listWorkflowCandidates({ limit })` | Workflow candidates. |
314
+ | `promoteWorkflowCandidate(workflowCandidateId, body)` | Promote a workflow candidate. |
315
+
316
+ ### Notes Lab
317
+ | Method | Description |
318
+ |---|---|
319
+ | `getNotesLabConfig()` | Notes lab configuration. |
320
+ | `submitNote(body)` | Submit a note for review. |
321
+ | `approveNoteReview(body)` | Approve and apply a note review. |
322
+
323
+ ### Search & Contacts
324
+ | Method | Description |
325
+ |---|---|
326
+ | `search(query)` | Search organizations and contacts. |
327
+ | `getOrganization(entityId)` | Organization detail. |
328
+ | `getContact(contactId)` | Contact detail. |
329
+
330
+ ### Benchmarks
331
+ | Method | Description |
332
+ |---|---|
333
+ | `listRecentBenchmarkRuns({ limit })` | List recent benchmark runs. |
334
+ | `getBenchmarkRun(benchmarkRunId)` | Benchmark run detail. |
335
+
336
+ ---
337
+
338
+ ## Runtime Contract
339
+
340
+ 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.
341
+
342
+ Operator routes (`/api/operator/*`) use network-trust protection. The external v1 API (`/api/v1/*`) requires `X-Client-Id` and `X-API-Key` headers and is intentionally not wrapped by this client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmsoftwaresolutions/ai-engine-client",
3
- "version": "0.1.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "Thin npm client for the AI Engine operator and retrieval APIs",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",