feat: add relation wording schema
ci / test (push) Failing after 2m24s

This commit is contained in:
Test
2026-09-05 05:45:47 -07:00
parent a461e9799a
commit 84b4ca120f
3 changed files with 51 additions and 20 deletions
+49 -18
View File
@@ -19,14 +19,34 @@ type CanvasReasonerInput struct {
AuthToken string `json:"auth_token,omitempty"` // JWT for LLM calls AuthToken string `json:"auth_token,omitempty"` // JWT for LLM calls
} }
// RelationWording describes semantic meaning of an edge
type RelationWording struct {
Verb string `json:"verb"` // outputs, inputs, depends-on, etc
SourceOutput string `json:"source_output"` // What source produces
TargetInput string `json:"target_input"` // What target requires
ConnectionType string `json:"connection_type"` // direct-map, requires-transformer, conditional
Confidence float64 `json:"confidence"` // 0.0-1.0
SemanticMatch string `json:"semantic_match"` // Human-readable explanation
TransformerNeeded string `json:"transformer_needed,omitempty"` // If transformation required
}
// EdgeWithWording pairs an edge with its semantic description
type EdgeWithWording struct {
Source string `json:"source"`
Target string `json:"target"`
RelationType string `json:"relation_type"` // data-flow, dependency, conditional, parallel
RelationLabel string `json:"relation_label"` // e.g., "CloneRepo outputs path → AnalyzeCode requires path"
RelationWording RelationWording `json:"relation_wording"`
}
// CanvasReasonerOutput returns suggested edges and reasoning // CanvasReasonerOutput returns suggested edges and reasoning
type CanvasReasonerOutput struct { type CanvasReasonerOutput struct {
SuggestedEdges []db.WorkflowEdge `json:"suggested_edges"` // New edges to add SuggestedEdges []EdgeWithWording `json:"suggested_edges"` // Edges with wording
RemovedEdges []db.WorkflowEdge `json:"removed_edges,omitempty"` // Edges to remove (if redesign) RemovedEdges []db.WorkflowEdge `json:"removed_edges,omitempty"` // Edges to remove
Reasoning string `json:"reasoning"` // LLM explanation Reasoning string `json:"reasoning"` // LLM explanation
Confidence float64 `json:"confidence"` // 0.0-1.0 Confidence float64 `json:"confidence"` // 0.0-1.0
IncompatibleEdges []IncompatibilityWarning `json:"incompatible_edges,omitempty"` // Edges that can't be created IncompatibleEdges []IncompatibilityWarning `json:"incompatible_edges,omitempty"` // Can't connect
DisconnectedNodes []string `json:"disconnected_nodes,omitempty"` // Nodes with no connections DisconnectedNodes []string `json:"disconnected_nodes,omitempty"` // No connections
UserAlerts []string `json:"user_alerts,omitempty"` // Human-readable warnings UserAlerts []string `json:"user_alerts,omitempty"` // Human-readable warnings
} }
@@ -48,23 +68,34 @@ func CanvasReasonerActivity(ctx context.Context, in CanvasReasonerInput) (Canvas
nodeDesc := buildNodeDescriptions(in.Nodes) nodeDesc := buildNodeDescriptions(in.Nodes)
edgeDesc := buildEdgeDescriptions(in.Edges) edgeDesc := buildEdgeDescriptions(in.Edges)
// Create prompt for LLM reasoning with compatibility guidance // Create prompt for LLM reasoning with relation wording
systemPrompt := `You are a workflow automation expert. Analyze the following activities and suggest logical connections (edges) between them based on: systemPrompt := `You are a workflow automation expert. Analyze activities and suggest logical connections with semantic descriptions.
1. Activity input/output compatibility (CRITICAL - only connect if outputs match inputs)
2. Logical execution order and data flow
3. Required dependencies
4. Common workflow patterns
IMPORTANT: Only suggest edges where: CRITICAL RULES:
- Source activity has outputs (check "outputs" fields) 1. Only suggest edges where outputs→inputs match
- Target activity has inputs (check "inputs" fields) 2. Provide relation wording: verb, source_output, target_input
- Data types are compatible (string→string, object→object, etc) 3. Assess connection confidence (0.0-1.0)
- Connection makes semantic sense (don't connect a notifier to an analyzer) 4. Flag type mismatches that need transformers
Respond with JSON containing: Respond with JSON:
{ {
"edges": [{"source": "node-1", "target": "node-2"}, ...], "edges": [
"reasoning": "explanation of why these connections make sense and any type mismatches noted", {
"source": "node-1",
"target": "node-2",
"relation_type": "data-flow|dependency|conditional|parallel",
"relation_label": "Node1 outputs X → Node2 requires X",
"relation_wording": {
"verb": "outputs|depends-on|triggers|etc",
"source_output": "field_name (type): description",
"target_input": "field_name (type, required?): description",
"connection_type": "direct-map|requires-transformer|conditional",
"confidence": 0.95,
"semantic_match": "Explanation of why this makes sense"
}
}
],
"reasoning": "Overall workflow structure explanation",
"confidence": 0.85 "confidence": 0.85
}` }`
+1 -1
View File
@@ -9,6 +9,6 @@ metadata:
app.kubernetes.io/name: poimen app.kubernetes.io/name: poimen
app.kubernetes.io/component: orchestrator app.kubernetes.io/component: orchestrator
data: data:
GIT_COMMIT: "64fa03cae" # Updated automatically by CI/CD GIT_COMMIT: "eb4c4e989" # Updated automatically by CI/CD
GIT_BRANCH: "main" GIT_BRANCH: "main"
DEPLOYMENT_DATE: "2026-09-05" DEPLOYMENT_DATE: "2026-09-05"
+1 -1
View File
@@ -13,7 +13,7 @@ spec:
labels: labels:
app: poimen-worker app: poimen-worker
annotations: annotations:
git-commit: "64fa03cae" # ✅ Updated on each push, triggers rolling restart git-commit: "eb4c4e989" # ✅ Updated on each push, triggers rolling restart
deployment-date: "2026-09-05" deployment-date: "2026-09-05"
spec: spec:
containers: containers: