| 58 | } |
| 59 | |
| 60 | function sourceForTurn(type: OpenADETurnStartRequest["type"], label?: string): OpenADEActionEventSource { |
| 61 | const userLabel = label || type |
| 62 | switch (type) { |
| 63 | case "plan": |
| 64 | return { type: "plan", userLabel } |
| 65 | case "do": |
| 66 | return { type: "do", userLabel } |
| 67 | case "ask": |
| 68 | return { type: "ask", userLabel } |
| 69 | case "revise": |
| 70 | return { type: "revise", userLabel, parentEventId: "headless" } |
| 71 | case "run_plan": |
| 72 | return { type: "run_plan", userLabel, planEventId: "headless" } |
| 73 | case "hyperplan": |
| 74 | return { type: "hyperplan", userLabel, strategyId: "headless" } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | function fallbackTitle(input: string): string { |
| 79 | const cleaned = input.replace(/\s+/g, " ").trim() |