vibe-coding-master 0.2.9 → 0.2.10

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.
package/README.md CHANGED
@@ -548,6 +548,7 @@ When it is on, VCM is in auto mode:
548
548
  - Just before terminal submission, VCM records `dispatchingAt`, waits briefly for the GUI to switch tabs, then writes to the embedded terminal.
549
549
  - After successful terminal write, VCM snapshots the delivered body as message history.
550
550
  - Claude Code `UserPromptSubmit` confirms that the prompt was accepted; VCM stores `acceptedAt` and clears the source route file if it still contains the same message.
551
+ - If `UserPromptSubmit` does not confirm the auto-delivered message, VCM retries Enter from the backend PTY and finally records `failureReason` on the message if submission is still not confirmed.
551
552
  - When the GUI observes a newly dispatching auto message, it switches the active role tab to that message's target role before the message is submitted.
552
553
  - VCM enforces sequential turn-taking from hook state: a role that has accepted a prompt is busy until its `Stop` hook fires.
553
554
  - Additional pending files to a busy target role remain non-empty and are not written to that terminal.
@@ -9,10 +9,18 @@ const PM_ROLE = "project-manager";
9
9
  const PM_TO_ROLE_TYPES = new Set(["task", "question", "review-request", "revise", "cancel"]);
10
10
  const ROLE_TO_PM_TYPES = new Set(["result", "question", "blocked", "finding"]);
11
11
  const DEFAULT_PRE_DISPATCH_SWITCH_DELAY_MS = 500;
