@bpmsoftwaresolutions/ai-engine-client 1.1.22 → 1.1.24

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 +33 -0
  2. package/package.json +1 -1
  3. package/src/index.js +123 -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmsoftwaresolutions/ai-engine-client",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "description": "Thin npm client for the AI Engine operator and retrieval APIs",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
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.20';
2
+ export const AI_ENGINE_CLIENT_VERSION = '1.1.24';
3
3
  export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
4
4
  'executeVerifiedMutation',
5
5
  'post_mutation_verification',
@@ -530,6 +530,128 @@ export class AIEngineClient {
530
530
  });
531
531
  }
532
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
+
533
655
  async completeTurn(body = {}) {
534
656
  return this._request('/api/turns/complete', { method: 'POST', body });
535
657
  }