Turn Instruction into a chat with an agent that asks

The Instruction page is now a conversation with the Express Agent. Each
message updates the draft plan, and when something is unclear (a part it
did not understand, a video count with no cadence, a schedule over 50 per
week, weekly research with no day, a missing topic) the agent asks right
in the chat, one question at a time, with replies to pick or type. Once
the plan is clear it offers to start the schedules and reports the result
in the chat. The plan stays editable beside the chat.

The chat text is also larger and darker than the mockup's 9-11px grey.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Iqbal
2026-10-23 11:23:47 +07:00
parent e00ffe9465
commit 2b37d80e26
7 changed files with 409 additions and 82 deletions

View File

@@ -61,6 +61,8 @@ export interface ResearchRule {
weekday: number
topic: string
autoApprove: boolean
/** Weekly research whose instruction named no day, so Monday is only a default the agent asks about. */
weekdayGuessed?: boolean
}
export type Rule = ContentRule | ResearchRule
@@ -87,13 +89,13 @@ function countOf(clause: string, kindAt: number): number {
return (word && NUMBER_WORDS[word]) || 1
}
function perOf(clause: string): Per | 'month' {
export function perOf(clause: string): Per | 'month' {
if (/\b(per ?hari|tiap hari|setiap hari|sehari|harian|per day|a day|every day|each day|daily)\b/.test(clause)) return 'day'
if (/\b(per ?bulan|tiap bulan|setiap bulan|sebulan|bulanan|per month|a month|every month|each month|monthly)\b/.test(clause)) return 'month'
return 'week'
}
function weekdayOf(clause: string): number | null {
export function weekdayOf(clause: string): number | null {
for (const [re, day] of WEEKDAYS) if (re.test(clause)) return day
return null
}
@@ -108,7 +110,9 @@ function parseClause(clause: string): Rule | null {
const per = perOf(clause)
const day = weekdayOf(clause)
const cadence = per === 'day' && day === null ? 'daily' : 'weekly'
return { type: 'research', cadence, weekday: day ?? 0, topic: topicOf(clause), autoApprove: true }
const rule: ResearchRule = { type: 'research', cadence, weekday: day ?? 0, topic: topicOf(clause), autoApprove: true }
if (cadence === 'weekly' && day === null) rule.weekdayGuessed = true
return rule
}
for (const [kind, re] of KIND_WORDS) {
const m = re.exec(clause)