feat(tasks): enforce dynamic execution plans

This commit is contained in:
2026-09-24 16:36:12 +08:00
parent 485ceff7e3
commit e0d37f9da9
13 changed files with 1942 additions and 17 deletions
+649 -2
View File
@@ -2327,6 +2327,40 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/access-requests": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Request Operational Task Access */
post: operations["post_operational_tasks_task_id_access_requests"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/access-requests/{access_request_id}/decision": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Decide Operational Task Access */
post: operations["post_operational_tasks_task_id_access_requests_access_request_id_decision"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/actions": {
parameters: {
query?: never;
@@ -2344,6 +2378,23 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/actions/{action_id}/confirm-dispatch": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Confirm Operational Work Order Dispatch */
post: operations["post_operational_tasks_task_id_actions_action_id_confirm_dispatch"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/actions/{action_id}/decision": {
parameters: {
query?: never;
@@ -2361,6 +2412,23 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/actions/{action_id}/draft": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
/** Update Operational Work Order Draft */
patch: operations["patch_operational_tasks_task_id_actions_action_id_draft"];
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/actions/{action_id}/execute": {
parameters: {
query?: never;
@@ -2616,6 +2684,23 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/operational-tasks/{task_id}/withdraw-external-source": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Withdraw Operational Task External Source */
post: operations["post_operational_tasks_task_id_withdraw_external_source"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/patterns": {
parameters: {
query?: never;
@@ -5983,6 +6068,8 @@ export interface components {
condition?: string | null;
/** From */
from: string;
/** Id */
id?: string | null;
/** To */
to: string;
};
@@ -5996,9 +6083,9 @@ export interface components {
reason: string;
/**
* Schema
* @constant
* @enum {string}
*/
schema: "execution-plan@1";
schema: "execution-plan@1" | "execution-plan@2";
/** Title */
title: string;
};
@@ -6010,13 +6097,21 @@ export interface components {
detail: string;
/** Evidence Refs */
evidence_refs?: string[];
/** Gate Ref */
gate_ref?: string | null;
/** Id */
id: string;
/** Kind */
kind?: ("activity" | "decision" | "parallel_split" | "parallel_join" | "gate") | null;
/**
* Owner
* @enum {string}
*/
owner: "agent" | "human";
/** Revisits Node Id */
revisits_node_id?: string | null;
/** Selected Edge Id */
selected_edge_id?: string | null;
/**
* Status
* @enum {string}
@@ -6103,6 +6198,16 @@ export interface components {
source_revision: number;
task: components["schemas"]["OperationalTaskDetail"];
};
/** ExternalSourceWithdrawalCommand */
ExternalSourceWithdrawalCommand: {
/**
* Request Id
* Format: uuid
*/
request_id: string;
/** Source Event Id */
source_event_id: string;
};
/** ExternalWorkOrderSnapshot */
ExternalWorkOrderSnapshot: {
/** Activity */
@@ -6230,6 +6335,10 @@ export interface components {
decided_by?: string | null;
/** Decision Comment */
decision_comment?: string | null;
/** Edited At */
edited_at?: string | null;
/** Edited By */
edited_by?: string | null;
/** Evidence Refs */
evidence_refs: string[];
/** Executed At */
@@ -6552,6 +6661,8 @@ export interface components {
};
/** OperationalTaskDetail */
OperationalTaskDetail: {
/** Access Requests */
access_requests?: components["schemas"]["TaskAccessRequest"][];
/** Actions */
actions: components["schemas"]["HumanApprovalAction"][];
active_run?: components["schemas"]["OperationalTaskRun"] | null;
@@ -6644,6 +6755,12 @@ export interface components {
* @enum {string}
*/
kind: "task_created" | "action_pending" | "report_updated" | "task_completed" | "task_failed" | "run_delivery_degraded" | "access_approval_pending" | "action_approval_pending" | "human_input_required" | "external_coordination_failed";
/**
* Lifecycle Status
* @default active
* @enum {string}
*/
lifecycle_status: "active" | "resolved";
/**
* Notification Id
* Format: uuid
@@ -6655,11 +6772,23 @@ export interface components {
read_by?: string | null;
/** Required Permission */
required_permission?: string | null;
/** Resolution Reason */
resolution_reason?: string | null;
/** Resolved At */
resolved_at?: string | null;
/**
* Status
* @enum {string}
*/
status: "unread" | "read";
/** Subject Id */
subject_id?: string | null;
/**
* Subject Type
* @default task
* @enum {string}
*/
subject_type: "task" | "run" | "access_request" | "action";
/**
* Task Id
* Format: uuid
@@ -6694,6 +6823,11 @@ export interface components {
};
/** OperationalTaskPermissions */
OperationalTaskPermissions: {
/**
* Can Decide Access
* @default false
*/
can_decide_access: boolean;
/** Can Decide Commands */
can_decide_commands: boolean;
/** Can Decide Work Orders */
@@ -7536,6 +7670,82 @@ export interface components {
/** Source Fid */
source_fid: number;
};
/** TaskAccessRequest */
TaskAccessRequest: {
/**
* Access Request Id
* Format: uuid
*/
access_request_id: string;
/** Approved Scopes */
approved_scopes: ("workbench_runtime" | "scada_devices" | "scada_readings" | "peripheral_points" | "peripheral_work_orders" | "peripheral_observations" | "peripheral_test_data")[];
/** Comment */
comment?: string | null;
/** Decided At */
decided_at?: string | null;
/** Decided By */
decided_by?: string | null;
/** Node Id */
node_id: string;
/** Reason */
reason: string;
/**
* Requested At
* Format: date-time
*/
requested_at: string;
/** Requested By */
requested_by: string;
/** Scopes */
scopes: ("workbench_runtime" | "scada_devices" | "scada_readings" | "peripheral_points" | "peripheral_work_orders" | "peripheral_observations" | "peripheral_test_data")[];
/**
* Status
* @enum {string}
*/
status: "pending" | "approved" | "rejected";
/**
* Task Id
* Format: uuid
*/
task_id: string;
/** Version */
version: number;
};
/** TaskAccessRequestCreate */
TaskAccessRequestCreate: {
/** Node Id */
node_id: string;
/** Reason */
reason: string;
/**
* Request Id
* Format: uuid
*/
request_id: string;
/** Scopes */
scopes: ("workbench_runtime" | "scada_devices" | "scada_readings" | "peripheral_points" | "peripheral_work_orders" | "peripheral_observations" | "peripheral_test_data")[];
/** Source Session Id */
source_session_id: string;
};
/** TaskAccessRequestDecision */
TaskAccessRequestDecision: {
/** Approved Scopes */
approved_scopes?: ("workbench_runtime" | "scada_devices" | "scada_readings" | "peripheral_points" | "peripheral_work_orders" | "peripheral_observations" | "peripheral_test_data")[];
/** Comment */
comment?: string | null;
/**
* Decision
* @enum {string}
*/
decision: "approved" | "rejected";
/** Expected Version */
expected_version: number;
/**
* Request Id
* Format: uuid
*/
request_id: string;
};
/** TaskAlertCommand */
TaskAlertCommand: {
/** Alert Id */
@@ -7650,6 +7860,8 @@ export interface components {
};
/** TaskSource */
TaskSource: {
/** Deleted At */
deleted_at?: string | null;
/** Event Kind */
event_kind?: string | null;
/** External Id */
@@ -7742,6 +7954,27 @@ export interface components {
/** Title */
title: string;
};
/** WorkOrderConfirmDispatchCommand */
WorkOrderConfirmDispatchCommand: {
/** Expected Version */
expected_version: number;
/**
* Request Id
* Format: uuid
*/
request_id: string;
};
/** WorkOrderDraftUpdateCommand */
WorkOrderDraftUpdateCommand: {
/** Expected Version */
expected_version: number;
payload: components["schemas"]["CreateWorkOrderPayload"];
/**
* Request Id
* Format: uuid
*/
request_id: string;
};
/** WorkbenchAlertSource */
WorkbenchAlertSource: {
/** Run Id */
@@ -19772,6 +20005,171 @@ export interface operations {
};
};
};
post_operational_tasks_task_id_access_requests: {
parameters: {
query?: never;
header: {
"X-Project-Id": string;
};
path: {
task_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["TaskAccessRequestCreate"];
};
};
responses: {
/** @description Successful Response */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["TaskAccessRequest"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Insufficient permission */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource conflict */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Validation error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Dependency unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
};
};
post_operational_tasks_task_id_access_requests_access_request_id_decision: {
parameters: {
query?: never;
header: {
"X-Project-Id": string;
};
path: {
task_id: string;
access_request_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["TaskAccessRequestDecision"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["TaskAccessRequest"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Insufficient permission */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource conflict */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Validation error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Dependency unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
};
};
post_operational_tasks_task_id_actions: {
parameters: {
query?: never;
@@ -19854,6 +20252,90 @@ export interface operations {
};
};
};
post_operational_tasks_task_id_actions_action_id_confirm_dispatch: {
parameters: {
query?: never;
header: {
Authorization?: string | null;
"X-Project-Id": string;
};
path: {
task_id: string;
action_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["WorkOrderConfirmDispatchCommand"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HumanApprovalAction"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Insufficient permission */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource conflict */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Validation error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Dependency unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
};
};
post_operational_tasks_task_id_actions_action_id_decision: {
parameters: {
query?: never;
@@ -19937,6 +20419,89 @@ export interface operations {
};
};
};
patch_operational_tasks_task_id_actions_action_id_draft: {
parameters: {
query?: never;
header: {
"X-Project-Id": string;
};
path: {
task_id: string;
action_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["WorkOrderDraftUpdateCommand"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HumanApprovalAction"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Insufficient permission */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource conflict */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Validation error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Dependency unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
};
};
post_operational_tasks_task_id_actions_action_id_execute: {
parameters: {
query?: never;
@@ -21171,6 +21736,88 @@ export interface operations {
};
};
};
post_operational_tasks_task_id_withdraw_external_source: {
parameters: {
query?: never;
header: {
"X-Project-Id": string;
};
path: {
task_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["ExternalSourceWithdrawalCommand"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["OperationalTaskDetail"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Insufficient permission */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Resource conflict */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Validation error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
/** @description Dependency unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ProblemDetails"];
};
};
};
};
get_patterns: {
parameters: {
query?: {