Open source CapCut alternative.
TypeScript
docs: document task lifecycle — follow-up injection, concurrency, auto-resume, timedOut
David Le37f3b0f12e88
diff --git a/docs/guides/agent-harness.md b/docs/guides/agent-harness.mdindex 5c3f9041..cd60cc2d 100644--- a/docs/guides/agent-harness.md+++ b/docs/guides/agent-harness.md@@ -57,10 +57,15 @@ Every task carries its own durable state:- plan, tool history, and pending continuation- granted permissions- lifecycle status (running, paused, `waitingForUser`, `waitingForPermission`,- interrupted, resuming, completed, failed-safe, cancelled)+ interrupted, resuming, completed, failed-safe, timed-out, cancelled)State is task-local. Pausing, clarifying, gating, interrupting, or cancelling-one task never touches another.+one task never touches another — and because each task runs its own loop, several+tasks make progress side by side. A new request that continues a task already+running is folded into that task's loop and picked up at its next step rather+than restarting it; an unrelated request starts a new task that runs alongside.+A task whose loop is torn down before it finishes (it hit the step ceiling, or+the app quit mid-run) is left retryable, not failed.Storage keeps decisions inspectable:diff --git a/docs/guides/harness-deep-dive.md b/docs/guides/harness-deep-dive.mdindex c4fe2514..943aa5c7 100644--- a/docs/guides/harness-deep-dive.md+++ b/docs/guides/harness-deep-dive.md@@ -12,6 +12,39 @@ proposes an action and protected code carries it out, and a step counts as doneonly once something checks that it worked. Anything that needs a brand-new ruleof its own does not belong here.+## Task Lifecycle After the First Turn++A task is not over when its first run stops, and a running task is not sealed off+from further input. Three mechanics keep the lifecycle honest.++**Follow-up injection.** When the user sends a request while a task's loop is+still running, the request is queued onto that task. The loop drains the queue at+the top of each step and folds the text into the task's world model, so the next+planning step incorporates it. The goal and the work so far are untouched — the+agent keeps going with one more instruction, the way a queued message works in a+chat. This is deliberately the opposite of changing course, which would replace+the goal and re-plan; a follow-up only ever reaches a stopped task that way.+Whether a request is a follow-up to a specific task is decided by the typed+follow-up boundary, never by matching the text itself.++**Concurrency.** Each task runs its own loop, and a loop releases control on every+await it makes for the model or a tool, so several tasks advance together. Two+unrelated requests become two tasks running at once rather than one stealing the+other. Background turns — the default — drive their target by process id without+raising an app or taking the cursor, so they never contend; only a foreground+turn needs the visible screen, and foreground turns take a single focus token in+turn so two of them never fight over the front window.++**Resuming and timing out.** Pausing a task, or quitting the app, tears its loop+down; there is no suspended loop to pick back up, so resuming re-runs the task's+existing goal as a fresh loop. The stored world model and history carry the+context forward, so it continues rather than starting over. A run that stops+without finishing — it hit the step ceiling, or the app quit under it — is marked+timed out rather than failed, because the goal still stands; the user can resume+it. On relaunch, a task that was actively running moments earlier resumes on its+own in the background; one interrupted longer ago, or one that was waiting on the+user, comes back as a row the user resumes with a tap.+## Working With FilesFile work splits into two parts. Understanding a file — figuring out what isdiff --git a/docs/guides/notch.md b/docs/guides/notch.mdindex 19dbcf5b..1333f333 100644--- a/docs/guides/notch.md+++ b/docs/guides/notch.md@@ -49,7 +49,7 @@ The chin is the strip that drops below the real notch while a task is streaming.## Streaming and the Queue-Tasks form a queue, and the collapsed notch narrates that queue one update at a time.+Tasks run in parallel — several can be working at once — and the collapsed notch narrates them one update at a time. A new request that continues a task already running is folded into that task instead of starting another; an unrelated request starts a new task that runs alongside.1. **New tasks join the front.** Submitting from either input prepends a running task so it is visible first.2. **Running tasks stream updates.** Every couple of seconds the chin advances to the next running task's latest update.@@ -66,7 +66,7 @@ Two inputs add to the same queue: the centered composer summoned by double-tappi## Task States-A task is always in one of three states, and the available controls follow from the state. A running task finishes on its own after about three minutes.+A task is always in one of three states, and the available controls follow from the state.| State | Pointer | Controls | Clock || --- | --- | --- | --- |@@ -76,6 +76,10 @@ A task is always in one of three states, and the available controls follow from**Stop is a pause.** Stopping freezes the clock and keeps the task in the list; resume returns it to running. Close removes the task. A done task cannot resume — it can only be closed.+**Stopped covers more than a pause.** A task also lands here when it runs long enough to hit its step ceiling (it reads as *timed out*) or when the app quits mid-run. All of these keep the task and its progress, so Resume picks the work back up — resuming re-runs the original goal with the work so far carried forward, not from scratch.++**Relaunch.** Reopening the app does not strand in-progress work. A task that was actively running moments before the app closed resumes on its own in the background. One that was interrupted longer ago, timed out, or was waiting on you comes back as a stopped row you resume with a tap.+## NotificationsThree notification kinds surface on the notch, each tied to a condition. In the collapsed right gutter they share one slot by priority: attention first, then the running clock, then permissions, then update. When expanded they move to the right-gutter action, where permissions outranks update.