feat(ui): start tasks from the dashboard and slim it to activity and setup

This commit is contained in:
sam committed 2026-10-14 23:28:37 +11:00
1 parent c1554d63c0
commit 88ef6ca5b2
23 files changed
+297 -487

No files matched your search

@@ -1,17 +1,10 @@
<script setup lang="ts">
import { useRouter } from "vue-router";
import { Plus } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import NewTaskForm from "./NewTaskForm.vue";
const props = defineProps<{ workflow?: string; instructions?: string }>();
const router = useRouter();
const open = defineModel<boolean>("open", { default: false });
@@ -23,14 +16,17 @@ function started(taskId: number) {
<template>
<Dialog v-model:open="open">
<DialogTrigger as-child>
<Button size="sm"><Plus data-icon="inline-start" />New task</Button>
</DialogTrigger>
<DialogContent class="sm:max-w-[640px]">
<DialogHeader>
<DialogTitle>New task</DialogTitle>
</DialogHeader>
<NewTaskForm v-if="open" @started="started" @cancel="open = false" />
<NewTaskForm
v-if="open"
:initial-workflow="props.workflow"
:initial-instructions="props.instructions"
@started="started"
@cancel="open = false"
/>
</DialogContent>
</Dialog>
</template>
+6 -3
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { firstLine } from "./first-line";
import { computed, onMounted, ref, useId, watchEffect } from "vue";
import { ChevronRight } from "@lucide/vue";
import { RadioGroupItem, RadioGroupRoot } from "reka-ui";
@@ -30,6 +31,8 @@ import {
const props = defineProps<{
/** Starts this workflow, with no chooser. */ workflow?: string;
/** An unsaved definition of `workflow` to test-run instead of the stored one. */ draft?: string;
/** Preselected in the chooser, as the dashboard's quick start hands over. */ initialWorkflow?: string;
initialInstructions?: string;
}>();
const emit = defineEmits<{ started: [taskId: number]; cancel: [] }>();
const uid = useId();
@@ -57,9 +60,9 @@ identities.watchIdentities();
const actors = computed(() => identities.identities.filter((i) => i.kind !== "system" && i.lifecycle === "active"));
const repository = ref("");
const workflow = ref(props.workflow ?? "");
const title = ref("");
const instructions = ref("");
const workflow = ref(props.workflow ?? props.initialWorkflow ?? "");
const instructions = ref(props.initialInstructions ?? "");
const title = ref(firstLine(instructions.value));
const identity = ref("");
// One text field per declared input, by input name: the chosen workflow's
// declaration decides what is rendered and what the request carries.
+5
View File
@@ -0,0 +1,5 @@
/** firstLine is a prompt's first line, cut to a title's length. */
export function firstLine(text: string): string {
const line = text.trim().split("\n", 1)[0] ?? "";
return line.length > 80 ? `${line.slice(0, 79)}…` : line;
}