@hasna/hooks 0.3.1 → 0.3.2
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/bin/index.js +2 -2
- package/dist/index.js +2 -2
- package/hooks/hook-knowledge-context/README.md +1 -1
- package/hooks/hook-knowledge-context/package.json +1 -1
- package/hooks/hook-knowledge-context/src/hook.test.ts +6 -1
- package/hooks/hook-knowledge-context/src/hook.ts +1 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -2089,7 +2089,7 @@ var init_registry = __esm(() => {
|
|
|
2089
2089
|
name: "knowledge-context",
|
|
2090
2090
|
displayName: "Knowledge Context",
|
|
2091
2091
|
description: "Injects deterministic Knowledge context packs into Codewith SessionStart, UserPromptSubmit, and SubagentStart",
|
|
2092
|
-
version: "0.1.
|
|
2092
|
+
version: "0.1.1",
|
|
2093
2093
|
category: "Context Management",
|
|
2094
2094
|
event: "SessionStart",
|
|
2095
2095
|
events: ["SessionStart", "UserPromptSubmit", "SubagentStart"],
|
|
@@ -4126,7 +4126,7 @@ function codewithMatcher(matcher) {
|
|
|
4126
4126
|
function codewithTimeout(name) {
|
|
4127
4127
|
switch (name) {
|
|
4128
4128
|
case "knowledge-context":
|
|
4129
|
-
return
|
|
4129
|
+
return 6;
|
|
4130
4130
|
case "session-start":
|
|
4131
4131
|
return 8;
|
|
4132
4132
|
case "pre-bash":
|
package/dist/index.js
CHANGED
|
@@ -1010,7 +1010,7 @@ var HOOKS = [
|
|
|
1010
1010
|
name: "knowledge-context",
|
|
1011
1011
|
displayName: "Knowledge Context",
|
|
1012
1012
|
description: "Injects deterministic Knowledge context packs into Codewith SessionStart, UserPromptSubmit, and SubagentStart",
|
|
1013
|
-
version: "0.1.
|
|
1013
|
+
version: "0.1.1",
|
|
1014
1014
|
category: "Context Management",
|
|
1015
1015
|
event: "SessionStart",
|
|
1016
1016
|
events: ["SessionStart", "UserPromptSubmit", "SubagentStart"],
|
|
@@ -1452,7 +1452,7 @@ function codewithMatcher(matcher) {
|
|
|
1452
1452
|
function codewithTimeout(name) {
|
|
1453
1453
|
switch (name) {
|
|
1454
1454
|
case "knowledge-context":
|
|
1455
|
-
return
|
|
1455
|
+
return 6;
|
|
1456
1456
|
case "session-start":
|
|
1457
1457
|
return 8;
|
|
1458
1458
|
case "pre-bash":
|
|
@@ -39,7 +39,7 @@ bad stdin, or empty packs return `{"continue":true}` without context.
|
|
|
39
39
|
```bash
|
|
40
40
|
export HOOKS_KNOWLEDGE_CONTEXT_DISABLE=1 # Kill switch
|
|
41
41
|
export HOOKS_KNOWLEDGE_COMMAND=knowledge # CLI command/path
|
|
42
|
-
export HOOKS_KNOWLEDGE_TIMEOUT_MS=
|
|
42
|
+
export HOOKS_KNOWLEDGE_TIMEOUT_MS=5000 # Per-call timeout
|
|
43
43
|
export HOOKS_KNOWLEDGE_MAX_ITEMS=6 # Context pack item budget
|
|
44
44
|
export HOOKS_KNOWLEDGE_MAX_TOKENS=1200 # Context pack token budget
|
|
45
45
|
export HOOKS_KNOWLEDGE_MAX_QUERY_CHARS=1200 # Redacted query bound
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
const baseConfig: KnowledgeContextConfig = {
|
|
15
15
|
command: "knowledge",
|
|
16
|
-
timeoutMs:
|
|
16
|
+
timeoutMs: 5000,
|
|
17
17
|
maxItems: 6,
|
|
18
18
|
maxTokens: 1200,
|
|
19
19
|
maxQueryChars: 1200,
|
|
@@ -21,6 +21,11 @@ const baseConfig: KnowledgeContextConfig = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
describe("hook-knowledge-context", () => {
|
|
24
|
+
test("defaults Knowledge CLI timeout to 5000ms and keeps env override", () => {
|
|
25
|
+
expect(getConfig({}).timeoutMs).toBe(5000);
|
|
26
|
+
expect(getConfig({ HOOKS_KNOWLEDGE_TIMEOUT_MS: "2345" }).timeoutMs).toBe(2345);
|
|
27
|
+
});
|
|
28
|
+
|
|
24
29
|
test("builds deterministic knowledge context pack args without semantic, web, or generation flags", () => {
|
|
25
30
|
const args = buildKnowledgeArgs("repo hook context", baseConfig);
|
|
26
31
|
|
|
@@ -55,7 +55,7 @@ export type KnowledgeExecutor = (
|
|
|
55
55
|
config: KnowledgeContextConfig
|
|
56
56
|
) => Promise<KnowledgeExecResult>;
|
|
57
57
|
|
|
58
|
-
const DEFAULT_TIMEOUT_MS =
|
|
58
|
+
const DEFAULT_TIMEOUT_MS = 5000;
|
|
59
59
|
const DEFAULT_MAX_ITEMS = 6;
|
|
60
60
|
const DEFAULT_MAX_TOKENS = 1200;
|
|
61
61
|
const DEFAULT_MAX_QUERY_CHARS = 1200;
|
package/package.json
CHANGED