@mindstudio-ai/remy 0.1.148 → 0.1.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ ---
2
+ trigger: approveInitialPlan
3
+ next: buildFromInitialSpec
4
+ ---
5
+
6
+ The user has approved your initial plan. Time to bring it to life.
7
+
8
+ First, call `setProjectOnboardingState({ state: "building" })` to transition the UI.
9
+
10
+ Then, write the full spec. Follow the instructions in <spec_authoring_instructions> to write all spec files: app.md, web.md, brand (visual.md, colors.md, typography.md, voice.md), and any others the project needs. Consult the design expert for brand and visual direction. Be thorough: the spec drives everything downstream.
11
+
12
+ As the final step of spec authoring, call `productVision` to seed the initial roadmap and generate the pitch deck.
13
+
14
+ When all spec files are written and the roadmap is seeded, end the turn. The build will start automatically.
@@ -3,9 +3,7 @@
3
3
  next: postBuildPolish
4
4
  ---
5
5
 
6
- This is an automated action triggered by the user pressing "Build" in the editor after reviewing the spec.
7
-
8
- The user has reviewed the spec and is ready to build. There are three phases: planning, coding, and verifying. Execute each phase in order in a single turn.
6
+ This is the code generation phase. The spec is written. Build everything now in three phases: planning, coding, and verifying. Execute each phase in order in a single turn.
9
7
 
10
8
  ## Planning
11
9
  Think about your approach and then get a quick sanity check from `codeSanityCheck` to make sure you aren't missing anything.
@@ -22,3 +20,7 @@ Then, build everything in one turn: tables, methods, interfaces, manifest update
22
20
  - If the app has a web frontend, check the browser logs to make sure there are no errors rendering it.
23
21
  - Use `runAutomatedBrowserTest` to smoke-test the main UI flow. The dev database is a disposable snapshot, so don't worry about being destructive. Fix any errors before finishing.
24
22
  - If there is a scenario that seeds the app with mock data, use it to present the app to the user with initial data seeded, so they can see and play with the real app. Let the user know they can reset the app using a scenario to empty it if they wish. Showing the user something they can play with immediately is important when it comes to landing a strong first impression.
