vibe-coding-master 0.4.11 → 0.4.12
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.
|
@@ -40,7 +40,6 @@ const VCM_HOOK_DEFINITIONS = [
|
|
|
40
40
|
{ eventName: "Stop", command: VCM_STOP_HOOK_COMMAND, timeout: 10 },
|
|
41
41
|
{ eventName: "StopFailure", command: VCM_HOOK_COMMAND, timeout: 5 },
|
|
42
42
|
{ eventName: "PostCompact", command: VCM_HOOK_COMMAND, timeout: 5 },
|
|
43
|
-
{ eventName: "CwdChanged", command: VCM_HOOK_COMMAND, timeout: 5 },
|
|
44
43
|
{ eventName: "PermissionRequest", command: VCM_PERMISSION_REQUEST_HOOK_COMMAND, timeout: 5 }
|
|
45
44
|
];
|
|
46
45
|
const AGENT_FRONTMATTER = {
|
|
@@ -261,29 +261,6 @@ export function createClaudeHookService(deps) {
|
|
|
261
261
|
dispatchedCount: 0
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
async function processCwdChangedHook(input) {
|
|
265
|
-
const eventName = parseHookEvent(input.event.hook_event_name);
|
|
266
|
-
if (eventName !== "CwdChanged") {
|
|
267
|
-
throwUnsupportedEvent(eventName);
|
|
268
|
-
}
|
|
269
|
-
const context = await getHookContext(input);
|
|
270
|
-
const session = await deps.sessionService.recordClaudeHookEvent(context.project.repoRoot, {
|
|
271
|
-
taskSlug: context.taskSlug,
|
|
272
|
-
role: input.role,
|
|
273
|
-
eventName,
|
|
274
|
-
claudeSessionId: stringOrUndefined(input.event.session_id),
|
|
275
|
-
transcriptPath: stringOrUndefined(input.event.transcript_path),
|
|
276
|
-
cwd: stringOrUndefined(input.event.cwd) ?? stringOrUndefined(input.event.new_cwd)
|
|
277
|
-
});
|
|
278
|
-
return {
|
|
279
|
-
ok: true,
|
|
280
|
-
eventName,
|
|
281
|
-
taskSlug: context.taskSlug,
|
|
282
|
-
role: input.role,
|
|
283
|
-
sessionUpdated: Boolean(session),
|
|
284
|
-
dispatchedCount: 0
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
264
|
async function recordTurnEnd(input, context, eventName, options) {
|
|
288
265
|
const scopedRouteDispatchInput = createRouteDispatchInput(input, context, input.role);
|
|
289
266
|
const settleRouteDispatchInput = createRouteDispatchInput(input, context);
|
|
@@ -454,9 +431,6 @@ export function createClaudeHookService(deps) {
|
|
|
454
431
|
if (eventName === "PostCompact") {
|
|
455
432
|
return processPostCompactHook(input);
|
|
456
433
|
}
|
|
457
|
-
if (eventName === "CwdChanged") {
|
|
458
|
-
return processCwdChangedHook(input);
|
|
459
|
-
}
|
|
460
434
|
// Legacy combined endpoint: the installed hook discards the response,
|
|
461
435
|
// so a block decision could not be enforced. Never block here.
|
|
462
436
|
return processStopHook(input, { allowBlock: false });
|
|
@@ -477,15 +451,14 @@ function parseHookEvent(value) {
|
|
|
477
451
|
if (value === "UserPromptSubmit"
|
|
478
452
|
|| value === "Stop"
|
|
479
453
|
|| value === "StopFailure"
|
|
480
|
-
|| value === "PostCompact"
|
|
481
|
-
|| value === "CwdChanged") {
|
|
454
|
+
|| value === "PostCompact") {
|
|
482
455
|
return value;
|
|
483
456
|
}
|
|
484
457
|
throw new VcmError({
|
|
485
458
|
code: "HOOK_EVENT_UNSUPPORTED",
|
|
486
459
|
message: `Unsupported Claude Code hook event: ${String(value)}`,
|
|
487
460
|
statusCode: 400,
|
|
488
|
-
hint: "VCM accepts UserPromptSubmit, Stop, StopFailure,
|
|
461
|
+
hint: "VCM accepts UserPromptSubmit, Stop, StopFailure, and PostCompact hooks only."
|
|
489
462
|
});
|
|
490
463
|
}
|
|
491
464
|
function throwUnsupportedEvent(eventName) {
|
|
@@ -41,7 +41,6 @@ const VCM_HOOK_DEFINITIONS = [
|
|
|
41
41
|
{ eventName: "Stop", command: VCM_STOP_HOOK_COMMAND, timeout: 10 },
|
|
42
42
|
{ eventName: "StopFailure", command: VCM_HOOK_COMMAND, timeout: 5 },
|
|
43
43
|
{ eventName: "PostCompact", command: VCM_HOOK_COMMAND, timeout: 5 },
|
|
44
|
-
{ eventName: "CwdChanged", command: VCM_HOOK_COMMAND, timeout: 5 },
|
|
45
44
|
{ eventName: "PermissionRequest", command: VCM_PERMISSION_REQUEST_HOOK_COMMAND, timeout: 5 }
|
|
46
45
|
];
|
|
47
46
|
const HARNESS_FILES = [
|
|
@@ -1421,7 +1420,7 @@ async function clearHarnessBootstrapRunState(fs, repoRoot) {
|
|
|
1421
1420
|
await fs.removePath?.(resolveHarnessPath(repoRoot, BOOTSTRAP_SESSION_PATH), { force: true });
|
|
1422
1421
|
}
|
|
1423
1422
|
function isHarnessBootstrapHookEvent(value) {
|
|
1424
|
-
return value === "Stop" || value === "StopFailure" || value === "UserPromptSubmit" || value === "PostCompact"
|
|
1423
|
+
return value === "Stop" || value === "StopFailure" || value === "UserPromptSubmit" || value === "PostCompact";
|
|
1425
1424
|
}
|
|
1426
1425
|
function matchesBootstrapRunState(state, input) {
|
|
1427
1426
|
if (state.sessionId && input.sessionId && state.sessionId !== input.sessionId) {
|
|
@@ -394,9 +394,6 @@ export function createSessionService(deps) {
|
|
|
394
394
|
cwd: targetCwd,
|
|
395
395
|
previousCwd: session.cwd,
|
|
396
396
|
transcriptPath: claudeTranscriptPath(targetCwd, session.claudeSessionId),
|
|
397
|
-
cwdMigrationTarget: targetCwd,
|
|
398
|
-
cwdMigrationPending: true,
|
|
399
|
-
lastCwdMigrationAt: timestamp,
|
|
400
397
|
updatedAt: timestamp
|
|
401
398
|
};
|
|
402
399
|
deps.registry.upsert(normalizeProjectScopedRecordForPersistence(updated));
|
|
@@ -681,19 +678,16 @@ export function createSessionService(deps) {
|
|
|
681
678
|
const timestamp = now();
|
|
682
679
|
const isTurnEnd = isTurnEndHook(input.eventName);
|
|
683
680
|
const isCompact = isCompactHook(input.eventName);
|
|
684
|
-
const isCwdChanged = isCwdChangedHook(input.eventName);
|
|
685
681
|
const updated = {
|
|
686
682
|
...current,
|
|
687
683
|
claudeSessionId: input.sessionId ?? current.claudeSessionId,
|
|
688
684
|
transcriptPath: input.transcriptPath ?? current.transcriptPath,
|
|
689
685
|
cwd: input.cwd ?? current.cwd,
|
|
690
|
-
activityStatus: isTurnEnd ? "idle" :
|
|
686
|
+
activityStatus: isTurnEnd ? "idle" : isCompact ? current.activityStatus : "running",
|
|
691
687
|
lastHookEventAt: timestamp,
|
|
692
688
|
lastTurnEndedAt: isTurnEnd ? timestamp : current.lastTurnEndedAt,
|
|
693
|
-
lastTurnStartedAt: isTurnEnd || isCompact
|
|
689
|
+
lastTurnStartedAt: isTurnEnd || isCompact ? current.lastTurnStartedAt : timestamp,
|
|
694
690
|
lastCompactAt: isCompact ? timestamp : current.lastCompactAt,
|
|
695
|
-
cwdMigrationPending: isCwdChanged ? false : current.cwdMigrationPending,
|
|
696
|
-
cwdMigrationTarget: isCwdChanged ? undefined : current.cwdMigrationTarget,
|
|
697
691
|
updatedAt: timestamp
|
|
698
692
|
};
|
|
699
693
|
deps.registry.upsert(updated);
|
|
@@ -808,19 +802,16 @@ export function createSessionService(deps) {
|
|
|
808
802
|
const timestamp = now();
|
|
809
803
|
const isTurnEnd = isTurnEndHook(input.eventName);
|
|
810
804
|
const isCompact = isCompactHook(input.eventName);
|
|
811
|
-
const isCwdChanged = isCwdChangedHook(input.eventName);
|
|
812
805
|
const updated = {
|
|
813
806
|
...current,
|
|
814
807
|
claudeSessionId: input.sessionId ?? current.claudeSessionId,
|
|
815
808
|
transcriptPath: input.transcriptPath ?? current.transcriptPath,
|
|
816
809
|
cwd: input.cwd ?? current.cwd,
|
|
817
|
-
activityStatus: isTurnEnd ? "idle" :
|
|
810
|
+
activityStatus: isTurnEnd ? "idle" : isCompact ? current.activityStatus : "running",
|
|
818
811
|
lastHookEventAt: timestamp,
|
|
819
812
|
lastTurnEndedAt: isTurnEnd ? timestamp : current.lastTurnEndedAt,
|
|
820
|
-
lastTurnStartedAt: isTurnEnd || isCompact
|
|
813
|
+
lastTurnStartedAt: isTurnEnd || isCompact ? current.lastTurnStartedAt : timestamp,
|
|
821
814
|
lastCompactAt: isCompact ? timestamp : current.lastCompactAt,
|
|
822
|
-
cwdMigrationPending: isCwdChanged ? false : current.cwdMigrationPending,
|
|
823
|
-
cwdMigrationTarget: isCwdChanged ? undefined : current.cwdMigrationTarget,
|
|
824
815
|
updatedAt: timestamp
|
|
825
816
|
};
|
|
826
817
|
deps.registry.upsert(updated);
|
|
@@ -994,20 +985,17 @@ export function createSessionService(deps) {
|
|
|
994
985
|
const timestamp = now();
|
|
995
986
|
const isTurnEnd = isTurnEndHook(input.eventName);
|
|
996
987
|
const isCompact = isCompactHook(input.eventName);
|
|
997
|
-
const isCwdChanged = isCwdChangedHook(input.eventName);
|
|
998
988
|
const updated = {
|
|
999
989
|
...current,
|
|
1000
990
|
taskSlug: PROJECT_GATE_REVIEWER_SCOPE,
|
|
1001
991
|
claudeSessionId: input.sessionId ?? current.claudeSessionId,
|
|
1002
992
|
transcriptPath: input.transcriptPath ?? current.transcriptPath,
|
|
1003
993
|
cwd: input.cwd ?? current.cwd,
|
|
1004
|
-
activityStatus: isTurnEnd ? "idle" :
|
|
994
|
+
activityStatus: isTurnEnd ? "idle" : isCompact ? current.activityStatus : "running",
|
|
1005
995
|
lastHookEventAt: timestamp,
|
|
1006
996
|
lastTurnEndedAt: isTurnEnd ? timestamp : current.lastTurnEndedAt,
|
|
1007
|
-
lastTurnStartedAt: isTurnEnd || isCompact
|
|
997
|
+
lastTurnStartedAt: isTurnEnd || isCompact ? current.lastTurnStartedAt : timestamp,
|
|
1008
998
|
lastCompactAt: isCompact ? timestamp : current.lastCompactAt,
|
|
1009
|
-
cwdMigrationPending: isCwdChanged ? false : current.cwdMigrationPending,
|
|
1010
|
-
cwdMigrationTarget: isCwdChanged ? undefined : current.cwdMigrationTarget,
|
|
1011
999
|
updatedAt: timestamp
|
|
1012
1000
|
};
|
|
1013
1001
|
deps.registry.upsert(updated);
|
|
@@ -1039,19 +1027,16 @@ export function createSessionService(deps) {
|
|
|
1039
1027
|
const timestamp = now();
|
|
1040
1028
|
const isTurnEnd = isTurnEndHook(input.eventName);
|
|
1041
1029
|
const isCompact = isCompactHook(input.eventName);
|
|
1042
|
-
const isCwdChanged = isCwdChangedHook(input.eventName);
|
|
1043
1030
|
const updated = {
|
|
1044
1031
|
...current,
|
|
1045
1032
|
claudeSessionId: input.sessionId ?? current.claudeSessionId,
|
|
1046
1033
|
transcriptPath: input.transcriptPath ?? current.transcriptPath,
|
|
1047
1034
|
cwd: input.cwd ?? current.cwd,
|
|
1048
|
-
activityStatus: isTurnEnd ? "idle" :
|
|
1035
|
+
activityStatus: isTurnEnd ? "idle" : isCompact ? current.activityStatus : "running",
|
|
1049
1036
|
lastHookEventAt: timestamp,
|
|
1050
1037
|
lastTurnEndedAt: isTurnEnd ? timestamp : current.lastTurnEndedAt,
|
|
1051
|
-
lastTurnStartedAt: isTurnEnd || isCompact
|
|
1038
|
+
lastTurnStartedAt: isTurnEnd || isCompact ? current.lastTurnStartedAt : timestamp,
|
|
1052
1039
|
lastCompactAt: isCompact ? timestamp : current.lastCompactAt,
|
|
1053
|
-
cwdMigrationPending: isCwdChanged ? false : current.cwdMigrationPending,
|
|
1054
|
-
cwdMigrationTarget: isCwdChanged ? undefined : current.cwdMigrationTarget,
|
|
1055
1040
|
updatedAt: timestamp
|
|
1056
1041
|
};
|
|
1057
1042
|
deps.registry.upsert(updated);
|
|
@@ -1167,9 +1152,6 @@ function isTurnEndHook(eventName) {
|
|
|
1167
1152
|
function isCompactHook(eventName) {
|
|
1168
1153
|
return eventName === "PostCompact";
|
|
1169
1154
|
}
|
|
1170
|
-
function isCwdChangedHook(eventName) {
|
|
1171
|
-
return eventName === "CwdChanged";
|
|
1172
|
-
}
|
|
1173
1155
|
function getRecoverableStatus(record) {
|
|
1174
1156
|
if (!record.claudeSessionId) {
|
|
1175
1157
|
return record.status === "running" ? "missing" : record.status;
|