@agiflowai/hooks-adapter 0.0.17 → 0.0.19
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/dist/index.cjs +25 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +25 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -607,6 +607,31 @@ var ExecutionLogService = class ExecutionLogService {
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
/**
|
|
610
|
+
* Check if a file has changed since the most recent review in this session.
|
|
611
|
+
* Reviews are executions with an allow/deny decision and a stored checksum.
|
|
612
|
+
*/
|
|
613
|
+
async hasFileChangedSinceLastReview(filePath) {
|
|
614
|
+
try {
|
|
615
|
+
const entries = await this.loadLog();
|
|
616
|
+
let lastReview = null;
|
|
617
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
618
|
+
const entry = entries[i];
|
|
619
|
+
const isReviewDecision = entry.decision === "allow" || entry.decision === "deny";
|
|
620
|
+
if (entry.filePath === filePath && isReviewDecision && entry.fileChecksum) {
|
|
621
|
+
lastReview = entry;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (!lastReview?.fileChecksum) return true;
|
|
626
|
+
const currentMetadata = await this.getFileMetadata(filePath);
|
|
627
|
+
if (!currentMetadata) return true;
|
|
628
|
+
return currentMetadata.checksum !== lastReview.fileChecksum;
|
|
629
|
+
} catch (error) {
|
|
630
|
+
console.error(`Error checking if file changed since last review for ${filePath}:`, error);
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
610
635
|
* Check if file was recently reviewed (within debounce window)
|
|
611
636
|
* Prevents noisy feedback during rapid successive edits
|
|
612
637
|
*
|
package/dist/index.d.cts
CHANGED
|
@@ -499,6 +499,11 @@ declare class ExecutionLogService {
|
|
|
499
499
|
* @returns true if file has changed or no previous execution found, true on error (fail-open)
|
|
500
500
|
*/
|
|
501
501
|
hasFileChanged(filePath: string, decision: Decision): Promise<boolean>;
|
|
502
|
+
/**
|
|
503
|
+
* Check if a file has changed since the most recent review in this session.
|
|
504
|
+
* Reviews are executions with an allow/deny decision and a stored checksum.
|
|
505
|
+
*/
|
|
506
|
+
hasFileChangedSinceLastReview(filePath: string): Promise<boolean>;
|
|
502
507
|
/**
|
|
503
508
|
* Check if file was recently reviewed (within debounce window)
|
|
504
509
|
* Prevents noisy feedback during rapid successive edits
|
package/dist/index.d.mts
CHANGED
|
@@ -499,6 +499,11 @@ declare class ExecutionLogService {
|
|
|
499
499
|
* @returns true if file has changed or no previous execution found, true on error (fail-open)
|
|
500
500
|
*/
|
|
501
501
|
hasFileChanged(filePath: string, decision: Decision): Promise<boolean>;
|
|
502
|
+
/**
|
|
503
|
+
* Check if a file has changed since the most recent review in this session.
|
|
504
|
+
* Reviews are executions with an allow/deny decision and a stored checksum.
|
|
505
|
+
*/
|
|
506
|
+
hasFileChangedSinceLastReview(filePath: string): Promise<boolean>;
|
|
502
507
|
/**
|
|
503
508
|
* Check if file was recently reviewed (within debounce window)
|
|
504
509
|
* Prevents noisy feedback during rapid successive edits
|
package/dist/index.mjs
CHANGED
|
@@ -576,6 +576,31 @@ var ExecutionLogService = class ExecutionLogService {
|
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
578
|
/**
|
|
579
|
+
* Check if a file has changed since the most recent review in this session.
|
|
580
|
+
* Reviews are executions with an allow/deny decision and a stored checksum.
|
|
581
|
+
*/
|
|
582
|
+
async hasFileChangedSinceLastReview(filePath) {
|
|
583
|
+
try {
|
|
584
|
+
const entries = await this.loadLog();
|
|
585
|
+
let lastReview = null;
|
|
586
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
587
|
+
const entry = entries[i];
|
|
588
|
+
const isReviewDecision = entry.decision === "allow" || entry.decision === "deny";
|
|
589
|
+
if (entry.filePath === filePath && isReviewDecision && entry.fileChecksum) {
|
|
590
|
+
lastReview = entry;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (!lastReview?.fileChecksum) return true;
|
|
595
|
+
const currentMetadata = await this.getFileMetadata(filePath);
|
|
596
|
+
if (!currentMetadata) return true;
|
|
597
|
+
return currentMetadata.checksum !== lastReview.fileChecksum;
|
|
598
|
+
} catch (error) {
|
|
599
|
+
console.error(`Error checking if file changed since last review for ${filePath}:`, error);
|
|
600
|
+
return true;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
579
604
|
* Check if file was recently reviewed (within debounce window)
|
|
580
605
|
* Prevents noisy feedback during rapid successive edits
|
|
581
606
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agiflowai/hooks-adapter",
|
|
3
3
|
"description": "Hook adapters for normalizing AI agent hook formats (Claude Code, Gemini, etc.)",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.19",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"author": "AgiflowIO",
|
|
7
7
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agiflowai/
|
|
29
|
-
"@agiflowai/
|
|
28
|
+
"@agiflowai/coding-agent-bridge": "1.0.21",
|
|
29
|
+
"@agiflowai/aicode-utils": "1.0.18"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.0.0",
|