@dougbots/avenor-core 0.11.0 → 0.12.0

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/dist/index.d.ts CHANGED
@@ -140,6 +140,10 @@ interface WorkflowHeartbeatParams {
140
140
  lease_id: string;
141
141
  owner_token: string;
142
142
  }
143
+ interface WorkflowControllerCreateParams {
144
+ controller_id: string;
145
+ max_inflight: number;
146
+ }
143
147
  declare class Client {
144
148
  private socket;
145
149
  private rl;
@@ -183,6 +187,12 @@ declare class Client {
183
187
  workflowComplete(params: WorkflowCompleteParams): Promise<Record<string, unknown>>;
184
188
  workflowGate(params: WorkflowGateParams): Promise<Record<string, unknown>>;
185
189
  workflowHeartbeat(params: WorkflowHeartbeatParams): Promise<Record<string, unknown>>;
190
+ workflowControllerStatus(controllerId: string): Promise<Record<string, unknown>>;
191
+ workflowReady(controllerId: string, limit?: number): Promise<Record<string, unknown>>;
192
+ workflowControllerList(): Promise<Record<string, unknown>>;
193
+ workflowControllerCreate(params: WorkflowControllerCreateParams): Promise<Record<string, unknown>>;
194
+ workflowControllerEnable(controllerId: string): Promise<Record<string, unknown>>;
195
+ workflowControllerDisable(controllerId: string, reason: string): Promise<Record<string, unknown>>;
186
196
  brokerSend(fromRunId: string, toRunId: string, message: string, role?: string): Promise<void>;
187
197
  brokerAsk(toRunId: string, message: string, role?: string): Promise<Record<string, unknown>>;
188
198
  brokerPeers(): Promise<Array<Record<string, unknown>>>;
@@ -742,4 +752,23 @@ type WorkflowGateResult = Record<string, unknown>;
742
752
  declare function createWorkflowGateTool(getSupervisorClient: GetSupervisorClient): (args: WorkflowGateToolArgs) => Promise<WorkflowGateResult>;
743
753
  declare const workflowGateTool: (args: WorkflowGateToolArgs) => Promise<WorkflowGateResult>;
744
754
  //#endregion
745
- export { type AskResult, type AskToolArgs, type BrokerReceiveArgs, type BrokerReceiveResult, type BrokerReplyArgs, type BrokerReplyResult, type CancelResult, type CancelToolArgs, type Client, DEFAULT_RUN_REDUCER_LIMITS, type Event, type ExecutionIdentity, type FollowUpToolArgs, type FollowUpToolResult, type HistoryOptions, type HistoryResult, type InboundAsk, type InspectResult, type NormalizedRunEvent, type ObserveRunOptions, type PeerEntry, type PeersResult, type ResultResult, type ResultToolArgs, type RunChunkRole, type RunIdentity, type RunInfo, type RunObserver, type RunObserverClient, type RunPermissionOption, type RunPermissionSummary, RunReducer, type RunReducerLimits, type RunSnapshot, type RunSnapshotSeed, type RunToolState, type RunToolSummary, type RunTranscriptEntry, type SpawnMetadata, type SpawnParams, type SpawnResult, type SpawnSelectionInput, type SpawnToolArgs, type SpawnToolResult, type StatusResult, type StatusToolArgs, type StatusView, type SubscribeOptions, Supervisor, type SupervisorOptions, THINKING_LEVELS, type ThinkingLevel, type ThinkingOutcome, type WorkflowCompleteParams, type WorkflowCompleteResult, type WorkflowCompleteToolArgs, type WorkflowEventsResult, type WorkflowEventsToolArgs, type WorkflowGateOperation, type WorkflowGateParams, type WorkflowGateResult, type WorkflowGateToolArgs, type WorkflowHeartbeatParams, type WorkflowInspectResult, type WorkflowInspectToolArgs, type WorkflowStatusResult, type WorkflowStatusToolArgs, type WorkflowWaitResult, type WorkflowWaitToolArgs, answerPermissionTool, askTool, brokerReceiveTool, brokerReplyTool, cancelTool, createRunSnapshot, createWorkflowCompleteTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, extractEventText, findAvenorBinary, followUpTool, getInstallDir, getVersion, inspectTool, installerBinaryPath, isThinkingLevel, normalizeRunEvent, observeRun, peersTool, reduceRunSnapshot, resultTool, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCompleteTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowStatusTool, workflowWaitTool };
755
+ //#region src/tools/workflow-controller-status.d.ts
756
+ interface WorkflowControllerStatusToolArgs {
757
+ controllerId?: string;
758
+ supervisorId?: string;
759
+ }
760
+ type WorkflowControllerStatusResult = Record<string, unknown>;
761
+ declare function createWorkflowControllerStatusTool(getSupervisorClient: GetSupervisorClient): (args: WorkflowControllerStatusToolArgs) => Promise<WorkflowControllerStatusResult>;
762
+ declare const workflowControllerStatusTool: (args: WorkflowControllerStatusToolArgs) => Promise<WorkflowControllerStatusResult>;
763
+ //#endregion
764
+ //#region src/tools/workflow-ready.d.ts
765
+ interface WorkflowReadyToolArgs {
766
+ controllerId: string;
767
+ limit?: number;
768
+ supervisorId?: string;
769
+ }
770
+ type WorkflowReadyResult = Record<string, unknown>;
771
+ declare function createWorkflowReadyTool(getSupervisorClient: GetSupervisorClient): (args: WorkflowReadyToolArgs) => Promise<WorkflowReadyResult>;
772
+ declare const workflowReadyTool: (args: WorkflowReadyToolArgs) => Promise<WorkflowReadyResult>;
773
+ //#endregion
774
+ export { type AskResult, type AskToolArgs, type BrokerReceiveArgs, type BrokerReceiveResult, type BrokerReplyArgs, type BrokerReplyResult, type CancelResult, type CancelToolArgs, type Client, DEFAULT_RUN_REDUCER_LIMITS, type Event, type ExecutionIdentity, type FollowUpToolArgs, type FollowUpToolResult, type HistoryOptions, type HistoryResult, type InboundAsk, type InspectResult, type NormalizedRunEvent, type ObserveRunOptions, type PeerEntry, type PeersResult, type ResultResult, type ResultToolArgs, type RunChunkRole, type RunIdentity, type RunInfo, type RunObserver, type RunObserverClient, type RunPermissionOption, type RunPermissionSummary, RunReducer, type RunReducerLimits, type RunSnapshot, type RunSnapshotSeed, type RunToolState, type RunToolSummary, type RunTranscriptEntry, type SpawnMetadata, type SpawnParams, type SpawnResult, type SpawnSelectionInput, type SpawnToolArgs, type SpawnToolResult, type StatusResult, type StatusToolArgs, type StatusView, type SubscribeOptions, Supervisor, type SupervisorOptions, THINKING_LEVELS, type ThinkingLevel, type ThinkingOutcome, type WorkflowCompleteParams, type WorkflowCompleteResult, type WorkflowCompleteToolArgs, type WorkflowControllerCreateParams, type WorkflowControllerStatusResult, type WorkflowControllerStatusToolArgs, type WorkflowEventsResult, type WorkflowEventsToolArgs, type WorkflowGateOperation, type WorkflowGateParams, type WorkflowGateResult, type WorkflowGateToolArgs, type WorkflowHeartbeatParams, type WorkflowInspectResult, type WorkflowInspectToolArgs, type WorkflowReadyResult, type WorkflowReadyToolArgs, type WorkflowStatusResult, type WorkflowStatusToolArgs, type WorkflowWaitResult, type WorkflowWaitToolArgs, answerPermissionTool, askTool, brokerReceiveTool, brokerReplyTool, cancelTool, createRunSnapshot, createWorkflowCompleteTool, createWorkflowControllerStatusTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowReadyTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, extractEventText, findAvenorBinary, followUpTool, getInstallDir, getVersion, inspectTool, installerBinaryPath, isThinkingLevel, normalizeRunEvent, observeRun, peersTool, reduceRunSnapshot, resultTool, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool };
package/dist/index.js CHANGED
@@ -352,6 +352,32 @@ var Client = class {
352
352
  if (params.activation_id !== void 0) command.activation_id = params.activation_id;
353
353
  return this.workflowCommand(params.workflow_id, command);
354
354
  }
355
+ async workflowControllerStatus(controllerId) {
356
+ return this.call("workflow.controller.status", { controller_id: controllerId });
357
+ }
358
+ async workflowReady(controllerId, limit) {
359
+ const params = { controller_id: controllerId };
360
+ if (limit !== void 0) params.limit = limit;
361
+ return this.call("workflow.ready", params);
362
+ }
363
+ async workflowControllerList() {
364
+ return this.call("workflow.controller.list");
365
+ }
366
+ async workflowControllerCreate(params) {
367
+ return this.call("workflow.controller.create", {
368
+ controller_id: params.controller_id,
369
+ max_inflight: params.max_inflight
370
+ });
371
+ }
372
+ async workflowControllerEnable(controllerId) {
373
+ return this.call("workflow.controller.enable", { controller_id: controllerId });
374
+ }
375
+ async workflowControllerDisable(controllerId, reason) {
376
+ return this.call("workflow.controller.disable", {
377
+ controller_id: controllerId,
378
+ reason
379
+ });
380
+ }
355
381
  async brokerSend(fromRunId, toRunId, message, role) {
356
382
  await this.call("broker_send", {
357
383
  from_run_id: fromRunId,
@@ -3203,4 +3229,22 @@ function createWorkflowGateTool(getSupervisorClient) {
3203
3229
  }
3204
3230
  const workflowGateTool = createWorkflowGateTool(getSupervisorClient);
3205
3231
  //#endregion
3206
- export { DEFAULT_RUN_REDUCER_LIMITS, RunReducer, Supervisor, THINKING_LEVELS, answerPermissionTool, askTool, brokerReceiveTool, brokerReplyTool, cancelTool, createRunSnapshot, createWorkflowCompleteTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, extractEventText, findAvenorBinary, followUpTool, getInstallDir, getVersion, inspectTool, installerBinaryPath, isThinkingLevel, normalizeRunEvent, observeRun, peersTool, reduceRunSnapshot, resultTool, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCompleteTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowStatusTool, workflowWaitTool };
3232
+ //#region src/tools/workflow-controller-status.ts
3233
+ function createWorkflowControllerStatusTool(getSupervisorClient) {
3234
+ return async (args) => {
3235
+ if (!args.controllerId) return withWorkflowClient(args.supervisorId, (client) => client.workflowControllerList(), getSupervisorClient);
3236
+ return withWorkflowClient(args.supervisorId, (client) => client.workflowControllerStatus(args.controllerId), getSupervisorClient);
3237
+ };
3238
+ }
3239
+ const workflowControllerStatusTool = createWorkflowControllerStatusTool(getSupervisorClient);
3240
+ //#endregion
3241
+ //#region src/tools/workflow-ready.ts
3242
+ function createWorkflowReadyTool(getSupervisorClient) {
3243
+ return async (args) => {
3244
+ if (!args.controllerId) throw new Error("controllerId is required");
3245
+ return withWorkflowClient(args.supervisorId, (client) => client.workflowReady(args.controllerId, args.limit), getSupervisorClient);
3246
+ };
3247
+ }
3248
+ const workflowReadyTool = createWorkflowReadyTool(getSupervisorClient);
3249
+ //#endregion
3250
+ export { DEFAULT_RUN_REDUCER_LIMITS, RunReducer, Supervisor, THINKING_LEVELS, answerPermissionTool, askTool, brokerReceiveTool, brokerReplyTool, cancelTool, createRunSnapshot, createWorkflowCompleteTool, createWorkflowControllerStatusTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowReadyTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, extractEventText, findAvenorBinary, followUpTool, getInstallDir, getVersion, inspectTool, installerBinaryPath, isThinkingLevel, normalizeRunEvent, observeRun, peersTool, reduceRunSnapshot, resultTool, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dougbots/avenor-core",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",