12
+ const DEFAULT_AUTO_DISPATCH_ENTER_DELAY_MS = 500;
13
+ const DEFAULT_DISPATCH_CONFIRMATION_RETRY_DELAYS_MS = [1500, 3000];
14
+ const DEFAULT_DISPATCH_CONFIRMATION_FAILURE_DELAY_MS = 3000;
15
+ const DISPATCH_NOT_CONFIRMED_REASON = "Auto orchestration pasted the message, but Claude Code did not confirm submission. Press Enter in the target terminal or resend the route message.";
12
16
  export function createMessageService(deps) {
13
17
  const now = deps.now ?? (() => new Date().toISOString());
14
18
  const id = deps.id ?? (() => `msg_${randomUUID()}`);
15
19
  const preDispatchSwitchDelayMs = deps.preDispatchSwitchDelayMs ?? DEFAULT_PRE_DISPATCH_SWITCH_DELAY_MS;
20
+ const autoDispatchEnterDelayMs = deps.autoDispatchEnterDelayMs ?? DEFAULT_AUTO_DISPATCH_ENTER_DELAY_MS;
21
+ const dispatchConfirmationEnabled = deps.dispatchConfirmationEnabled ?? true;
22
+ const dispatchConfirmationRetryDelaysMs = deps.dispatchConfirmationRetryDelaysMs ?? DEFAULT_DISPATCH_CONFIRMATION_RETRY_DELAYS_MS;
23
+ const dispatchConfirmationFailureDelayMs = deps.dispatchConfirmationFailureDelayMs ?? DEFAULT_DISPATCH_CONFIRMATION_FAILURE_DELAY_MS;
16
24
  const taskLocks = new Map();
17
25
  async function getOrchestrationState(input) {
18
26
  const statePath = getOrchestrationStatePath(getStateRepoRoot(input), input.stateRoot, input.taskSlug);
@@ -101,8 +109,11 @@ export function createMessageService(deps) {
101
109
  ...message,
102
110
  deliveredAt: timestamp
103
111
  };
104
- await submitTerminalInput(deps.runtime, session.id, renderMessageEnvelope(delivered));
112
+ await submitTerminalInput(deps.runtime, session.id, renderMessageEnvelope(delivered), {
113
+ enterDelayMs: autoDispatchEnterDelayMs
114
+ });
105
115
  await deps.sessionService.markRoleActivityRunning(input.repoRoot, input.taskSlug, routeFile.toRole);
116
+ scheduleDispatchConfirmation(input, delivered, session.id);
106
117
  return {
107
118
  message: delivered,
108
119
  delivered: true,
@@ -185,6 +196,53 @@ export function createMessageService(deps) {
185
196
  return next;
186
197
  }
187
198
  };
199
+ function scheduleDispatchConfirmation(input, message, sessionId) {
200
+ if (!dispatchConfirmationEnabled) {
201
+ return;
202
+ }
203
+ void monitorDispatchConfirmation(input, message, sessionId).catch(() => undefined);
204
+ }
205
+ async function monitorDispatchConfirmation(input, message, sessionId) {
206
+ for (const retryDelayMs of dispatchConfirmationRetryDelaysMs) {
207
+ await delay(retryDelayMs);
208
+ const current = await readMessageById(input, message.id);
209
+ if (!current || current.acceptedAt) {
210
+ return;
211
+ }
212
+ try {
213
+ deps.runtime.write(sessionId, "\r");
214
+ }
215
+ catch (error) {
216
+ await markDispatchConfirmationFailure(input, message.id, `Auto orchestration could not retry Enter: ${errorMessage(error)}`);
217
+ return;
218
+ }
219
+ }
220
+ await delay(dispatchConfirmationFailureDelayMs);
221
+ const current = await readMessageById(input, message.id);
222
+ if (!current || current.acceptedAt) {
223
+ return;
224
+ }
225
+ await markDispatchConfirmationFailure(input, message.id, DISPATCH_NOT_CONFIRMED_REASON);
226
+ }
227
+ async function readMessageById(input, messageId) {
228
+ return withTaskLock(taskLocks, getMessagesPath(getStateRepoRoot(input), input.stateRoot, input.taskSlug), async () => {
229
+ const messages = await readLatestMessages(deps.fs, getMessagesPath(getStateRepoRoot(input), input.stateRoot, input.taskSlug));
230
+ return messages.find((message) => message.id === messageId);
231
+ });
232
+ }
233
+ async function markDispatchConfirmationFailure(input, messageId, failureReason) {
234
+ await withTaskLock(taskLocks, getMessagesPath(getStateRepoRoot(input), input.stateRoot, input.taskSlug), async () => {
235
+ const messages = await readLatestMessages(deps.fs, getMessagesPath(getStateRepoRoot(input), input.stateRoot, input.taskSlug));
236
+ const current = messages.find((message) => message.id === messageId);
237
+ if (!current || current.acceptedAt) {
238
+ return;
239
+ }
240
+ await appendMessageSnapshot(deps.fs, input, {
241
+ ...current,
242
+ failureReason
243
+ });
244
+ });
245
+ }
188
246
  }
189
247
  function toRouteContext(input) {
190
248
  return {
@@ -423,3 +481,6 @@ function delay(ms) {
423
481
  }
424
482
  return new Promise((resolve) => setTimeout(resolve, ms));
425
483
  }
484
+ function errorMessage(error) {
485
+ return error instanceof Error ? error.message : String(error);
486
+ }
@@ -802,6 +802,7 @@ VCM V1 is successful when:
802
802
  - Manual orchestration lets the user inspect pending route-file messages without auto-submitting Enter.
803
803
  - Auto orchestration can deliver pending route-file messages to idle running target roles.
804
804
  - Auto orchestration switches to the target role tab when VCM records `dispatchingAt`, before VCM submits the route-file message.
805
+ - Auto orchestration treats `UserPromptSubmit` as the reliable acceptance confirmation; if confirmation does not arrive, backend PTY retries Enter and records a message `failureReason` after retry exhaustion.
805
806
  - Round completion detection waits for the final role in a chained conversation and can alert with prompt plus sound.
806
807
  - Translation settings save to `~/.vcm/settings.json`.
807
808
  - Translation reads Claude transcript JSONL reliably after start, resume, and restart.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-coding-master",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Local GUI session cockpit for Claude Code role sessions.",
5
5
  "type": "module",
6
6
  "files": [