23
+
24
+ ## When you are done
25
+
26
+ End this turn cleanly once verification passes. Do not finalize or clean up — another chained phase handles that. You are not the last step in the pipeline.
@@ -14,3 +14,7 @@ Then, put together a plan to build out the feature. Write the plan with `writePl
14
14
  When they've approved the plan, be sure to update the spec first - remember, the spec is the source of truth about the product. Then, build everything in one turn, using the spec as the master plan.
15
15
 
16
16
  When you're finished building, verify your work and give the user a summary of what was done.
17
+
18
+ ## When you are done
19
+
20
+ End this turn cleanly once verification passes. Do not finalize or clean up — another chained phase handles that. You are not the last step in the pipeline.
@@ -14,5 +14,5 @@ When you have finished, ask the `visualDesignExpert` to take a screenshot and ve
14
14
  ## Finalizing
15
15
  When everything is working and polished:
16
16
  1. Use `productVision` to mark the MVP roadmap item as done.
17
- 2. Call `setProjectOnboardingState({ state: "onboardingFinished" })`.
18
- 3. Call `compactConversation` to summarize the build session and free up context for the next phase of work.
17
+ 2. Call `compactConversation` to summarize the build session and free up context for the next phase of work.
18
+ 3. Call `setProjectOnboardingState({ state: "buildComplete" })`. This triggers the reveal experience on the frontend, where the user sees the pitch deck and their finished app for the first time.
@@ -19,6 +19,95 @@ interface HeadlessOptions {
19
19
  model?: string;
20
20
  lspUrl?: string;
21
21
  }
22
- declare function startHeadless(opts?: HeadlessOptions): Promise<void>;
22
+ /**
23
+ * Encapsulates all state and behavior for a headless session. State is
24
+ * held on instance fields (not closure variables) so mutations are
25
+ * explicit and greppable. Callbacks passed to external code
26
+ * (onEvent, onBackgroundComplete, resolveExternalTool, handleStdinLine,
27
+ * shutdown) are arrow-method fields so `this` is preserved.
28
+ */
29
+ declare class HeadlessSession {
30
+ private opts;
31
+ private config;
32
+ private state;
33
+ private sessionStats;
34
+ private running;
35
+ private currentAbort;
36
+ /** RequestId of the in-flight message command — injected into streamed events. */
37
+ private currentRequestId;
38
+ /** Guard: track whether terminal `completed` was already sent so we emit exactly one. */
39
+ private completedEmitted;
40
+ private turnStart;
41
+ /**
42
+ * Onboarding state of the currently-running turn. Captured at runSingleTurn
43
+ * start so onBackgroundComplete can enqueue background results with the
44
+ * right state (the triggering turn's state, not a stale one).
45
+ */
46
+ private currentOnboardingState;
47
+ /**
48
+ * Unified message queue. Holds pending work to deliver after the current
49
+ * turn completes: chained automated actions, background sub-agent results,
50
+ * and user messages sent while a turn is running. Strict FIFO. Persisted
51
+ * to .remy-stats.json so queued work survives process restarts.
52
+ */
53
+ private queue;
54
+ private pendingTools;
55
+ private earlyResults;
56
+ private pendingBlockUpdates;
57
+ private toolRegistry;
58
+ private readline;
59
+ constructor(opts?: HeadlessOptions);
60
+ start(): Promise<void>;
61
+ private shutdown;
62
+ private emit;
63
+ /**
64
+ * Emit a `completed` event and mark completedEmitted. Includes
65
+ * `queuedMessages` if the queue has items (sandbox uses this to know the
66
+ * agent is still busy with pipeline work).
67
+ */
68
+ private emitCompleted;
69
+ /** Returns `{ queuedMessages }` when the queue is non-empty, else empty object. */
70
+ private queueFields;
71
+ /** Dispatch a simple (non-streaming) command: call handler, emit response + completed. */
72
+ private dispatchSimple;
73
+ /** Persist sessionStats + queue snapshot to .remy-stats.json. */
74
+ private persistStats;
75
+ /** Apply queued tool block updates to state.messages. Safe to call any time. */
76
+ private applyPendingBlockUpdates;
77
+ /** Drain pending compaction summaries and insert at a safe point. */
78
+ private applyPendingSummaries;
79
+ private onBackgroundComplete;
80
+ private resolveExternalTool;
81
+ private onEvent;
82
+ /**
83
+ * Run one turn (without acquiring the `running` lock). Called by
84
+ * handleMessage for the initial turn, then repeatedly for each queued
85
+ * message — `running` stays held across the queue drain so no user
86
+ * message can slip in mid-pipeline.
87
+ */
88
+ private runSingleTurn;
89
+ private handleMessage;
90
+ /**
91
+ * Drain the queue in strict FIFO order. Caller must hold `running = true`.
92
+ * User messages arriving during the drain will be enqueued behind current items.
93
+ */
94
+ private drainQueueLoop;
95
+ /**
96
+ * Resume draining the queue when the agent is idle. Acquires the lock,
97
+ * drains, releases. Used by the `resume` stdin action (sandbox-initiated)
98
+ * and by kickDrain (background-completion-initiated).
99
+ */
100
+ private resumeQueue;
101
+ /**
102
+ * Kick off drainage of the queue when the agent is idle. Used by
103
+ * onBackgroundComplete (when !running) to deliver results without
104
+ * racing any currently-synchronous path.
105
+ */
106
+ private kickDrain;
107
+ private handleClear;
108
+ /** Cancel the running turn and drain the queue. Returns the drained items. */
109
+ private handleCancel;
110
+ private handleStdinLine;
111
+ }
23
112
 
24
- export { type HeadlessOptions, startHeadless };
113
+ export { type HeadlessOptions, HeadlessSession };