@bpmsoftwaresolutions/ai-engine-client 1.1.21 → 1.1.23
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 +33 -0
- package/package.json +1 -1
- package/src/index.js +210 -1
package/README.md
CHANGED
|
@@ -56,6 +56,15 @@ const startup = await client.startSessionGovernance({
|
|
|
56
56
|
allowed_mutation_surfaces: ['src/', 'scripts/'],
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
const claimed = await client.startClaimedWork({
|
|
60
|
+
claimName: 'spring-boot-gateway-charter-commit',
|
|
61
|
+
actorId: 'operator:sid',
|
|
62
|
+
intentId: 'code_mutation',
|
|
63
|
+
declaredScopeFiles: ['scripts/run_charter.py'],
|
|
64
|
+
allowedMutationSurfaces: ['project_roadmap_task'],
|
|
65
|
+
executionPurpose: 'Commit the Spring Boot charter work through a governed claim.',
|
|
66
|
+
});
|
|
67
|
+
|
|
59
68
|
const persistedTurn = await client.persistAssistantTurn({
|
|
60
69
|
project_id: charter.project_id,
|
|
61
70
|
session_key: startup.session_key,
|
|
@@ -90,6 +99,30 @@ That means this package wraps both operator/governed routes and selected externa
|
|
|
90
99
|
|
|
91
100
|
If your deployment enforces bearer auth on operator routes, API-key-only construction will not work for those methods.
|
|
92
101
|
|
|
102
|
+
### Governed Claim Startup
|
|
103
|
+
|
|
104
|
+
Use `startClaimedWork()` when you want the engine to open the oriented context session, create the session-governance state, declare scope, and return the active claim envelope through one promoted surface.
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const claimed = await client.startClaimedWork({
|
|
108
|
+
claimName: 'spring-boot-gateway-charter-commit',
|
|
109
|
+
actorId: 'operator:sid',
|
|
110
|
+
intentId: 'code_mutation',
|
|
111
|
+
declaredScopeFiles: [
|
|
112
|
+
'scripts/run_charter.py',
|
|
113
|
+
'src/contracts/charters/spring-boot-governed-execution-gateway.charter.json',
|
|
114
|
+
],
|
|
115
|
+
allowedMutationSurfaces: ['project_roadmap_task'],
|
|
116
|
+
runtimeSessionId: 'codex:main:charter-work',
|
|
117
|
+
executionPurpose: 'Persist the charter-runner fix and Spring Boot charter packet.',
|
|
118
|
+
successCriteria: 'Claim is active and scoped to the intended mutation surface.',
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
console.log(claimed.claim_id, claimed.context_session_id);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This complements the lower-level flow exposed by `openContextSession()`, `acknowledgeReminder()`, `completeOrientation()`, `lockContextSessionClaim()`, `claimWorkItem()`, and `signoffClaim()`.
|
|
125
|
+
|
|
93
126
|
### Text and Binary Downloads
|
|
94
127
|
|
|
95
128
|
Some methods do not return plain JSON:
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const DEFAULT_TIMEOUT_MS = 30000;
|
|
2
|
-
export const AI_ENGINE_CLIENT_VERSION = '1.1.
|
|
2
|
+
export const AI_ENGINE_CLIENT_VERSION = '1.1.20';
|
|
3
3
|
export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
|
|
4
4
|
'executeVerifiedMutation',
|
|
5
5
|
'post_mutation_verification',
|
|
@@ -420,6 +420,37 @@ export class AIEngineClient {
|
|
|
420
420
|
return this._request('/api/work/start', { method: 'POST', body });
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
+
async startClaimedWork({
|
|
424
|
+
claimName,
|
|
425
|
+
actorId,
|
|
426
|
+
intentId,
|
|
427
|
+
declaredScopeFiles,
|
|
428
|
+
allowedMutationSurfaces,
|
|
429
|
+
runtimeSessionId,
|
|
430
|
+
executionPurpose,
|
|
431
|
+
successCriteria,
|
|
432
|
+
mutationAllowed,
|
|
433
|
+
metadata,
|
|
434
|
+
...rest
|
|
435
|
+
} = {}) {
|
|
436
|
+
return this._request('/api/governance/claims/start-claimed-work', {
|
|
437
|
+
method: 'POST',
|
|
438
|
+
body: {
|
|
439
|
+
...rest,
|
|
440
|
+
claim_name: claimName,
|
|
441
|
+
actor_id: actorId,
|
|
442
|
+
intent_id: intentId,
|
|
443
|
+
declared_scope_files: declaredScopeFiles,
|
|
444
|
+
allowed_mutation_surfaces: allowedMutationSurfaces,
|
|
445
|
+
runtime_session_id: runtimeSessionId,
|
|
446
|
+
execution_purpose: executionPurpose,
|
|
447
|
+
success_criteria: successCriteria,
|
|
448
|
+
mutation_allowed: mutationAllowed,
|
|
449
|
+
metadata,
|
|
450
|
+
},
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
|
|
423
454
|
async claimWorkItem(body = {}) {
|
|
424
455
|
return this._request('/api/governance/claims/claim-work-item', { method: 'POST', body });
|
|
425
456
|
}
|
|
@@ -443,6 +474,184 @@ export class AIEngineClient {
|
|
|
443
474
|
});
|
|
444
475
|
}
|
|
445
476
|
|
|
477
|
+
/**
|
|
478
|
+
* Promote a governance claim from `missing_promoted_surface` to
|
|
479
|
+
* `promoted_surface_bound` by binding required tool definitions to the
|
|
480
|
+
* workflow and recording a completed claim signoff.
|
|
481
|
+
*
|
|
482
|
+
* @param {object} params
|
|
483
|
+
* @param {string} params.claimId - UUID of the claim to unblock.
|
|
484
|
+
* @param {string} params.workflowId - UUID of the target workflow.
|
|
485
|
+
* @param {string} params.contextSessionId - Oriented context session UUID.
|
|
486
|
+
* @param {string} params.actorId - Caller identity for audit trail.
|
|
487
|
+
* @param {string[]} params.requiredToolKeys - Tool keys to bind.
|
|
488
|
+
* @param {string} [params.intentId] - Default: 'code_mutation'.
|
|
489
|
+
* @param {string} [params.bindingScope] - Default: 'required'.
|
|
490
|
+
* @param {string} [params.usageMode] - Default: 'manual'.
|
|
491
|
+
* @param {string} [params.operatorScope]
|
|
492
|
+
* @param {object} [params.allowedArgumentPolicy]
|
|
493
|
+
* @returns {Promise<object>} Promotion result envelope.
|
|
494
|
+
*/
|
|
495
|
+
async promoteClaimSurface({
|
|
496
|
+
claimId,
|
|
497
|
+
workflowId,
|
|
498
|
+
contextSessionId,
|
|
499
|
+
actorId,
|
|
500
|
+
requiredToolKeys,
|
|
501
|
+
intentId,
|
|
502
|
+
bindingScope,
|
|
503
|
+
usageMode,
|
|
504
|
+
operatorScope,
|
|
505
|
+
allowedArgumentPolicy,
|
|
506
|
+
...rest
|
|
507
|
+
} = {}) {
|
|
508
|
+
if (!claimId) throw new Error('claimId is required.');
|
|
509
|
+
if (!workflowId) throw new Error('workflowId is required.');
|
|
510
|
+
if (!contextSessionId) throw new Error('contextSessionId is required.');
|
|
511
|
+
if (!actorId) throw new Error('actorId is required.');
|
|
512
|
+
if (!Array.isArray(requiredToolKeys) || requiredToolKeys.length === 0) {
|
|
513
|
+
throw new Error('requiredToolKeys must be a non-empty array.');
|
|
514
|
+
}
|
|
515
|
+
return this._request('/api/governance/claims/promote-surface', {
|
|
516
|
+
method: 'POST',
|
|
517
|
+
body: {
|
|
518
|
+
...rest,
|
|
519
|
+
claim_id: claimId,
|
|
520
|
+
workflow_id: workflowId,
|
|
521
|
+
context_session_id: contextSessionId,
|
|
522
|
+
actor_id: actorId,
|
|
523
|
+
required_tool_keys: requiredToolKeys,
|
|
524
|
+
intent_id: intentId,
|
|
525
|
+
binding_scope: bindingScope,
|
|
526
|
+
usage_mode: usageMode,
|
|
527
|
+
operator_scope: operatorScope,
|
|
528
|
+
allowed_argument_policy: allowedArgumentPolicy,
|
|
529
|
+
},
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Bootstrap/admin surface for creating a governed workflow-tool-binding
|
|
535
|
+
* approval lane request. This call cannot approve or execute bindings.
|
|
536
|
+
*
|
|
537
|
+
* @param {object} params
|
|
538
|
+
* @param {string} params.operatorActorType
|
|
539
|
+
* @param {string} params.requesterActor
|
|
540
|
+
* @param {string[]} params.requestedToolKeys
|
|
541
|
+
* @param {string} params.blockedReason
|
|
542
|
+
* @param {string} params.rollbackPlan
|
|
543
|
+
* @param {string} [params.requesterActorType]
|
|
544
|
+
* @param {string} [params.operatorActorId]
|
|
545
|
+
* @param {string} [params.targetWorkflowId]
|
|
546
|
+
* @param {string} [params.targetWorkflowRunId]
|
|
547
|
+
* @param {string[]} [params.relatedGapRecordIds]
|
|
548
|
+
* @param {string} [params.requestedBindingScope]
|
|
549
|
+
* @param {string} [params.riskClassification]
|
|
550
|
+
* @param {object} [params.metadata]
|
|
551
|
+
* @returns {Promise<object>}
|
|
552
|
+
*/
|
|
553
|
+
async createWorkflowToolBindingApprovalLane({
|
|
554
|
+
operatorActorType,
|
|
555
|
+
requesterActor,
|
|
556
|
+
requestedToolKeys,
|
|
557
|
+
blockedReason,
|
|
558
|
+
rollbackPlan,
|
|
559
|
+
requesterActorType,
|
|
560
|
+
operatorActorId,
|
|
561
|
+
targetWorkflowId,
|
|
562
|
+
targetWorkflowRunId,
|
|
563
|
+
relatedGapRecordIds,
|
|
564
|
+
requestedBindingScope,
|
|
565
|
+
riskClassification,
|
|
566
|
+
metadata,
|
|
567
|
+
...rest
|
|
568
|
+
} = {}) {
|
|
569
|
+
if (!operatorActorType) throw new Error('operatorActorType is required.');
|
|
570
|
+
if (!requesterActor) throw new Error('requesterActor is required.');
|
|
571
|
+
if (!Array.isArray(requestedToolKeys) || requestedToolKeys.length === 0) {
|
|
572
|
+
throw new Error('requestedToolKeys must be a non-empty array.');
|
|
573
|
+
}
|
|
574
|
+
if (!blockedReason) throw new Error('blockedReason is required.');
|
|
575
|
+
if (!rollbackPlan) throw new Error('rollbackPlan is required.');
|
|
576
|
+
return this._request('/api/governance/bootstrap/workflow-tool-binding-approval/create', {
|
|
577
|
+
method: 'POST',
|
|
578
|
+
body: {
|
|
579
|
+
...rest,
|
|
580
|
+
operator_actor_type: operatorActorType,
|
|
581
|
+
requester_actor: requesterActor,
|
|
582
|
+
requested_tool_keys: requestedToolKeys,
|
|
583
|
+
blocked_reason: blockedReason,
|
|
584
|
+
rollback_plan: rollbackPlan,
|
|
585
|
+
requester_actor_type: requesterActorType,
|
|
586
|
+
operator_actor_id: operatorActorId,
|
|
587
|
+
target_workflow_id: targetWorkflowId,
|
|
588
|
+
target_workflow_run_id: targetWorkflowRunId,
|
|
589
|
+
related_gap_record_ids: relatedGapRecordIds,
|
|
590
|
+
requested_binding_scope: requestedBindingScope,
|
|
591
|
+
risk_classification: riskClassification,
|
|
592
|
+
metadata,
|
|
593
|
+
},
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
async recordWorkflowToolBindingApprovalDecision(approvalRequestId, {
|
|
598
|
+
operatorActorType,
|
|
599
|
+
decision,
|
|
600
|
+
operatorActorId,
|
|
601
|
+
decisionNotes,
|
|
602
|
+
decisionConditions,
|
|
603
|
+
...rest
|
|
604
|
+
} = {}) {
|
|
605
|
+
if (!approvalRequestId) throw new Error('approvalRequestId is required.');
|
|
606
|
+
if (!operatorActorType) throw new Error('operatorActorType is required.');
|
|
607
|
+
if (!decision) throw new Error('decision is required.');
|
|
608
|
+
return this._request(`/api/governance/bootstrap/workflow-tool-binding-approval/${encodeURIComponent(approvalRequestId)}/approval-decision`, {
|
|
609
|
+
method: 'POST',
|
|
610
|
+
body: {
|
|
611
|
+
...rest,
|
|
612
|
+
operator_actor_type: operatorActorType,
|
|
613
|
+
operator_actor_id: operatorActorId,
|
|
614
|
+
decision,
|
|
615
|
+
decision_notes: decisionNotes,
|
|
616
|
+
decision_conditions: decisionConditions,
|
|
617
|
+
},
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
async executeWorkflowToolBindingApprovalBinding(approvalRequestId, {
|
|
622
|
+
operatorActorType,
|
|
623
|
+
operatorActorId,
|
|
624
|
+
...rest
|
|
625
|
+
} = {}) {
|
|
626
|
+
if (!approvalRequestId) throw new Error('approvalRequestId is required.');
|
|
627
|
+
if (!operatorActorType) throw new Error('operatorActorType is required.');
|
|
628
|
+
return this._request(`/api/governance/bootstrap/workflow-tool-binding-approval/${encodeURIComponent(approvalRequestId)}/binding-execution`, {
|
|
629
|
+
method: 'POST',
|
|
630
|
+
body: {
|
|
631
|
+
...rest,
|
|
632
|
+
operator_actor_type: operatorActorType,
|
|
633
|
+
operator_actor_id: operatorActorId,
|
|
634
|
+
},
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
async revalidateWorkflowToolBindingStartup(approvalRequestId, {
|
|
639
|
+
operatorActorType,
|
|
640
|
+
operatorActorId,
|
|
641
|
+
...rest
|
|
642
|
+
} = {}) {
|
|
643
|
+
if (!approvalRequestId) throw new Error('approvalRequestId is required.');
|
|
644
|
+
if (!operatorActorType) throw new Error('operatorActorType is required.');
|
|
645
|
+
return this._request(`/api/governance/bootstrap/workflow-tool-binding-approval/${encodeURIComponent(approvalRequestId)}/startup-revalidation`, {
|
|
646
|
+
method: 'POST',
|
|
647
|
+
body: {
|
|
648
|
+
...rest,
|
|
649
|
+
operator_actor_type: operatorActorType,
|
|
650
|
+
operator_actor_id: operatorActorId,
|
|
651
|
+
},
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
|
|
446
655
|
async completeTurn(body = {}) {
|
|
447
656
|
return this._request('/api/turns/complete', { method: 'POST', body });
|
|
448
657
|
}
|