@hotmeshio/long-tail 0.4.1 → 0.4.3
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/build/services/export/index.js +36 -2
- package/build/services/iam/activity.d.ts +4 -3
- package/build/services/iam/activity.js +5 -5
- package/dashboard/dist/assets/{AdminDashboard-C0_qN2h3.js → AdminDashboard-Dr5wTIZT.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-C0_qN2h3.js.map → AdminDashboard-Dr5wTIZT.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-DG1zOIiz.js → AgentConfigPage-D52KyJY-.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-DG1zOIiz.js.map → AgentConfigPage-D52KyJY-.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-B5kaAJDM.js → AgentDetailPage-Cbo_qrYF.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-B5kaAJDM.js.map → AgentDetailPage-Cbo_qrYF.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DJWSuoJA.js → AgentsPage-CvuF8--H.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DJWSuoJA.js.map → AgentsPage-CvuF8--H.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-DrarbHov.js → AvailableEscalationsPage-UzjXcO3W.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-DrarbHov.js.map → AvailableEscalationsPage-UzjXcO3W.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-CvXQwE5Z.js → BotPicker-CM-_u73k.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-CvXQwE5Z.js.map → BotPicker-CM-_u73k.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-BiL9QUxI.js → CapabilitiesPage-D1QEHMKw.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-BiL9QUxI.js.map → CapabilitiesPage-D1QEHMKw.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-D9F01Tny.js → CollapsibleSection-CnPKa7df.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-D9F01Tny.js.map → CollapsibleSection-CnPKa7df.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-C-rjAIK3.js → CredentialsPage-CImIzra4.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-C-rjAIK3.js.map → CredentialsPage-CImIzra4.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DnZF8_vw.js → CronLabel-5HPAmciI.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DnZF8_vw.js.map → CronLabel-5HPAmciI.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-BYDrcsYT.js → CustomDurationPicker-5JzEgS7I.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BYDrcsYT.js.map → CustomDurationPicker-5JzEgS7I.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-BkiVdGaJ.js → ElapsedCell-B79BF5Mj.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-BkiVdGaJ.js.map → ElapsedCell-B79BF5Mj.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-Cg2SN0WK.js → EscalationsOverview-QvWvbpx3.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-Cg2SN0WK.js.map → EscalationsOverview-QvWvbpx3.js.map} +1 -1
- package/dashboard/dist/assets/EventTable-DAclQwfr.js +2 -0
- package/dashboard/dist/assets/EventTable-DAclQwfr.js.map +1 -0
- package/dashboard/dist/assets/{HomePage-74mCQ5nB.js → HomePage-DVOi7rR1.js} +2 -2
- package/dashboard/dist/assets/{HomePage-74mCQ5nB.js.map → HomePage-DVOi7rR1.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-DL1wEuvL.js → ListToolbar-Bntl2hex.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-DL1wEuvL.js.map → ListToolbar-Bntl2hex.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-D34bLMuP.js → McpOverview-B-xSYPJj.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-D34bLMuP.js.map → McpOverview-B-xSYPJj.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-gLGTGX6g.js → McpQueryDetailPage-Cq71BzjB.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-gLGTGX6g.js.map → McpQueryDetailPage-Cq71BzjB.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-wPHJkhEp.js → McpQueryPage-Dfz87aZF.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-wPHJkhEp.js.map → McpQueryPage-Dfz87aZF.js.map} +1 -1
- package/dashboard/dist/assets/McpRunDetailPage-CXXRgMmJ.js +2 -0
- package/dashboard/dist/assets/{McpRunDetailPage-SoXudCbq.js.map → McpRunDetailPage-CXXRgMmJ.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BUSxdydO.js → McpRunsPage-MUYvUYqz.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BUSxdydO.js.map → McpRunsPage-MUYvUYqz.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-CYCl2our.js → OperatorDashboard-Rih1SZrn.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-CYCl2our.js.map → OperatorDashboard-Rih1SZrn.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-DzGacZpO.js → ProcessDetailPage-BMkWCjqD.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-DzGacZpO.js.map → ProcessDetailPage-BMkWCjqD.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-Bmn33g_l.js → ProcessesListPage-vZjUSc7S.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-Bmn33g_l.js.map → ProcessesListPage-vZjUSc7S.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-BTtaabkS.js → RolesPage-kjeAsj3_.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-BTtaabkS.js.map → RolesPage-kjeAsj3_.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-B1R8nJvE.js → RunAsSelector-DC4SLtTq.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-B1R8nJvE.js.map → RunAsSelector-DC4SLtTq.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CU2ZD9cC.js → SwimlaneTimeline-MUUXgT3o.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CU2ZD9cC.js.map → SwimlaneTimeline-MUUXgT3o.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-CZw_F8y4.js → TaskDetailPage-C0AlG_2t.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-CZw_F8y4.js.map → TaskDetailPage-C0AlG_2t.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-D-vHndyV.js → TasksListPage-69ZWCaCP.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-D-vHndyV.js.map → TasksListPage-69ZWCaCP.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-B6Gz4RAU.js → TimeAgo-CttiZG0k.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-B6Gz4RAU.js.map → TimeAgo-CttiZG0k.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DZu9PtN2.js → TimestampCell-CYFbEhqc.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DZu9PtN2.js.map → TimestampCell-CYFbEhqc.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-D4cgYW2p.js → ToolTestPanel-CY_PLZSe.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-D4cgYW2p.js.map → ToolTestPanel-CY_PLZSe.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-C5ZUZpU5.js → TopicDetailPage-Aq4-6GLl.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-C5ZUZpU5.js.map → TopicDetailPage-Aq4-6GLl.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-Cbc0nVj9.js → TopicsPage-BYFKjRY_.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-Cbc0nVj9.js.map → TopicsPage-BYFKjRY_.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-YUoNrFAq.js → UserName-C4_T5-rI.js} +2 -2
- package/dashboard/dist/assets/{UserName-YUoNrFAq.js.map → UserName-C4_T5-rI.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-DUSTBasv.js +2 -0
- package/dashboard/dist/assets/WorkflowExecutionPage-DUSTBasv.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsDashboard-BFzCyvgv.js → WorkflowsDashboard-_LMWc-OC.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-BFzCyvgv.js.map → WorkflowsDashboard-_LMWc-OC.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-C_y7JCg2.js → WorkflowsOverview-DFrfw554.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-C_y7JCg2.js.map → WorkflowsOverview-DFrfw554.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CYQjp3JI.js → YamlWorkflowsPage-CZzGwfol.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CYQjp3JI.js.map → YamlWorkflowsPage-CZzGwfol.js.map} +1 -1
- package/dashboard/dist/assets/{agents-2pDPv2Ww.js → agents-CsKILVSU.js} +2 -2
- package/dashboard/dist/assets/{agents-2pDPv2Ww.js.map → agents-CsKILVSU.js.map} +1 -1
- package/dashboard/dist/assets/{bots-2uGZ2l7A.js → bots-BzEs6Q9L.js} +2 -2
- package/dashboard/dist/assets/{bots-2uGZ2l7A.js.map → bots-BzEs6Q9L.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-CQ29M7lK.js → controlplane-COYEIIAz.js} +2 -2
- package/dashboard/dist/assets/{controlplane-CQ29M7lK.js.map → controlplane-COYEIIAz.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-DWOUjrgL.js → escalation-BZjS2202.js} +2 -2
- package/dashboard/dist/assets/{escalation-DWOUjrgL.js.map → escalation-BZjS2202.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-WrgLIl-W.js → escalation-columns-DtRVmPSB.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-WrgLIl-W.js.map → escalation-columns-DtRVmPSB.js.map} +1 -1
- package/dashboard/dist/assets/{helpers-LN5b1KBx.js → helpers-BngVEys5.js} +2 -2
- package/dashboard/dist/assets/{helpers-LN5b1KBx.js.map → helpers-BngVEys5.js.map} +1 -1
- package/dashboard/dist/assets/{index-C_A76Dl1.js → index-ABsZZf_U.js} +2 -2
- package/dashboard/dist/assets/{index-C_A76Dl1.js.map → index-ABsZZf_U.js.map} +1 -1
- package/dashboard/dist/assets/{index-DqFfgd-7.js → index-BCsShN2l.js} +2 -2
- package/dashboard/dist/assets/{index-DqFfgd-7.js.map → index-BCsShN2l.js.map} +1 -1
- package/dashboard/dist/assets/{index-CdNXBj7w.js → index-Bq5MSkCL.js} +2 -2
- package/dashboard/dist/assets/{index-CdNXBj7w.js.map → index-Bq5MSkCL.js.map} +1 -1
- package/dashboard/dist/assets/{index-BMo7wCw8.js → index-BwivT39P.js} +2 -2
- package/dashboard/dist/assets/{index-BMo7wCw8.js.map → index-BwivT39P.js.map} +1 -1
- package/dashboard/dist/assets/{index-J0dMfAmE.js → index-Byp8BDPs.js} +2 -2
- package/dashboard/dist/assets/{index-J0dMfAmE.js.map → index-Byp8BDPs.js.map} +1 -1
- package/dashboard/dist/assets/{index-dzxsXeMO.js → index-ByxH4qQ-.js} +2 -2
- package/dashboard/dist/assets/{index-dzxsXeMO.js.map → index-ByxH4qQ-.js.map} +1 -1
- package/dashboard/dist/assets/index-COgyD_H2.js +2 -0
- package/dashboard/dist/assets/{index-CryoNbg0.js.map → index-COgyD_H2.js.map} +1 -1
- package/dashboard/dist/assets/index-DXEYynKO.css +1 -0
- package/dashboard/dist/assets/{index-CBS8FBcp.js → index-DcpCR9c_.js} +3 -3
- package/dashboard/dist/assets/{index-CBS8FBcp.js.map → index-DcpCR9c_.js.map} +1 -1
- package/dashboard/dist/assets/index-DuPY59Yu.js +5 -0
- package/dashboard/dist/assets/index-DuPY59Yu.js.map +1 -0
- package/dashboard/dist/assets/{index-ugekH3E2.js → index-DxMNiFPS.js} +2 -2
- package/dashboard/dist/assets/{index-ugekH3E2.js.map → index-DxMNiFPS.js.map} +1 -1
- package/dashboard/dist/assets/{index-CovZsMow.js → index-DykjJxzr.js} +2 -2
- package/dashboard/dist/assets/{index-CovZsMow.js.map → index-DykjJxzr.js.map} +1 -1
- package/dashboard/dist/assets/{index-CFJc47B8.js → index-R61-yG56.js} +2 -2
- package/dashboard/dist/assets/{index-CFJc47B8.js.map → index-R61-yG56.js.map} +1 -1
- package/dashboard/dist/assets/{index-CvzfRxnj.js → index-xgl431mG.js} +2 -2
- package/dashboard/dist/assets/{index-CvzfRxnj.js.map → index-xgl431mG.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-BhZk3Wy9.js → knowledge-DhCbDgy4.js} +2 -2
- package/dashboard/dist/assets/{knowledge-BhZk3Wy9.js.map → knowledge-DhCbDgy4.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-BoNH5uCn.js → mcp-query-il3CfU3U.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-BoNH5uCn.js.map → mcp-query-il3CfU3U.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-runs-BhkGaw2y.js → mcp-runs-4fyRpegc.js} +2 -2
- package/dashboard/dist/assets/{mcp-runs-BhkGaw2y.js.map → mcp-runs-4fyRpegc.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-FOHNY7Zj.js → mcp-xh7T0I-f.js} +2 -2
- package/dashboard/dist/assets/{mcp-FOHNY7Zj.js.map → mcp-xh7T0I-f.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-duQCQRHq.js → namespaces-BBTvHnRF.js} +2 -2
- package/dashboard/dist/assets/{namespaces-duQCQRHq.js.map → namespaces-BBTvHnRF.js.map} +1 -1
- package/dashboard/dist/assets/{roles-DW6lI_g5.js → roles-D7bx5FAM.js} +2 -2
- package/dashboard/dist/assets/{roles-DW6lI_g5.js.map → roles-D7bx5FAM.js.map} +1 -1
- package/dashboard/dist/assets/{settings-wTRbazzw.js → settings-nt6qyR1S.js} +2 -2
- package/dashboard/dist/assets/{settings-wTRbazzw.js.map → settings-nt6qyR1S.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-C-QX245z.js → tasks-BgxRbhVM.js} +2 -2
- package/dashboard/dist/assets/{tasks-C-QX245z.js.map → tasks-BgxRbhVM.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CAnsyo3w.js → topics-CTtCboHe.js} +2 -2
- package/dashboard/dist/assets/{topics-CAnsyo3w.js.map → topics-CTtCboHe.js.map} +1 -1
- package/dashboard/dist/assets/useCollapsedSections-BU5HULGs.js +2 -0
- package/dashboard/dist/assets/useCollapsedSections-BU5HULGs.js.map +1 -0
- package/dashboard/dist/assets/{useEventHooks-C689a4F7.js → useEventHooks-CkJOmbF-.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-C689a4F7.js.map → useEventHooks-CkJOmbF-.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-BTHFGIsD.js → useYamlActivityEvents-CSMX9He5.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-BTHFGIsD.js.map → useYamlActivityEvents-CSMX9He5.js.map} +1 -1
- package/dashboard/dist/assets/{users--D3LoFOD.js → users-CyF-5WLI.js} +2 -2
- package/dashboard/dist/assets/{users--D3LoFOD.js.map → users-CyF-5WLI.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-MpNdzreD.js → workflows-Bf4_w24H.js} +2 -2
- package/dashboard/dist/assets/{workflows-MpNdzreD.js.map → workflows-Bf4_w24H.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CFhnJzQy.js → yaml-workflows-Cp1N0NMK.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CFhnJzQy.js.map → yaml-workflows-Cp1N0NMK.js.map} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/docs/agents.md +29 -1
- package/docs/events.md +7 -0
- package/docs/hitl-guide.md +560 -0
- package/package.json +2 -2
- package/dashboard/dist/assets/EventTable-B9wYf13g.js +0 -2
- package/dashboard/dist/assets/EventTable-B9wYf13g.js.map +0 -1
- package/dashboard/dist/assets/McpRunDetailPage-SoXudCbq.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-CVGztAdK.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-CVGztAdK.js.map +0 -1
- package/dashboard/dist/assets/index-ChGBlYKj.css +0 -1
- package/dashboard/dist/assets/index-CryoNbg0.js +0 -2
- package/dashboard/dist/assets/index-DDxZOINn.js +0 -5
- package/dashboard/dist/assets/index-DDxZOINn.js.map +0 -1
|
@@ -65,8 +65,21 @@ async function getWorkflowStatus(workflowId, taskQueue, workflowName) {
|
|
|
65
65
|
async function exportWorkflowExecution(workflowId, taskQueue, workflowName, options) {
|
|
66
66
|
try {
|
|
67
67
|
const handle = await (0, client_1.getHandle)(taskQueue, workflowName, workflowId);
|
|
68
|
-
const execution = await
|
|
69
|
-
|
|
68
|
+
const [execution, raw] = await Promise.all([
|
|
69
|
+
handle.exportExecution({ ...options, enrich_inputs: true }),
|
|
70
|
+
handle.export({ allow: ['state'], values: true }),
|
|
71
|
+
]);
|
|
72
|
+
const processed = (0, post_process_1.postProcessExecution)(execution);
|
|
73
|
+
// Extract parent_workflow_id from the raw state metadata (HotMesh's `pj` field).
|
|
74
|
+
// The SDK's WorkflowExecution doesn't surface this yet; when it does,
|
|
75
|
+
// the SDK value takes precedence (defensive: only set if absent).
|
|
76
|
+
if (!processed.parent_workflow_id) {
|
|
77
|
+
const pj = extractParentJobId(raw);
|
|
78
|
+
if (pj && pj !== workflowId) {
|
|
79
|
+
processed.parent_workflow_id = pj;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return processed;
|
|
70
83
|
}
|
|
71
84
|
catch (err) {
|
|
72
85
|
if (err instanceof WorkflowNotFoundError)
|
|
@@ -74,6 +87,27 @@ async function exportWorkflowExecution(workflowId, taskQueue, workflowName, opti
|
|
|
74
87
|
throw new WorkflowNotFoundError(workflowId);
|
|
75
88
|
}
|
|
76
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Walk the raw export state looking for the `pj` (parent job ID) field.
|
|
92
|
+
* HotMesh stores it at `state.output.metadata.pj` after symbol inflation.
|
|
93
|
+
* Returns undefined if not found (workflow has no parent).
|
|
94
|
+
*/
|
|
95
|
+
function extractParentJobId(raw) {
|
|
96
|
+
const state = raw?.state;
|
|
97
|
+
if (!state || typeof state !== 'object')
|
|
98
|
+
return undefined;
|
|
99
|
+
// Typical path: state.output.metadata.pj
|
|
100
|
+
const output = state.output ?? state;
|
|
101
|
+
const metadata = output?.metadata;
|
|
102
|
+
if (metadata?.pj && typeof metadata.pj === 'string') {
|
|
103
|
+
return metadata.pj;
|
|
104
|
+
}
|
|
105
|
+
// Fallback: walk top-level state keys (older export shapes)
|
|
106
|
+
if (state.pj && typeof state.pj === 'string') {
|
|
107
|
+
return state.pj;
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
77
111
|
/**
|
|
78
112
|
* Return the current job state of a workflow.
|
|
79
113
|
* If the workflow is complete this is also the output.
|
|
@@ -46,7 +46,8 @@ export interface ActivityIdentity {
|
|
|
46
46
|
toolContext: ToolContext;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Returns the identity context for the current proxy activity
|
|
50
|
-
*
|
|
49
|
+
* Returns the identity context for the current proxy activity,
|
|
50
|
+
* or `null` when called outside an interceptor-wrapped context
|
|
51
|
+
* (e.g., cron-invoked or agent-triggered workflows).
|
|
51
52
|
*/
|
|
52
|
-
export declare function getActivityIdentity(): ActivityIdentity;
|
|
53
|
+
export declare function getActivityIdentity(): ActivityIdentity | null;
|
|
@@ -33,14 +33,14 @@ exports.getActivityIdentity = getActivityIdentity;
|
|
|
33
33
|
const context_1 = require("./context");
|
|
34
34
|
const credentials_1 = require("./credentials");
|
|
35
35
|
/**
|
|
36
|
-
* Returns the identity context for the current proxy activity
|
|
37
|
-
*
|
|
36
|
+
* Returns the identity context for the current proxy activity,
|
|
37
|
+
* or `null` when called outside an interceptor-wrapped context
|
|
38
|
+
* (e.g., cron-invoked or agent-triggered workflows).
|
|
38
39
|
*/
|
|
39
40
|
function getActivityIdentity() {
|
|
40
41
|
const ctx = (0, context_1.getToolContext)();
|
|
41
|
-
if (!ctx)
|
|
42
|
-
|
|
43
|
-
}
|
|
42
|
+
if (!ctx)
|
|
43
|
+
return null;
|
|
44
44
|
return {
|
|
45
45
|
principal: ctx.principal,
|
|
46
46
|
initiatingPrincipal: ctx.initiatingPrincipal,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as o}from"./vendor-query-B2UbickB.js";import{c as n}from"./tasks-
|
|
2
|
-
//# sourceMappingURL=AdminDashboard-
|
|
1
|
+
import{j as o}from"./vendor-query-B2UbickB.js";import{c as n}from"./tasks-BgxRbhVM.js";import{q as m}from"./index-DcpCR9c_.js";import{f as c}from"./useEventHooks-CkJOmbF-.js";import{u}from"./mcp-xh7T0I-f.js";import{P as d}from"./PageHeaderWithStats-7K5BdhOj.js";import"./vendor-react-CX88sFS5.js";import"./vendor-icons-BNtvBbnj.js";function j(){var a;c();const{data:s}=n({limit:1}),{data:e}=m({status:"pending",limit:1}),{data:t}=u(),r=((a=t==null?void 0:t.servers)==null?void 0:a.filter(i=>i.status==="connected").length)??0,l=t?`${r}/${t.total}`:"—";return o.jsx("div",{children:o.jsx(d,{title:"Admin",stats:[{label:"Tasks",value:(s==null?void 0:s.total)??"—"},{label:"Pending Escalations",value:(e==null?void 0:e.total)??"—",dotClass:"bg-status-pending"},{label:"MCP Servers",value:l},{label:"System",value:"Healthy",dotClass:"bg-status-success"}]})})}export{j as AdminDashboard};
|
|
2
|
+
//# sourceMappingURL=AdminDashboard-Dr5wTIZT.js.map
|
package/dashboard/dist/assets/{AdminDashboard-C0_qN2h3.js.map → AdminDashboard-Dr5wTIZT.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminDashboard-
|
|
1
|
+
{"version":3,"file":"AdminDashboard-Dr5wTIZT.js","sources":["../../src/pages/admin/AdminDashboard.tsx"],"sourcesContent":["import { useTasks } from '../../api/tasks';\nimport { useEscalations } from '../../api/escalations';\nimport { useEscalationListEvents } from '../../hooks/useEventHooks';\nimport { useMcpServers } from '../../api/mcp';\nimport { PageHeaderWithStats } from '../../components/common/layout/PageHeaderWithStats';\n\nexport function AdminDashboard() {\n useEscalationListEvents();\n const { data: taskData } = useTasks({ limit: 1 });\n const { data: pendingEsc } = useEscalations({ status: 'pending', limit: 1 });\n const { data: mcpData } = useMcpServers();\n\n const connectedServers =\n mcpData?.servers?.filter((s) => s.status === 'connected').length ?? 0;\n const mcpLabel = mcpData ? `${connectedServers}/${mcpData.total}` : '—';\n\n return (\n <div>\n <PageHeaderWithStats\n title=\"Admin\"\n stats={[\n { label: 'Tasks', value: taskData?.total ?? '—' },\n { label: 'Pending Escalations', value: pendingEsc?.total ?? '—', dotClass: 'bg-status-pending' },\n { label: 'MCP Servers', value: mcpLabel },\n { label: 'System', value: 'Healthy', dotClass: 'bg-status-success' },\n ]}\n />\n </div>\n );\n}\n"],"names":["AdminDashboard","useEscalationListEvents","taskData","useTasks","pendingEsc","useEscalations","mcpData","useMcpServers","connectedServers","_a","s","mcpLabel","jsx","PageHeaderWithStats"],"mappings":"4UAMO,SAASA,GAAiB,OAC/BC,EAAA,EACA,KAAM,CAAE,KAAMC,CAAA,EAAaC,EAAS,CAAE,MAAO,EAAG,EAC1C,CAAE,KAAMC,CAAA,EAAeC,EAAe,CAAE,OAAQ,UAAW,MAAO,EAAG,EACrE,CAAE,KAAMC,CAAA,EAAYC,EAAA,EAEpBC,IACJC,EAAAH,GAAA,YAAAA,EAAS,UAAT,YAAAG,EAAkB,OAAQC,GAAMA,EAAE,SAAW,aAAa,SAAU,EAChEC,EAAWL,EAAU,GAAGE,CAAgB,IAAIF,EAAQ,KAAK,GAAK,IAEpE,aACG,MAAA,CACC,SAAAM,EAAAA,IAACC,EAAA,CACC,MAAM,QACN,MAAO,CACL,CAAE,MAAO,QAAS,OAAOX,GAAA,YAAAA,EAAU,QAAS,GAAA,EAC5C,CAAE,MAAO,sBAAuB,OAAOE,GAAA,YAAAA,EAAY,QAAS,IAAK,SAAU,mBAAA,EAC3E,CAAE,MAAO,cAAe,MAAOO,CAAA,EAC/B,CAAE,MAAO,SAAU,MAAO,UAAW,SAAU,mBAAA,CAAoB,CACrE,CAAA,EAEJ,CAEJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,a as g}from"./vendor-query-B2UbickB.js";import{a as te,d as se,b as ae}from"./agents-2pDPv2Ww.js";import{C as ne,u as ie,a as le,b as ce,c as re}from"./CronLabel-DnZF8_vw.js";import{P as oe}from"./PageHeader-Bo0SpcCK.js";import{B as P,d as L,R as z,Y as $,n as B,a4 as U,a as G,aF as K,K as de}from"./vendor-icons-BNtvBbnj.js";import{e as xe}from"./knowledge-BhZk3Wy9.js";import{c as pe}from"./index-CBS8FBcp.js";import{R as H}from"./RunAsSelector-B1R8nJvE.js";import{u as Q}from"./workflows-MpNdzreD.js";import{u as he}from"./topics-CAnsyo3w.js";import{u as me}from"./yaml-workflows-CFhnJzQy.js";import{E as ue}from"./EventTopicPill-By-6sXDp.js";import{W as F}from"./WorkflowPill-pPuGH8v9.js";import{e as ve,c as je,f as ge}from"./vendor-react-CX88sFS5.js";import"./BotPicker-CvXQwE5Z.js";import"./bots-2uGZ2l7A.js";const J={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},fe={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",input_mapping:"{}",execute_as:"",enabled:!0},ye={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",envelope:"{}",execute_as:""};function be(t,s){var l,d,h;const o=(d=(l=t.behaviors)==null?void 0:l.schedules)!=null&&d.length?t.behaviors.schedules.map(i=>({cron:i.cron||"",reaction_type:i.reaction_type||"durable",workflow_type:i.workflow_type||"",pipeline_id:i.pipeline_id||"",envelope:i.envelope?JSON.stringify(i.envelope,null,2):"{}",execute_as:i.execute_as||""})):(h=t.behaviors)!=null&&h.cron?[{cron:t.behaviors.cron,reaction_type:"durable",workflow_type:t.workflow_type??"",pipeline_id:"",envelope:"{}",execute_as:""}]:[];return{name:t.id,description:t.description??"",goals:t.goals??"",rules:t.rules??"",user_id:t.user_id??"",knowledge_domain:t.knowledge_domain??"",subscriptions:s.map(i=>({id:i.id,topic:i.topic,filter:i.filter?JSON.stringify(i.filter,null,2):"",reaction_type:i.reaction_type,workflow_type:i.workflow_type??"",pipeline_id:i.pipeline_id??"",mcp_prompt:i.mcp_prompt??"",input_mapping:JSON.stringify(i.input_mapping??{},null,2),execute_as:i.execute_as??"",enabled:i.enabled})),schedules:o}}function we(t){var o;const s={};return t.schedules.length>0&&(s.schedules=t.schedules.map(l=>({cron:l.cron,reaction_type:l.reaction_type||"durable",workflow_type:l.reaction_type==="pipeline"?void 0:l.workflow_type,pipeline_id:l.reaction_type==="pipeline"?l.pipeline_id:void 0,envelope:M(l.envelope)??{},execute_as:l.execute_as||void 0})),s.cron=t.schedules[0].cron),{id:t.name,description:t.description||void 0,goals:t.goals||void 0,rules:t.rules||void 0,user_id:t.user_id||void 0,knowledge_domain:t.knowledge_domain||void 0,behaviors:s,workflow_type:((o=t.schedules[0])==null?void 0:o.workflow_type)||void 0,pipeline_id:void 0}}function Ne(t){return t.subscriptions.map(s=>({id:s.id,topic:s.topic,filter:s.filter?M(s.filter):void 0,reaction_type:s.reaction_type,workflow_type:s.workflow_type||void 0,pipeline_id:s.pipeline_id||void 0,mcp_prompt:s.mcp_prompt||void 0,input_mapping:M(s.input_mapping)??{},execute_as:s.execute_as||void 0,enabled:s.enabled}))}function M(t){if(t.trim())try{return JSON.parse(t)}catch{return}}const k="section-header mt-[3em] first:mt-0",b="label",f="hint",v="input",V="input-json w-full";function ke({form:t,set:s}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Give your agent a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Name *"}),e.jsx("input",{type:"text",value:t.name,onChange:o=>s("name",o.target.value),placeholder:"health-monitor",className:v}),e.jsx("p",{className:f,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Description"}),e.jsx("input",{type:"text",value:t.description,onChange:o=>s("description",o.target.value),placeholder:"Watches for workflow failures and captures diagnostics",className:v}),e.jsx("p",{className:f,children:"One sentence that explains what this agent does."})]})]})}function _e({form:t,set:s}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Goals define what drives the agent. Rules define what constrains it. Together they give automation judgment."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:motivation"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Motivation",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Goals"}),e.jsx("textarea",{value:t.goals,onChange:o=>s("goals",o.target.value),placeholder:"Detect failures early, capture diagnostics, alert before cascading",rows:4,className:`${v} resize-none`}),e.jsx("p",{className:f,children:"Primary motivation. What the agent is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Rules"}),e.jsx("textarea",{value:t.rules,onChange:o=>s("rules",o.target.value),placeholder:"Never auto-restart failed workflows. Always escalate to humans.",rows:4,className:`${v} resize-none`}),e.jsx("p",{className:f,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Ce({form:t,set:s}){const{data:o}=xe(),l=(o==null?void 0:o.domains)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Assign a knowledge domain — the agent's memory. It stores context here over time."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:knowledge"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Knowledge",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:t.knowledge_domain,onChange:d=>s("knowledge_domain",d.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:v,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:l.map(d=>e.jsx("option",{value:d.domain},d.domain))}),e.jsx("p",{className:f,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:l.map(d=>e.jsxs("button",{type:"button",onClick:()=>s("knowledge_domain",d.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${t.knowledge_domain===d.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(L,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:d.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[d.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(pe,{date:d.latest})})]},d.domain))})]})]})}const Se={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"};function Ae({form:t,set:s}){const{data:o}=Q(),{data:l}=he({limit:200}),d=(l==null?void 0:l.topics)??[],h=(o??[]).filter(a=>a.invocable).map(a=>a.workflow_type),[i,j]=g.useState(0),x=(a,m,S)=>{const W=[...t.subscriptions];W[a]={...W[a],[m]:S},s("subscriptions",W)},w=()=>{s("subscriptions",[...t.subscriptions,{...fe}]),j(t.subscriptions.length)},_=a=>{s("subscriptions",t.subscriptions.filter((m,S)=>S!==a)),i>=t.subscriptions.length-1&&j(Math.max(0,t.subscriptions.length-2))},r=t.subscriptions,c=r[i],n=a=>!!a.topic&&(a.reaction_type==="durable"?!!a.workflow_type:a.reaction_type==="pipeline"?!!a.pipeline_id:!!a.mcp_prompt),p=c?d.find(a=>a.topic===c.topic):void 0;return r.length===0?e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the agent runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(z,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:w,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx($,{className:"w-3.5 h-3.5"})," Add first subscription"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the agent runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[r.map((a,m)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${i===m?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>j(m),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${n(a)?"bg-emerald-400":"bg-zinc-500"}`}),e.jsx("span",{className:"text-[11px] font-mono truncate",children:a.topic||"new subscription"})]}),e.jsxs("span",{className:"text-[9px] text-text-quaternary ml-3",children:["→ ",a.workflow_type||a.reaction_type]})]}),e.jsx("button",{onClick:S=>{S.stopPropagation(),confirm(`Remove subscription "${a.topic||"new"}"?
|
|
1
|
+
import{j as e,a as g}from"./vendor-query-B2UbickB.js";import{a as te,d as se,b as ae}from"./agents-CsKILVSU.js";import{C as ne,u as ie,a as le,b as ce,c as re}from"./CronLabel-5HPAmciI.js";import{P as oe}from"./PageHeader-Bo0SpcCK.js";import{B as P,d as L,R as z,Y as $,n as B,a4 as U,a as G,aF as K,K as de}from"./vendor-icons-BNtvBbnj.js";import{e as xe}from"./knowledge-DhCbDgy4.js";import{c as pe}from"./index-DcpCR9c_.js";import{R as H}from"./RunAsSelector-DC4SLtTq.js";import{u as Q}from"./workflows-Bf4_w24H.js";import{u as he}from"./topics-CTtCboHe.js";import{u as me}from"./yaml-workflows-Cp1N0NMK.js";import{E as ue}from"./EventTopicPill-By-6sXDp.js";import{W as F}from"./WorkflowPill-pPuGH8v9.js";import{e as ve,c as je,f as ge}from"./vendor-react-CX88sFS5.js";import"./BotPicker-CM-_u73k.js";import"./bots-BzEs6Q9L.js";const J={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},fe={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",input_mapping:"{}",execute_as:"",enabled:!0},ye={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",envelope:"{}",execute_as:""};function be(t,s){var l,d,h;const o=(d=(l=t.behaviors)==null?void 0:l.schedules)!=null&&d.length?t.behaviors.schedules.map(i=>({cron:i.cron||"",reaction_type:i.reaction_type||"durable",workflow_type:i.workflow_type||"",pipeline_id:i.pipeline_id||"",envelope:i.envelope?JSON.stringify(i.envelope,null,2):"{}",execute_as:i.execute_as||""})):(h=t.behaviors)!=null&&h.cron?[{cron:t.behaviors.cron,reaction_type:"durable",workflow_type:t.workflow_type??"",pipeline_id:"",envelope:"{}",execute_as:""}]:[];return{name:t.id,description:t.description??"",goals:t.goals??"",rules:t.rules??"",user_id:t.user_id??"",knowledge_domain:t.knowledge_domain??"",subscriptions:s.map(i=>({id:i.id,topic:i.topic,filter:i.filter?JSON.stringify(i.filter,null,2):"",reaction_type:i.reaction_type,workflow_type:i.workflow_type??"",pipeline_id:i.pipeline_id??"",mcp_prompt:i.mcp_prompt??"",input_mapping:JSON.stringify(i.input_mapping??{},null,2),execute_as:i.execute_as??"",enabled:i.enabled})),schedules:o}}function we(t){var o;const s={};return t.schedules.length>0&&(s.schedules=t.schedules.map(l=>({cron:l.cron,reaction_type:l.reaction_type||"durable",workflow_type:l.reaction_type==="pipeline"?void 0:l.workflow_type,pipeline_id:l.reaction_type==="pipeline"?l.pipeline_id:void 0,envelope:M(l.envelope)??{},execute_as:l.execute_as||void 0})),s.cron=t.schedules[0].cron),{id:t.name,description:t.description||void 0,goals:t.goals||void 0,rules:t.rules||void 0,user_id:t.user_id||void 0,knowledge_domain:t.knowledge_domain||void 0,behaviors:s,workflow_type:((o=t.schedules[0])==null?void 0:o.workflow_type)||void 0,pipeline_id:void 0}}function Ne(t){return t.subscriptions.map(s=>({id:s.id,topic:s.topic,filter:s.filter?M(s.filter):void 0,reaction_type:s.reaction_type,workflow_type:s.workflow_type||void 0,pipeline_id:s.pipeline_id||void 0,mcp_prompt:s.mcp_prompt||void 0,input_mapping:M(s.input_mapping)??{},execute_as:s.execute_as||void 0,enabled:s.enabled}))}function M(t){if(t.trim())try{return JSON.parse(t)}catch{return}}const k="section-header mt-[3em] first:mt-0",b="label",f="hint",v="input",V="input-json w-full";function ke({form:t,set:s}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Give your agent a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Name *"}),e.jsx("input",{type:"text",value:t.name,onChange:o=>s("name",o.target.value),placeholder:"health-monitor",className:v}),e.jsx("p",{className:f,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Description"}),e.jsx("input",{type:"text",value:t.description,onChange:o=>s("description",o.target.value),placeholder:"Watches for workflow failures and captures diagnostics",className:v}),e.jsx("p",{className:f,children:"One sentence that explains what this agent does."})]})]})}function _e({form:t,set:s}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Goals define what drives the agent. Rules define what constrains it. Together they give automation judgment."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:motivation"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Motivation",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Goals"}),e.jsx("textarea",{value:t.goals,onChange:o=>s("goals",o.target.value),placeholder:"Detect failures early, capture diagnostics, alert before cascading",rows:4,className:`${v} resize-none`}),e.jsx("p",{className:f,children:"Primary motivation. What the agent is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Rules"}),e.jsx("textarea",{value:t.rules,onChange:o=>s("rules",o.target.value),placeholder:"Never auto-restart failed workflows. Always escalate to humans.",rows:4,className:`${v} resize-none`}),e.jsx("p",{className:f,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Ce({form:t,set:s}){const{data:o}=xe(),l=(o==null?void 0:o.domains)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Assign a knowledge domain — the agent's memory. It stores context here over time."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:knowledge"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Knowledge",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:t.knowledge_domain,onChange:d=>s("knowledge_domain",d.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:v,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:l.map(d=>e.jsx("option",{value:d.domain},d.domain))}),e.jsx("p",{className:f,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:l.map(d=>e.jsxs("button",{type:"button",onClick:()=>s("knowledge_domain",d.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${t.knowledge_domain===d.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(L,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:d.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[d.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(pe,{date:d.latest})})]},d.domain))})]})]})}const Se={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"};function Ae({form:t,set:s}){const{data:o}=Q(),{data:l}=he({limit:200}),d=(l==null?void 0:l.topics)??[],h=(o??[]).filter(a=>a.invocable).map(a=>a.workflow_type),[i,j]=g.useState(0),x=(a,m,S)=>{const W=[...t.subscriptions];W[a]={...W[a],[m]:S},s("subscriptions",W)},w=()=>{s("subscriptions",[...t.subscriptions,{...fe}]),j(t.subscriptions.length)},_=a=>{s("subscriptions",t.subscriptions.filter((m,S)=>S!==a)),i>=t.subscriptions.length-1&&j(Math.max(0,t.subscriptions.length-2))},r=t.subscriptions,c=r[i],n=a=>!!a.topic&&(a.reaction_type==="durable"?!!a.workflow_type:a.reaction_type==="pipeline"?!!a.pipeline_id:!!a.mcp_prompt),p=c?d.find(a=>a.topic===c.topic):void 0;return r.length===0?e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the agent runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(z,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:w,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx($,{className:"w-3.5 h-3.5"})," Add first subscription"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the agent runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[r.map((a,m)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${i===m?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>j(m),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${n(a)?"bg-emerald-400":"bg-zinc-500"}`}),e.jsx("span",{className:"text-[11px] font-mono truncate",children:a.topic||"new subscription"})]}),e.jsxs("span",{className:"text-[9px] text-text-quaternary ml-3",children:["→ ",a.workflow_type||a.reaction_type]})]}),e.jsx("button",{onClick:S=>{S.stopPropagation(),confirm(`Remove subscription "${a.topic||"new"}"?
|
|
2
2
|
|
|
3
3
|
This takes effect when you save.`)&&_(m)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(B,{className:"w-3 h-3"})})]},m)),e.jsxs("button",{onClick:w,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx($,{className:"w-3 h-3"})," Add"]})]}),c&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:k,children:"When this event fires"}),e.jsx(Pe,{value:c.topic,onChange:a=>x(i,"topic",a),topics:d}),(p==null?void 0:p.payload_schema)&&e.jsxs("div",{className:"mt-3 p-3 rounded-md bg-surface-sunken border border-surface-border",children:[e.jsx("p",{className:"text-[10px] text-text-quaternary mb-1 uppercase tracking-wider font-medium",children:"Payload Schema"}),e.jsx("pre",{className:"text-[11px] font-mono text-text-secondary whitespace-pre-wrap overflow-x-auto max-h-40",children:JSON.stringify(p.payload_schema.properties??p.payload_schema,null,2)}),p.description&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-2 italic",children:p.description})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("label",{className:k,children:"Run this workflow"}),e.jsx("div",{className:"flex gap-3",children:["durable","pipeline","mcp_query"].map(a=>e.jsxs("label",{className:"flex items-center gap-1 text-[11px] text-text-secondary cursor-pointer",children:[e.jsx("input",{type:"radio",name:"reaction",checked:c.reaction_type===a,onChange:()=>x(i,"reaction_type",a),className:"accent-accent w-3 h-3"}),a==="durable"?"Workflow":a==="pipeline"?"Pipeline":"MCP Query"]},a))}),c.reaction_type==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Workflow *"}),e.jsxs("select",{value:c.workflow_type,onChange:a=>x(i,"workflow_type",a.target.value),className:v,children:[e.jsx("option",{value:"",children:"Select..."}),h.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),c.reaction_type==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Pipeline ID *"}),e.jsx("input",{type:"text",value:c.pipeline_id,onChange:a=>x(i,"pipeline_id",a.target.value),placeholder:"UUID",className:`${v} font-mono text-xs`})]}),c.reaction_type==="mcp_query"&&e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Prompt *"}),e.jsx("textarea",{value:c.mcp_prompt,onChange:a=>x(i,"mcp_prompt",a.target.value),placeholder:"Analyze the error...",rows:2,className:`${v} resize-none`})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:k,children:"As identity"}),e.jsx(H,{selected:c.execute_as,onChange:a=>x(i,"execute_as",a)}),e.jsx("p",{className:f,children:"Identity used when invoking the workflow."})]}),e.jsxs("div",{children:[e.jsx("label",{className:k,children:"But only if"}),e.jsx("input",{type:"text",value:c.filter,onChange:a=>x(i,"filter",a.target.value),placeholder:"No filter (all matching events)",className:`${v} font-mono text-xs`}),e.jsxs("p",{className:f,children:["JSON filter against event.data, e.g. ",'{"status": 422}']})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:k,children:"With this data"}),e.jsx("textarea",{value:c.input_mapping,onChange:a=>x(i,"input_mapping",a.target.value),rows:10,className:V,placeholder:`{
|
|
4
4
|
"data": {
|
|
@@ -10,4 +10,4 @@ This takes effect when you save.`)&&_(m)},className:"opacity-0 group-hover/sub:o
|
|
|
10
10
|
This takes effect when you save.`)&&_(p)},className:"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(B,{className:"w-3 h-3"})})]},p)),e.jsxs("button",{onClick:w,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx($,{className:"w-3 h-3"})," Add"]})]}),c&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:k,children:"Run every"}),e.jsx("input",{type:"text",value:c.cron,onChange:n=>x(i,"cron",n.target.value),placeholder:"0 * * * *",className:`${v} font-mono`}),c.cron&&e.jsx("p",{className:"text-[11px] text-accent/80 mt-1",children:D(c.cron)}),e.jsx("div",{className:"flex gap-3 mt-2 overflow-x-auto",children:We.map(n=>e.jsx("button",{type:"button",onClick:()=>x(i,"cron",n),className:`text-[10px] font-mono whitespace-nowrap transition-colors ${c.cron===n?"text-accent font-medium":"text-accent/50 hover:text-accent"}`,children:D(n)},n))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("label",{className:k,children:"Run this workflow"}),e.jsx("div",{className:"flex gap-3",children:["durable","pipeline"].map(n=>e.jsxs("label",{className:"flex items-center gap-1 text-[11px] text-text-secondary cursor-pointer",children:[e.jsx("input",{type:"radio",name:`sched-reaction-${i}`,checked:c.reaction_type===n,onChange:()=>x(i,"reaction_type",n),className:"accent-accent w-3 h-3"}),n==="durable"?"Workflow":"Pipeline"]},n))}),c.reaction_type==="pipeline"?e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Pipeline *"}),e.jsxs("select",{value:c.pipeline_id,onChange:n=>x(i,"pipeline_id",n.target.value),className:v,children:[e.jsx("option",{value:"",children:"Select..."}),h.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))]}),e.jsx("p",{className:f,children:"YAML pipeline invoked on each cron tick."})]}):e.jsxs("div",{children:[e.jsx("label",{className:b,children:"Workflow *"}),e.jsxs("select",{value:c.workflow_type,onChange:n=>x(i,"workflow_type",n.target.value),className:v,children:[e.jsx("option",{value:"",children:"Select..."}),l.map(n=>e.jsx("option",{value:n,children:n},n))]}),e.jsx("p",{className:f,children:"Invoked on each cron tick."})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:k,children:"As identity"}),e.jsx(H,{selected:c.execute_as,onChange:n=>x(i,"execute_as",n)}),e.jsx("p",{className:f,children:"Identity used when invoking."})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:k,children:"With this data"}),e.jsx("textarea",{value:c.envelope,onChange:n=>x(i,"envelope",n.target.value),rows:10,className:V,placeholder:`{
|
|
11
11
|
"data": { "source": "cron" }
|
|
12
12
|
}`}),e.jsx("p",{className:f,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function R({icon:t,color:s,title:o,children:l}){return e.jsxs("div",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 pb-1.5 border-b border-surface-border/40",children:[e.jsx(t,{className:`w-3.5 h-3.5 ${s}`,strokeWidth:1.5}),e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-widest text-accent/80",children:o})]}),e.jsx("div",{className:"pl-5.5",children:l})]})}function E({label:t,children:s}){return e.jsxs("div",{className:"flex gap-3 py-0.5",children:[e.jsx("span",{className:"text-[10px] text-text-quaternary w-20 shrink-0",children:t}),e.jsx("span",{className:"text-xs text-text-primary",children:s})]})}function Re({form:t}){return e.jsxs("div",{children:[e.jsxs(R,{icon:G,color:"text-accent",title:"Identity",children:[e.jsx(E,{label:"Name",children:t.name||"—"}),t.description&&e.jsx(E,{label:"Description",children:t.description})]}),(t.goals||t.rules)&&e.jsxs(R,{icon:K,color:"text-rose-400",title:"Motivation",children:[t.goals&&e.jsx(E,{label:"Goals",children:t.goals}),t.rules&&e.jsx(E,{label:"Rules",children:t.rules})]}),e.jsx(R,{icon:L,color:"text-emerald-400",title:"Knowledge",children:e.jsx(E,{label:"Domain",children:t.knowledge_domain||"None"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-10",children:[e.jsx(R,{icon:z,color:"text-cyan-400",title:`Subscriptions (${t.subscriptions.length})`,children:t.subscriptions.length===0?e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"None configured"}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:t.subscriptions.map((s,o)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ue,{topic:s.topic||"unset"})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-[10px]",children:"→"}),s.workflow_type?e.jsx(F,{type:s.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:s.reaction_type})]})]},o))})}),e.jsx(R,{icon:U,color:"text-amber-400",title:`Schedules (${t.schedules.length})`,children:t.schedules.length===0?e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"None configured"}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:t.schedules.map((s,o)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ne,{cron:s.cron})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-[10px]",children:"→"}),s.workflow_type?e.jsx(F,{type:s.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"no workflow"})]})]},o))})})]}),e.jsx("div",{className:"border-l-2 border-emerald-400/30 pl-3 py-2 mt-6",children:e.jsx("p",{className:"text-[11px] text-text-tertiary leading-relaxed",children:"After saving, subscriptions and schedules activate immediately. You can pause the agent anytime."})})]})}const Ee=[{id:1,label:"Identity",icon:G},{id:2,label:"Motivation",icon:K},{id:3,label:"Knowledge",icon:L},{id:4,label:"Subscriptions",icon:z},{id:5,label:"Schedules",icon:U},{id:6,label:"Review",icon:de}];function Qe(){const{id:t}=ve(),s=!t,o=je(),{data:l,isLoading:d}=te(s?null:t),{data:h}=ie(s?null:t),i=se(),j=ae(),x=le(),w=ce(),_=re(),[r,c]=g.useState(J),[n,p]=g.useState(!1),[a,m]=g.useState(""),[S,W]=ge(),A=parseInt(S.get("step")||"1",10),X=g.useCallback(u=>{W(y=>{const C=new URLSearchParams(y);return C.set("step",String(u)),C},{replace:!0})},[W]);g.useEffect(()=>{if(!n){if(s){c(J),p(!0);return}l&&h&&(c(be(l,h.subscriptions??[])),p(!0))}},[l,h,s,n]);const q=(u,y)=>c(C=>({...C,[u]:y})),Z=async()=>{m("");try{const u=we(r);let y=t;s?y=(await i.mutateAsync(u)).id:await j.mutateAsync({id:t,...u});const C=Ne(r),ee=(h==null?void 0:h.subscriptions)??[],I=new Set(ee.map(N=>N.id));for(const N of C)if(N.id&&I.has(N.id)){const{id:T,...O}=N;await w.mutateAsync({agentId:y,subId:T,...O}),I.delete(T)}else{const{id:T,...O}=N;await x.mutateAsync({agentId:y,...O})}for(const N of I)await _.mutateAsync({agentId:y,subId:N});o(`/agents/${y}`)}catch(u){m(u.message)}};if(!s&&d)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-60 bg-surface-sunken rounded"})]});const Y=i.isPending||j.isPending;return e.jsxs("div",{children:[e.jsx(oe,{title:s?"New Agent":`Agent: ${(l==null?void 0:l.id)??""}`,docsHash:"#docs:agents.md"}),e.jsxs("div",{className:"flex gap-10",children:[e.jsxs("nav",{className:"w-44 shrink-0 sticky top-0 self-start pt-2",children:[e.jsx("div",{className:"space-y-0.5",children:Ee.map(u=>{const y=u.icon,C=A===u.id;return e.jsxs("button",{onClick:()=>X(u.id),className:`w-full flex items-center gap-2.5 px-3 py-2 rounded-md text-left transition-colors ${C?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(y,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-xs font-medium",children:u.label})]},u.id)})}),e.jsxs("div",{className:"mt-8 pt-4 border-t border-surface-border space-y-2",children:[e.jsx("button",{onClick:Z,disabled:!r.name.trim()||Y,className:"w-full btn-primary text-xs disabled:opacity-50",children:Y?"Saving...":s?"Create Agent":"Save"}),e.jsx("button",{onClick:()=>o(s?"/agents":`/agents/${t}`),className:"w-full btn-ghost text-xs",children:"Cancel"})]}),a&&e.jsx("p",{className:"text-xs text-status-error mt-3",children:a})]}),e.jsxs("div",{className:"flex-1 min-w-0 pt-2",children:[A===1&&e.jsx(ke,{form:r,set:q}),A===2&&e.jsx(_e,{form:r,set:q}),A===3&&e.jsx(Ce,{form:r,set:q}),A===4&&e.jsx(Ae,{form:r,set:q}),A===5&&e.jsx(qe,{form:r,set:q}),A===6&&e.jsx(Re,{form:r})]})]})]})}export{Qe as AgentConfigPage};
|
|
13
|
-
//# sourceMappingURL=AgentConfigPage-
|
|
13
|
+
//# sourceMappingURL=AgentConfigPage-D52KyJY-.js.map
|