@honcho-ai/claude-honcho 0.3.2 → 0.3.4
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/.claude-plugin/plugin.json +1 -1
- package/dist/hooks/post-tool-use.js +16744 -41
- package/dist/hooks/post-tool-use.js.map +91 -5
- package/dist/hooks/pre-compact.js +16987 -49
- package/dist/hooks/pre-compact.js.map +92 -5
- package/dist/hooks/pre-tool-honcho.js +841 -10
- package/dist/hooks/pre-tool-honcho.js.map +10 -5
- package/dist/hooks/save-user-message.js +16570 -39
- package/dist/hooks/save-user-message.js.map +90 -6
- package/dist/hooks/session-end.js +1016 -20
- package/dist/hooks/session-end.js.map +12 -5
- package/dist/hooks/session-start.js +16993 -61
- package/dist/hooks/session-start.js.map +94 -6
- package/dist/hooks/stop.js +16732 -38
- package/dist/hooks/stop.js.map +91 -5
- package/dist/hooks/user-prompt.js +16774 -95
- package/dist/hooks/user-prompt.js.map +93 -6
- package/dist/mcp-server.js +16537 -128
- package/dist/mcp-server.js.map +88 -4
- package/dist/skills/backfill-runner.js +15904 -146
- package/dist/skills/backfill-runner.js.map +88 -7
- package/dist/skills/setup-runner.js +16344 -54
- package/dist/skills/setup-runner.js.map +90 -4
- package/dist/skills/status-runner.js +16195 -22
- package/dist/skills/status-runner.js.map +88 -4
- package/hooks/hooks.json +9 -9
- package/package.json +1 -1
- package/skills/status/SKILL.md +1 -1
- package/dist/chunk-1nsms6f4.js +0 -50
- package/dist/chunk-1nsms6f4.js.map +0 -10
- package/dist/chunk-1xa1wr00.js +0 -181
- package/dist/chunk-1xa1wr00.js.map +0 -11
- package/dist/chunk-43gww8dc.js +0 -35
- package/dist/chunk-43gww8dc.js.map +0 -10
- package/dist/chunk-81cb25yy.js +0 -35
- package/dist/chunk-81cb25yy.js.map +0 -9
- package/dist/chunk-acwn3613.js +0 -796
- package/dist/chunk-acwn3613.js.map +0 -13
- package/dist/chunk-d99xh4kg.js +0 -20
- package/dist/chunk-d99xh4kg.js.map +0 -10
- package/dist/chunk-g0m354bn.js +0 -15998
- package/dist/chunk-g0m354bn.js.map +0 -90
- package/dist/chunk-mm5vjhpr.js +0 -15564
- package/dist/chunk-mm5vjhpr.js.map +0 -87
- package/dist/chunk-pdnbydfe.js +0 -159
- package/dist/chunk-pdnbydfe.js.map +0 -11
- package/dist/chunk-qp4ng9m0.js +0 -146
- package/dist/chunk-qp4ng9m0.js.map +0 -10
- package/dist/chunk-w3tnmcx7.js +0 -261
- package/dist/chunk-w3tnmcx7.js.map +0 -10
package/hooks/hooks.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"type": "command",
|
|
14
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/session-start.js",
|
|
14
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/session-start.js\"",
|
|
15
15
|
"timeout": 30
|
|
16
16
|
}
|
|
17
17
|
]
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"hooks": [
|
|
23
23
|
{
|
|
24
24
|
"type": "command",
|
|
25
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/session-end.js",
|
|
25
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/session-end.js\"",
|
|
26
26
|
"timeout": 5
|
|
27
27
|
}
|
|
28
28
|
]
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"hooks": [
|
|
35
35
|
{
|
|
36
36
|
"type": "command",
|
|
37
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/post-tool-use.js",
|
|
37
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/post-tool-use.js\"",
|
|
38
38
|
"timeout": 10,
|
|
39
39
|
"async": true
|
|
40
40
|
}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"hooks": [
|
|
48
48
|
{
|
|
49
49
|
"type": "command",
|
|
50
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/pre-tool-honcho.js",
|
|
50
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/pre-tool-honcho.js\"",
|
|
51
51
|
"timeout": 4
|
|
52
52
|
}
|
|
53
53
|
]
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"hooks": [
|
|
59
59
|
{
|
|
60
60
|
"type": "command",
|
|
61
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/user-prompt.js",
|
|
61
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/user-prompt.js\"",
|
|
62
62
|
"timeout": 125
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"type": "command",
|
|
66
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/save-user-message.js",
|
|
66
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/save-user-message.js\"",
|
|
67
67
|
"timeout": 30,
|
|
68
68
|
"async": true
|
|
69
69
|
}
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"hooks": [
|
|
77
77
|
{
|
|
78
78
|
"type": "command",
|
|
79
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/pre-compact.js",
|
|
79
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/pre-compact.js\"",
|
|
80
80
|
"timeout": 20
|
|
81
81
|
}
|
|
82
82
|
]
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"hooks": [
|
|
87
87
|
{
|
|
88
88
|
"type": "command",
|
|
89
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/pre-compact.js",
|
|
89
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/pre-compact.js\"",
|
|
90
90
|
"timeout": 20
|
|
91
91
|
}
|
|
92
92
|
]
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"hooks": [
|
|
98
98
|
{
|
|
99
99
|
"type": "command",
|
|
100
|
-
"command": "node ${CLAUDE_PLUGIN_ROOT}/dist/hooks/stop.js",
|
|
100
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/hooks/stop.js\"",
|
|
101
101
|
"timeout": 10,
|
|
102
102
|
"async": true
|
|
103
103
|
}
|
package/package.json
CHANGED
package/skills/status/SKILL.md
CHANGED
package/dist/chunk-1nsms6f4.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// src/redact.ts
|
|
2
|
-
var DEFAULT_RULES = [
|
|
3
|
-
{
|
|
4
|
-
pattern: /\b(\w*(?:PASSWORD|PASSWD|PWD|SECRET|TOKEN|API_?KEY|ACCESS_KEY|CREDENTIALS?)\w*)\s*=\s*("[^"]*"|'[^']*'|[^\s;|&"']+)/gi,
|
|
5
|
-
replacement: "$1=***"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
pattern: /(--(?:password|passwd|pwd|token|api-?key|secret|auth)[= ])(?:"[^"]*"|'[^']*'|[^\s;|&"']+)/gi,
|
|
9
|
-
replacement: "$1***"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
pattern: /(authorization:\s*(?:bearer|basic|token)\s+)[^\s"']+/gi,
|
|
13
|
-
replacement: "$1***"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
pattern: /([a-z][a-z0-9+.-]*:\/\/[^/\s:@]+:)[^@\s]+@/gi,
|
|
17
|
-
replacement: "$1***@"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
pattern: /\b(?:hch[_-]?[A-Za-z0-9_-]{16,}|AKIA[0-9A-Z]{16}|sk-[A-Za-z0-9_-]{16,}|(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|glpat-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36})\b/g,
|
|
21
|
-
replacement: "***"
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
function validateRedactPattern(source) {
|
|
25
|
-
try {
|
|
26
|
-
new RegExp(source);
|
|
27
|
-
return null;
|
|
28
|
-
} catch (e) {
|
|
29
|
-
return `Invalid regex ${JSON.stringify(source)}: ${e instanceof Error ? e.message : String(e)}`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function redactSecrets(text, extraPatterns) {
|
|
33
|
-
let result = text;
|
|
34
|
-
for (const rule of DEFAULT_RULES) {
|
|
35
|
-
result = result.replace(rule.pattern, rule.replacement);
|
|
36
|
-
}
|
|
37
|
-
for (const source of extraPatterns ?? []) {
|
|
38
|
-
try {
|
|
39
|
-
result = result.replace(new RegExp(source, "gi"), "***");
|
|
40
|
-
} catch {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { validateRedactPattern, redactSecrets };
|
|
48
|
-
|
|
49
|
-
//# debugId=69506780623A432464756E2164756E21
|
|
50
|
-
//# sourceMappingURL=chunk-1nsms6f4.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/redact.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Best-effort secret redaction for tool-capture summaries.\n * Regex-based, so novel secret formats pass through; users extend the\n * defaults via the `redactPatterns` config.\n */\n\ninterface RedactRule {\n pattern: RegExp;\n replacement: string;\n}\n\nconst DEFAULT_RULES: RedactRule[] = [\n // KEY=value assignments with a secret-bearing key (PGPASSWORD=..., AWS_SECRET_ACCESS_KEY=...)\n {\n pattern: /\\b(\\w*(?:PASSWORD|PASSWD|PWD|SECRET|TOKEN|API_?KEY|ACCESS_KEY|CREDENTIALS?)\\w*)\\s*=\\s*(\"[^\"]*\"|'[^']*'|[^\\s;|&\"']+)/gi,\n replacement: \"$1=***\",\n },\n // --password / --token style CLI flags\n {\n pattern: /(--(?:password|passwd|pwd|token|api-?key|secret|auth)[= ])(?:\"[^\"]*\"|'[^']*'|[^\\s;|&\"']+)/gi,\n replacement: \"$1***\",\n },\n // Authorization headers\n {\n pattern: /(authorization:\\s*(?:bearer|basic|token)\\s+)[^\\s\"']+/gi,\n replacement: \"$1***\",\n },\n // Credentials embedded in URLs (scheme://user:pass@host)\n {\n pattern: /([a-z][a-z0-9+.-]*:\\/\\/[^/\\s:@]+:)[^@\\s]+@/gi,\n replacement: \"$1***@\",\n },\n // Well-known token shapes: Honcho, AWS, OpenAI/Anthropic-style sk-, GitHub, Slack, GitLab, npm\n {\n pattern: /\\b(?:hch[_-]?[A-Za-z0-9_-]{16,}|AKIA[0-9A-Z]{16}|sk-[A-Za-z0-9_-]{16,}|(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|glpat-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36})\\b/g,\n replacement: \"***\",\n },\n];\n\n/**\n * Validate a user-supplied pattern string. Returns an error message, or null\n * if it compiles. Used by set_config so bad regexes are rejected at write time.\n */\nexport function validateRedactPattern(source: string): string | null {\n try {\n new RegExp(source);\n return null;\n } catch (e) {\n return `Invalid regex ${JSON.stringify(source)}: ${e instanceof Error ? e.message : String(e)}`;\n }\n}\n\n/**\n * Redact secrets from `text`. `extraPatterns` (from config `redactPatterns`)\n * are additive to the built-in defaults; matches are replaced whole with ***.\n * Patterns that fail to compile are skipped — set_config validates on write,\n * so this only guards hand-edited config files.\n */\nexport function redactSecrets(text: string, extraPatterns?: string[]): string {\n let result = text;\n for (const rule of DEFAULT_RULES) {\n result = result.replace(rule.pattern, rule.replacement);\n }\n for (const source of extraPatterns ?? []) {\n try {\n result = result.replace(new RegExp(source, \"gi\"), \"***\");\n } catch {\n continue;\n }\n }\n return result;\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";AAWA,IAAM,gBAA8B;AAAA,EAElC;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AACF;AAMO,SAAS,qBAAqB,CAAC,QAA+B;AAAA,EACnE,IAAI;AAAA,IACF,IAAI,OAAO,MAAM;AAAA,IACjB,OAAO;AAAA,IACP,OAAO,GAAG;AAAA,IACV,OAAO,iBAAiB,KAAK,UAAU,MAAM,MAAM,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AAAA;AAAA;AAUzF,SAAS,aAAa,CAAC,MAAc,eAAkC;AAAA,EAC5E,IAAI,SAAS;AAAA,EACb,WAAW,QAAQ,eAAe;AAAA,IAChC,SAAS,OAAO,QAAQ,KAAK,SAAS,KAAK,WAAW;AAAA,EACxD;AAAA,EACA,WAAW,UAAU,iBAAiB,CAAC,GAAG;AAAA,IACxC,IAAI;AAAA,MACF,SAAS,OAAO,QAAQ,IAAI,OAAO,QAAQ,IAAI,GAAG,KAAK;AAAA,MACvD,MAAM;AAAA,MACN;AAAA;AAAA,EAEJ;AAAA,EACA,OAAO;AAAA;",
|
|
8
|
-
"debugId": "69506780623A432464756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/chunk-1xa1wr00.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isLoggingEnabled
|
|
3
|
-
} from "./chunk-acwn3613.js";
|
|
4
|
-
|
|
5
|
-
// src/log.ts
|
|
6
|
-
import { homedir } from "os";
|
|
7
|
-
import { join } from "path";
|
|
8
|
-
import { existsSync, appendFileSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
9
|
-
|
|
10
|
-
// src/unicode.ts
|
|
11
|
-
var blocks = {
|
|
12
|
-
full: String.fromCodePoint(9608),
|
|
13
|
-
upperHalf: String.fromCodePoint(9600),
|
|
14
|
-
lowerHalf: String.fromCodePoint(9604),
|
|
15
|
-
light: String.fromCodePoint(9617),
|
|
16
|
-
medium: String.fromCodePoint(9618),
|
|
17
|
-
dark: String.fromCodePoint(9619),
|
|
18
|
-
lower1_8: String.fromCodePoint(9601),
|
|
19
|
-
lower2_8: String.fromCodePoint(9602),
|
|
20
|
-
lower3_8: String.fromCodePoint(9603),
|
|
21
|
-
lower4_8: String.fromCodePoint(9604),
|
|
22
|
-
lower5_8: String.fromCodePoint(9605),
|
|
23
|
-
lower6_8: String.fromCodePoint(9606),
|
|
24
|
-
lower7_8: String.fromCodePoint(9607)
|
|
25
|
-
};
|
|
26
|
-
var circles = {
|
|
27
|
-
empty: String.fromCodePoint(9675),
|
|
28
|
-
filled: String.fromCodePoint(9679),
|
|
29
|
-
upperRight: String.fromCodePoint(9684),
|
|
30
|
-
rightHalf: String.fromCodePoint(9681),
|
|
31
|
-
lowerRight: String.fromCodePoint(9685),
|
|
32
|
-
leftHalf: String.fromCodePoint(9680),
|
|
33
|
-
upperHalf: String.fromCodePoint(9683),
|
|
34
|
-
lowerHalf: String.fromCodePoint(9682)
|
|
35
|
-
};
|
|
36
|
-
var stars = {
|
|
37
|
-
small: String.fromCodePoint(8902),
|
|
38
|
-
sparkle1: String.fromCodePoint(10023),
|
|
39
|
-
sparkle2: String.fromCodePoint(10022),
|
|
40
|
-
sparkle3: String.fromCodePoint(8889),
|
|
41
|
-
star6: String.fromCodePoint(10038),
|
|
42
|
-
star4: String.fromCodePoint(10036),
|
|
43
|
-
star8: String.fromCodePoint(10040)
|
|
44
|
-
};
|
|
45
|
-
var braille = {
|
|
46
|
-
wave: [
|
|
47
|
-
String.fromCodePoint(10494),
|
|
48
|
-
String.fromCodePoint(10487),
|
|
49
|
-
String.fromCodePoint(10479),
|
|
50
|
-
String.fromCodePoint(10463),
|
|
51
|
-
String.fromCodePoint(10367),
|
|
52
|
-
String.fromCodePoint(10431),
|
|
53
|
-
String.fromCodePoint(10491),
|
|
54
|
-
String.fromCodePoint(10493)
|
|
55
|
-
],
|
|
56
|
-
dots: [
|
|
57
|
-
String.fromCodePoint(10251),
|
|
58
|
-
String.fromCodePoint(10265),
|
|
59
|
-
String.fromCodePoint(10297),
|
|
60
|
-
String.fromCodePoint(10296),
|
|
61
|
-
String.fromCodePoint(10300),
|
|
62
|
-
String.fromCodePoint(10292),
|
|
63
|
-
String.fromCodePoint(10278),
|
|
64
|
-
String.fromCodePoint(10279),
|
|
65
|
-
String.fromCodePoint(10247),
|
|
66
|
-
String.fromCodePoint(10255)
|
|
67
|
-
]
|
|
68
|
-
};
|
|
69
|
-
var brackets = {
|
|
70
|
-
angleLeft: String.fromCodePoint(10216),
|
|
71
|
-
angleRight: String.fromCodePoint(10217)
|
|
72
|
-
};
|
|
73
|
-
var symbols = {
|
|
74
|
-
check: String.fromCodePoint(10003),
|
|
75
|
-
cross: String.fromCodePoint(10007),
|
|
76
|
-
dot: String.fromCodePoint(183),
|
|
77
|
-
bullet: String.fromCodePoint(8226),
|
|
78
|
-
arrow: String.fromCodePoint(8594),
|
|
79
|
-
line: String.fromCodePoint(9472),
|
|
80
|
-
corner: String.fromCodePoint(9492),
|
|
81
|
-
pipe: String.fromCodePoint(9474)
|
|
82
|
-
};
|
|
83
|
-
var arrows = {
|
|
84
|
-
right: String.fromCodePoint(8594),
|
|
85
|
-
left: String.fromCodePoint(8592),
|
|
86
|
-
up: String.fromCodePoint(8593),
|
|
87
|
-
down: String.fromCodePoint(8595),
|
|
88
|
-
rightDouble: String.fromCodePoint(8658),
|
|
89
|
-
leftDouble: String.fromCodePoint(8656),
|
|
90
|
-
rightHook: String.fromCodePoint(8618),
|
|
91
|
-
leftHook: String.fromCodePoint(8617)
|
|
92
|
-
};
|
|
93
|
-
var box = {
|
|
94
|
-
horizontal: String.fromCodePoint(9472),
|
|
95
|
-
vertical: String.fromCodePoint(9474),
|
|
96
|
-
topLeft: String.fromCodePoint(9484),
|
|
97
|
-
topRight: String.fromCodePoint(9488),
|
|
98
|
-
bottomLeft: String.fromCodePoint(9492),
|
|
99
|
-
bottomRight: String.fromCodePoint(9496),
|
|
100
|
-
branchRight: String.fromCodePoint(9500),
|
|
101
|
-
branchLeft: String.fromCodePoint(9508),
|
|
102
|
-
branchDown: String.fromCodePoint(9516),
|
|
103
|
-
branchUp: String.fromCodePoint(9524),
|
|
104
|
-
cross: String.fromCodePoint(9532),
|
|
105
|
-
cornerRight: String.fromCodePoint(9492)
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// src/log.ts
|
|
109
|
-
var CACHE_DIR = join(homedir(), ".honcho");
|
|
110
|
-
var LOG_FILE = join(CACHE_DIR, "activity.log");
|
|
111
|
-
var MAX_LOG_SIZE = 100 * 1024;
|
|
112
|
-
var sym = {
|
|
113
|
-
check: symbols.check,
|
|
114
|
-
cross: symbols.cross,
|
|
115
|
-
arrow: arrows.right,
|
|
116
|
-
dot: symbols.bullet,
|
|
117
|
-
circle: symbols.dot,
|
|
118
|
-
branch: box.branchRight,
|
|
119
|
-
corner: box.cornerRight,
|
|
120
|
-
pipe: box.vertical,
|
|
121
|
-
top: box.topRight,
|
|
122
|
-
line: box.horizontal
|
|
123
|
-
};
|
|
124
|
-
function ensureLogDir() {
|
|
125
|
-
if (!existsSync(CACHE_DIR)) {
|
|
126
|
-
mkdirSync(CACHE_DIR, { recursive: true });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
var currentCwd = null;
|
|
130
|
-
var currentSession = null;
|
|
131
|
-
function setLogContext(cwd, session) {
|
|
132
|
-
currentCwd = cwd;
|
|
133
|
-
currentSession = session || null;
|
|
134
|
-
}
|
|
135
|
-
function logActivity(level, source, message, data, options) {
|
|
136
|
-
if (!isLoggingEnabled())
|
|
137
|
-
return;
|
|
138
|
-
ensureLogDir();
|
|
139
|
-
const entry = {
|
|
140
|
-
timestamp: new Date().toISOString(),
|
|
141
|
-
level,
|
|
142
|
-
source,
|
|
143
|
-
message,
|
|
144
|
-
data,
|
|
145
|
-
timing: options?.timing,
|
|
146
|
-
success: options?.success,
|
|
147
|
-
depth: options?.depth ?? 0,
|
|
148
|
-
cwd: options?.cwd || currentCwd || undefined,
|
|
149
|
-
session: options?.session || currentSession || undefined
|
|
150
|
-
};
|
|
151
|
-
try {
|
|
152
|
-
if (existsSync(LOG_FILE)) {
|
|
153
|
-
const stats = statSync(LOG_FILE).size;
|
|
154
|
-
if (stats > MAX_LOG_SIZE) {
|
|
155
|
-
const content = readFileSync(LOG_FILE, "utf-8");
|
|
156
|
-
const truncated = content.slice(-50 * 1024);
|
|
157
|
-
writeFileSync(LOG_FILE, truncated);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
appendFileSync(LOG_FILE, JSON.stringify(entry) + `
|
|
161
|
-
`);
|
|
162
|
-
} catch {}
|
|
163
|
-
}
|
|
164
|
-
function logHook(hookName, message, data) {
|
|
165
|
-
logActivity("hook", hookName, message, data);
|
|
166
|
-
}
|
|
167
|
-
function logApiCall(endpoint, method, details, timing, success) {
|
|
168
|
-
const msg = `${method} ${endpoint}${details ? ` ${sym.arrow} ${details}` : ""}`;
|
|
169
|
-
logActivity("api", "honcho", msg, undefined, { timing, success });
|
|
170
|
-
}
|
|
171
|
-
function logFlow(stage, message, data) {
|
|
172
|
-
logActivity("flow", stage, message, data);
|
|
173
|
-
}
|
|
174
|
-
function logAsync(operation, message, results) {
|
|
175
|
-
logActivity("async", operation, message, results ? { results } : undefined);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export { blocks, circles, stars, braille, brackets, symbols, arrows, setLogContext, logHook, logApiCall, logFlow, logAsync };
|
|
179
|
-
|
|
180
|
-
//# debugId=ACAEB76FCF128E0164756E2164756E21
|
|
181
|
-
//# sourceMappingURL=chunk-1xa1wr00.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/log.ts", "../../src/unicode.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Activity logging for honcho plugin\n *\n * Designed to be:\n * - Educational: Show how honcho plugin architecture works\n * - Elegant: Visual hierarchy with consistent symbols\n * - Useful: Real-time debugging and demo capabilities\n */\n\nimport { homedir } from \"os\";\nimport { join } from \"path\";\nimport { existsSync, appendFileSync, mkdirSync, readFileSync, statSync, writeFileSync } from \"fs\";\nimport { symbols, arrows, box } from \"./unicode.js\";\nimport { isLoggingEnabled } from \"./config.js\";\n\nconst CACHE_DIR = join(homedir(), \".honcho\");\nconst LOG_FILE = join(CACHE_DIR, \"activity.log\");\nconst MAX_LOG_SIZE = 100 * 1024; // 100KB max log size\n\n// ============================================\n// Log Types - Each tells part of the story\n// ============================================\n\nexport type LogLevel =\n | \"hook\" // Hook lifecycle (session-start, session-end, etc.)\n | \"api\" // Honcho API calls\n | \"cache\" // Cache operations (hits, misses, writes)\n | \"flow\" // Data flow & state transitions\n | \"async\" // Parallel/async operations\n | \"error\" // Errors\n | \"debug\"; // Verbose debugging\n\nexport interface LogEntry {\n timestamp: string;\n level: LogLevel;\n source: string;\n message: string;\n data?: any;\n // Enhanced metadata for visual display\n timing?: number; // Duration in ms\n success?: boolean; // Operation succeeded\n parent?: string; // Parent operation ID for hierarchy\n depth?: number; // Nesting depth for indentation\n // Session context for filtering\n cwd?: string; // Working directory\n session?: string; // Session name\n}\n\n// ============================================\n// ANSI Colors - Orange to Pale Blue gradient\n// ============================================\n\nconst c = {\n reset: \"\\x1b[0m\",\n dim: \"\\x1b[2m\",\n bold: \"\\x1b[1m\",\n // Orange to pale blue gradient\n orange: \"\\x1b[38;5;208m\",\n peach: \"\\x1b[38;5;215m\",\n pale: \"\\x1b[38;5;223m\",\n cream: \"\\x1b[38;5;195m\",\n paleBlue: \"\\x1b[38;5;159m\",\n lightBlue: \"\\x1b[38;5;117m\",\n skyBlue: \"\\x1b[38;5;81m\",\n // Semantic colors\n success: \"\\x1b[38;5;114m\",\n error: \"\\x1b[38;5;203m\",\n warn: \"\\x1b[38;5;221m\",\n};\n\n// ============================================\n// Visual Symbols\n// ============================================\n\nconst sym = {\n check: symbols.check, // ✓\n cross: symbols.cross, // ✗\n arrow: arrows.right, // →\n dot: symbols.bullet, // •\n circle: symbols.dot, // ·\n // Box drawing for hierarchy\n branch: box.branchRight, // ├─\n corner: box.cornerRight, // └─\n pipe: box.vertical, // │\n top: box.topRight, // ┌─\n line: box.horizontal, // ─\n};\n\n// ============================================\n// Core Logging Functions\n// ============================================\n\nfunction ensureLogDir(): void {\n if (!existsSync(CACHE_DIR)) {\n mkdirSync(CACHE_DIR, { recursive: true });\n }\n}\n\n// Current session context (set by hooks at startup)\nlet currentCwd: string | null = null;\nlet currentSession: string | null = null;\n\nexport function setLogContext(cwd: string, session?: string): void {\n currentCwd = cwd;\n currentSession = session || null;\n}\n\nexport function getLogContext(): { cwd: string | null; session: string | null } {\n return { cwd: currentCwd, session: currentSession };\n}\n\n/**\n * Log an activity entry\n */\nexport function logActivity(\n level: LogLevel,\n source: string,\n message: string,\n data?: any,\n options?: { timing?: number; success?: boolean; depth?: number; cwd?: string; session?: string }\n): void {\n if (!isLoggingEnabled()) return;\n ensureLogDir();\n\n const entry: LogEntry = {\n timestamp: new Date().toISOString(),\n level,\n source,\n message,\n data,\n timing: options?.timing,\n success: options?.success,\n depth: options?.depth ?? 0,\n cwd: options?.cwd || currentCwd || undefined,\n session: options?.session || currentSession || undefined,\n };\n\n try {\n // Check file size and truncate if needed\n if (existsSync(LOG_FILE)) {\n const stats = statSync(LOG_FILE).size;\n if (stats > MAX_LOG_SIZE) {\n const content = readFileSync(LOG_FILE, \"utf-8\");\n const truncated = content.slice(-50 * 1024);\n writeFileSync(LOG_FILE, truncated);\n }\n }\n\n appendFileSync(LOG_FILE, JSON.stringify(entry) + \"\\n\");\n } catch {\n // Ignore logging errors\n }\n}\n\n// ============================================\n// Specialized Loggers\n// ============================================\n\n/**\n * Log a hook lifecycle event\n */\nexport function logHook(hookName: string, message: string, data?: any): void {\n logActivity(\"hook\", hookName, message, data);\n}\n\n/**\n * Log an API call with optional timing\n */\nexport function logApiCall(endpoint: string, method: string, details?: string, timing?: number, success?: boolean): void {\n const msg = `${method} ${endpoint}${details ? ` ${sym.arrow} ${details}` : \"\"}`;\n logActivity(\"api\", \"honcho\", msg, undefined, { timing, success });\n}\n\n/**\n * Log a cache operation\n */\nexport function logCache(operation: \"hit\" | \"miss\" | \"write\" | \"clear\", key: string, details?: string): void {\n const opSymbol = operation === \"hit\" ? sym.check : operation === \"miss\" ? sym.arrow : sym.dot;\n const msg = `${key} ${opSymbol} ${operation}${details ? ` (${details})` : \"\"}`;\n logActivity(\"cache\", \"cache\", msg, undefined, { success: operation === \"hit\" });\n}\n\n/**\n * Log data flow / state transition\n */\nexport function logFlow(stage: string, message: string, data?: any): void {\n logActivity(\"flow\", stage, message, data);\n}\n\n/**\n * Log async/parallel operation\n */\nexport function logAsync(operation: string, message: string, results?: { name: string; success: boolean; timing?: number }[]): void {\n logActivity(\"async\", operation, message, results ? { results } : undefined);\n}\n\n/**\n * Start a timed operation - returns a function to call when done\n */\nexport function startTimed(source: string, operation: string): (success?: boolean, details?: string) => void {\n const start = Date.now();\n return (success = true, details?: string) => {\n const timing = Date.now() - start;\n logApiCall(operation, \"timing\", details, timing, success);\n };\n}\n\n// ============================================\n// Display Formatting\n// ============================================\n\n/**\n * Get the log file path\n */\nexport function getLogPath(): string {\n return LOG_FILE;\n}\n\nexport interface LogFilter {\n cwd?: string; // Filter by working directory\n session?: string; // Filter by session name\n level?: LogLevel[]; // Filter by log levels\n}\n\n/**\n * Read recent log entries with optional filtering\n */\nexport function getRecentLogs(count: number = 50, filter?: LogFilter): LogEntry[] {\n ensureLogDir();\n\n if (!existsSync(LOG_FILE)) {\n return [];\n }\n\n try {\n const content = readFileSync(LOG_FILE, \"utf-8\");\n const lines = content.trim().split(\"\\n\").filter(l => l);\n let entries = lines.map(line => {\n try {\n return JSON.parse(line) as LogEntry;\n } catch {\n return null;\n }\n }).filter((e): e is LogEntry => e !== null);\n\n // Apply filters\n if (filter) {\n if (filter.cwd) {\n entries = entries.filter(e => e.cwd === filter.cwd);\n }\n if (filter.session) {\n entries = entries.filter(e => e.session === filter.session);\n }\n if (filter.level && filter.level.length > 0) {\n entries = entries.filter(e => filter.level!.includes(e.level));\n }\n }\n\n return entries.slice(-count);\n } catch {\n return [];\n }\n}\n\n/**\n * Format a log entry for display\n */\nexport function formatLogEntry(entry: LogEntry, options?: { showSession?: boolean }): string {\n const time = entry.timestamp.split(\"T\")[1].split(\".\")[0]; // HH:MM:SS\n\n // Level-specific styling\n const levelConfig: Record<LogLevel, { color: string; label: string }> = {\n hook: { color: c.orange, label: \"HOOK\" },\n api: { color: c.peach, label: \"API\" },\n cache: { color: c.paleBlue, label: \"CACHE\" },\n flow: { color: c.lightBlue, label: \"FLOW\" },\n async: { color: c.skyBlue, label: \"ASYNC\" },\n error: { color: c.error, label: \"ERROR\" },\n debug: { color: c.dim, label: \"DEBUG\" },\n };\n\n const config = levelConfig[entry.level] || levelConfig.debug;\n\n // Build the output\n let output = `${c.dim}${time}${c.reset} `;\n\n // Session indicator (when showing all sessions)\n if (options?.showSession && entry.session) {\n output += `${c.pale}${entry.session}${c.reset} `;\n }\n\n // Level badge\n output += `${config.color}[${config.label.padEnd(5)}]${c.reset} `;\n\n // Source\n output += `${c.dim}${entry.source}${c.reset} `;\n\n // Message\n output += entry.message;\n\n // Timing indicator\n if (entry.timing !== undefined) {\n const timingColor = entry.timing < 50 ? c.success : entry.timing < 200 ? c.pale : c.warn;\n output += ` ${timingColor}${entry.timing}ms${c.reset}`;\n }\n\n // Success/failure indicator\n if (entry.success !== undefined) {\n output += ` ${entry.success ? c.success + sym.check : c.error + sym.cross}${c.reset}`;\n }\n\n // Compact data display\n if (entry.data) {\n const dataStr = typeof entry.data === \"string\" ? entry.data : JSON.stringify(entry.data);\n if (dataStr.length < 80) {\n output += ` ${c.dim}${dataStr}${c.reset}`;\n }\n }\n\n return output;\n}\n\n/**\n * Format a group of related entries as a visual tree\n * For demo/educational display\n */\nexport function formatLogGroup(entries: LogEntry[], title?: string): string[] {\n const lines: string[] = [];\n\n if (title) {\n lines.push(`${c.orange}${sym.top}${sym.line} ${title} ${sym.line.repeat(30)}${c.reset}`);\n }\n\n entries.forEach((entry, i) => {\n const isLast = i === entries.length - 1;\n const prefix = title ? (isLast ? sym.corner : sym.branch) : \"\";\n const indent = entry.depth ? \" \".repeat(entry.depth) : \"\";\n\n lines.push(`${c.dim}${prefix}${c.reset}${indent}${formatLogEntry(entry)}`);\n });\n\n return lines;\n}\n\n/**\n * Watch the log file for changes (for tail -f behavior)\n */\nexport function watchLogs(callback: (entries: LogEntry[]) => void): () => void {\n ensureLogDir();\n\n // Track by line count, not byte size (more reliable)\n let lastLineCount = 0;\n if (existsSync(LOG_FILE)) {\n try {\n const content = readFileSync(LOG_FILE, \"utf-8\");\n lastLineCount = content.trim().split(\"\\n\").filter(l => l).length;\n } catch {\n lastLineCount = 0;\n }\n }\n\n const checkForUpdates = () => {\n if (!existsSync(LOG_FILE)) return;\n\n try {\n const content = readFileSync(LOG_FILE, \"utf-8\");\n const lines = content.trim().split(\"\\n\").filter(l => l);\n const currentLineCount = lines.length;\n\n if (currentLineCount > lastLineCount) {\n // Get only the new lines since last check\n const newLines = lines.slice(lastLineCount);\n const newEntries = newLines\n .map(line => {\n try {\n return JSON.parse(line) as LogEntry;\n } catch {\n return null;\n }\n })\n .filter((e): e is LogEntry => e !== null);\n\n if (newEntries.length > 0) {\n callback(newEntries);\n }\n\n lastLineCount = currentLineCount;\n }\n } catch {\n // Ignore read errors during polling\n }\n };\n\n // Poll every 200ms for snappier response\n const interval = setInterval(checkForUpdates, 200);\n\n return () => {\n clearInterval(interval);\n };\n}\n\n/**\n * Clear the log file\n */\nexport function clearLogs(): void {\n ensureLogDir();\n if (existsSync(LOG_FILE)) {\n writeFileSync(LOG_FILE, \"\");\n }\n}\n\n// ============================================\n// Demo/Educational Output\n// ============================================\n\n/**\n * Print a visual legend explaining log types\n */\nexport function printLegend(): void {\n console.log(\"\");\n console.log(`${c.orange}${c.bold}Log Types${c.reset}`);\n console.log(`${c.dim}${sym.line.repeat(40)}${c.reset}`);\n console.log(` ${c.orange}[HOOK]${c.reset} Hook lifecycle ${c.dim}(session-start, user-prompt, etc.)${c.reset}`);\n console.log(` ${c.peach}[API]${c.reset} Honcho API calls ${c.dim}(with timing)${c.reset}`);\n console.log(` ${c.paleBlue}[CACHE]${c.reset} Local cache ${c.dim}(hit/miss/write)${c.reset}`);\n console.log(` ${c.lightBlue}[FLOW]${c.reset} Data flow ${c.dim}(state transitions)${c.reset}`);\n console.log(` ${c.skyBlue}[ASYNC]${c.reset} Parallel ops ${c.dim}(concurrent fetches)${c.reset}`);\n console.log(\"\");\n console.log(`${c.orange}${c.bold}Symbols${c.reset}`);\n console.log(`${c.dim}${sym.line.repeat(40)}${c.reset}`);\n console.log(` ${c.success}${sym.check}${c.reset} Success ${c.error}${sym.cross}${c.reset} Failure ${sym.arrow} Flow/transition`);\n console.log(` ${c.success}< 50ms${c.reset} ${c.pale}< 200ms${c.reset} ${c.warn}> 200ms${c.reset} ${c.dim}(timing)${c.reset}`);\n console.log(\"\");\n}\n",
|
|
6
|
-
"/**\n * Unicode characters generated at runtime using String.fromCodePoint()\n * This survives Bun's bundler which otherwise converts escape sequences to raw UTF-8 bytes\n */\n\n// Block drawing characters\nexport const blocks = {\n full: String.fromCodePoint(0x2588), // █\n upperHalf: String.fromCodePoint(0x2580), // ▀\n lowerHalf: String.fromCodePoint(0x2584), // ▄\n light: String.fromCodePoint(0x2591), // ░\n medium: String.fromCodePoint(0x2592), // ▒\n dark: String.fromCodePoint(0x2593), // ▓\n // Wave blocks (vertical eighths)\n lower1_8: String.fromCodePoint(0x2581), // ▁\n lower2_8: String.fromCodePoint(0x2582), // ▂\n lower3_8: String.fromCodePoint(0x2583), // ▃\n lower4_8: String.fromCodePoint(0x2584), // ▄\n lower5_8: String.fromCodePoint(0x2585), // ▅\n lower6_8: String.fromCodePoint(0x2586), // ▆\n lower7_8: String.fromCodePoint(0x2587), // ▇\n};\n\n// Circle characters\nexport const circles = {\n empty: String.fromCodePoint(0x25CB), // ○\n filled: String.fromCodePoint(0x25CF), // ●\n upperRight: String.fromCodePoint(0x25D4), // ◔\n rightHalf: String.fromCodePoint(0x25D1), // ◑\n lowerRight: String.fromCodePoint(0x25D5), // ◕\n leftHalf: String.fromCodePoint(0x25D0), // ◐\n upperHalf: String.fromCodePoint(0x25D3), // ◓\n lowerHalf: String.fromCodePoint(0x25D2), // ◒\n};\n\n// Star/sparkle characters\nexport const stars = {\n small: String.fromCodePoint(0x22C6), // ⋆\n sparkle1: String.fromCodePoint(0x2727), // ✧\n sparkle2: String.fromCodePoint(0x2726), // ✦\n sparkle3: String.fromCodePoint(0x22B9), // ⊹\n star6: String.fromCodePoint(0x2736), // ✶\n star4: String.fromCodePoint(0x2734), // ✴\n star8: String.fromCodePoint(0x2738), // ✸\n};\n\n// Braille patterns for wave animation\nexport const braille = {\n wave: [\n String.fromCodePoint(0x28FE), // ⣾\n String.fromCodePoint(0x28F7), // ⣷\n String.fromCodePoint(0x28EF), // ⣯\n String.fromCodePoint(0x28DF), // ⣟\n String.fromCodePoint(0x287F), // ⡿\n String.fromCodePoint(0x28BF), // ⢿\n String.fromCodePoint(0x28FB), // ⣻\n String.fromCodePoint(0x28FD), // ⣽\n ],\n dots: [\n String.fromCodePoint(0x280B), // ⠋\n String.fromCodePoint(0x2819), // ⠙\n String.fromCodePoint(0x2839), // ⠹\n String.fromCodePoint(0x2838), // ⠸\n String.fromCodePoint(0x283C), // ⠼\n String.fromCodePoint(0x2834), // ⠴\n String.fromCodePoint(0x2826), // ⠦\n String.fromCodePoint(0x2827), // ⠧\n String.fromCodePoint(0x2807), // ⠇\n String.fromCodePoint(0x280F), // ⠏\n ],\n};\n\n// Bracket characters\nexport const brackets = {\n angleLeft: String.fromCodePoint(0x27E8), // ⟨\n angleRight: String.fromCodePoint(0x27E9), // ⟩\n};\n\n// Symbols\nexport const symbols = {\n check: String.fromCodePoint(0x2713), // ✓\n cross: String.fromCodePoint(0x2717), // ✗\n dot: String.fromCodePoint(0x00B7), // ·\n bullet: String.fromCodePoint(0x2022), // •\n arrow: String.fromCodePoint(0x2192), // →\n line: String.fromCodePoint(0x2500), // ─\n corner: String.fromCodePoint(0x2514), // └\n pipe: String.fromCodePoint(0x2502), // │\n};\n\n// Arrow characters\nexport const arrows = {\n right: String.fromCodePoint(0x2192), // →\n left: String.fromCodePoint(0x2190), // ←\n up: String.fromCodePoint(0x2191), // ↑\n down: String.fromCodePoint(0x2193), // ↓\n rightDouble: String.fromCodePoint(0x21D2), // ⇒\n leftDouble: String.fromCodePoint(0x21D0), // ⇐\n rightHook: String.fromCodePoint(0x21AA), // ↪\n leftHook: String.fromCodePoint(0x21A9), // ↩\n};\n\n// Box drawing characters for visual hierarchy\nexport const box = {\n horizontal: String.fromCodePoint(0x2500), // ─\n vertical: String.fromCodePoint(0x2502), // │\n topLeft: String.fromCodePoint(0x250C), // ┌\n topRight: String.fromCodePoint(0x2510), // ┐\n bottomLeft: String.fromCodePoint(0x2514), // └\n bottomRight: String.fromCodePoint(0x2518), // ┘\n branchRight: String.fromCodePoint(0x251C), // ├\n branchLeft: String.fromCodePoint(0x2524), // ┤\n branchDown: String.fromCodePoint(0x252C), // ┬\n branchUp: String.fromCodePoint(0x2534), // ┴\n cross: String.fromCodePoint(0x253C), // ┼\n cornerRight: String.fromCodePoint(0x2514), // └ (alias for bottomLeft)\n};\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": ";;;;;AASA;AACA;AACA;;;ACLO,IAAM,SAAS;AAAA,EACpB,MAAM,OAAO,cAAc,IAAM;AAAA,EACjC,WAAW,OAAO,cAAc,IAAM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
|
-
import { join } from "path";
|
|
4
|
-
import { writeFileSync, unlinkSync } from "fs";
|
|
5
|
-
var DIR = join(homedir(), ".honcho");
|
|
6
|
-
function stateFile(sessionId) {
|
|
7
|
-
return join(DIR, sessionId ? `state-${sessionId}.json` : "state.json");
|
|
8
|
-
}
|
|
9
|
-
function sessionFile(sessionId) {
|
|
10
|
-
return join(DIR, sessionId ? `session-${sessionId}.json` : "session.json");
|
|
11
|
-
}
|
|
12
|
-
function setMemoryState(phase, detail, sessionId) {
|
|
13
|
-
try {
|
|
14
|
-
writeFileSync(stateFile(sessionId), JSON.stringify({ phase, since: Date.now(), detail }));
|
|
15
|
-
} catch {}
|
|
16
|
-
}
|
|
17
|
-
function setSessionLink(url, name, sessionId) {
|
|
18
|
-
try {
|
|
19
|
-
writeFileSync(sessionFile(sessionId), JSON.stringify({ url, name }));
|
|
20
|
-
} catch {}
|
|
21
|
-
}
|
|
22
|
-
function clearSessionFiles(sessionId) {
|
|
23
|
-
if (!sessionId)
|
|
24
|
-
return;
|
|
25
|
-
for (const f of [stateFile(sessionId), sessionFile(sessionId)]) {
|
|
26
|
-
try {
|
|
27
|
-
unlinkSync(f);
|
|
28
|
-
} catch {}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { setMemoryState, setSessionLink, clearSessionFiles };
|
|
33
|
-
|
|
34
|
-
//# debugId=CF0B8025EA4748F964756E2164756E21
|
|
35
|
-
//# sourceMappingURL=chunk-43gww8dc.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/state.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Tiny activity-state file the hooks write and the statusline reads.\n * Decoupled by design: hooks can't draw to the Claude Code TUI (no /dev/tty),\n * so instead they record what memory is doing and let the host-managed\n * statusline render the glow/pulse on its own refresh cycle.\n */\n\nimport { homedir } from \"os\";\nimport { join } from \"path\";\nimport { writeFileSync, unlinkSync } from \"fs\";\n\nconst DIR = join(homedir(), \".honcho\");\n\n// Per-window files keyed by Claude Code's session_id (the one field guaranteed\n// identical between hook stdin and statusLine stdin). Falls back to a global\n// file when no session_id is available, so multiple windows don't clobber each\n// other's link/phase.\nfunction stateFile(sessionId?: string): string {\n return join(DIR, sessionId ? `state-${sessionId}.json` : \"state.json\");\n}\nfunction sessionFile(sessionId?: string): string {\n return join(DIR, sessionId ? `session-${sessionId}.json` : \"session.json\");\n}\n\nexport type MemoryPhase =\n | \"idle\"\n | \"loading\"\n | \"compacting\"\n | \"recalling\"\n | \"querying\"; // an explicit honcho MCP tool call (search/chat/context/...)\n\nexport function setMemoryState(phase: MemoryPhase, detail?: string, sessionId?: string): void {\n try {\n writeFileSync(stateFile(sessionId), JSON.stringify({ phase, since: Date.now(), detail }));\n } catch {\n // best-effort — statusline falls back to idle if this is missing/stale\n }\n}\n\n// The hooks own the workspace + session-name math, so they write the resolved\n// web URL here for the statusline to render as a clickable link.\nexport function setSessionLink(url: string, name: string | undefined, sessionId?: string): void {\n try {\n writeFileSync(sessionFile(sessionId), JSON.stringify({ url, name }));\n } catch {\n // best-effort — statusline just omits the link if this is missing\n }\n}\n\n// Clean up this window's files when its session ends, so they don't accumulate.\nexport function clearSessionFiles(sessionId?: string): void {\n if (!sessionId) return;\n for (const f of [stateFile(sessionId), sessionFile(sessionId)]) {\n try { unlinkSync(f); } catch { /* already gone */ }\n }\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";AAOA;AACA;AACA;AAEA,IAAM,MAAM,KAAK,QAAQ,GAAG,SAAS;AAMrC,SAAS,SAAS,CAAC,WAA4B;AAAA,EAC7C,OAAO,KAAK,KAAK,YAAY,SAAS,mBAAmB,YAAY;AAAA;AAEvE,SAAS,WAAW,CAAC,WAA4B;AAAA,EAC/C,OAAO,KAAK,KAAK,YAAY,WAAW,mBAAmB,cAAc;AAAA;AAUpE,SAAS,cAAc,CAAC,OAAoB,QAAiB,WAA0B;AAAA,EAC5F,IAAI;AAAA,IACF,cAAc,UAAU,SAAS,GAAG,KAAK,UAAU,EAAE,OAAO,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC;AAAA,IACxF,MAAM;AAAA;AAOH,SAAS,cAAc,CAAC,KAAa,MAA0B,WAA0B;AAAA,EAC9F,IAAI;AAAA,IACF,cAAc,YAAY,SAAS,GAAG,KAAK,UAAU,EAAE,KAAK,KAAK,CAAC,CAAC;AAAA,IACnE,MAAM;AAAA;AAMH,SAAS,iBAAiB,CAAC,WAA0B;AAAA,EAC1D,IAAI,CAAC;AAAA,IAAW;AAAA,EAChB,WAAW,KAAK,CAAC,UAAU,SAAS,GAAG,YAAY,SAAS,CAAC,GAAG;AAAA,IAC9D,IAAI;AAAA,MAAE,WAAW,CAAC;AAAA,MAAK,MAAM;AAAA,EAC/B;AAAA;",
|
|
8
|
-
"debugId": "CF0B8025EA4748F964756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/chunk-81cb25yy.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
setDetectedHost2,
|
|
3
|
-
getConfigDir2,
|
|
4
|
-
getConfigPath2,
|
|
5
|
-
configExists2,
|
|
6
|
-
loadConfig2,
|
|
7
|
-
loadConfigFromEnv2,
|
|
8
|
-
saveConfig2,
|
|
9
|
-
saveRootField2,
|
|
10
|
-
getClaudeSettingsPath2,
|
|
11
|
-
getClaudeSettingsDir2,
|
|
12
|
-
getSessionName2,
|
|
13
|
-
getContextRefreshConfig2,
|
|
14
|
-
getHonchoClientOptions2,
|
|
15
|
-
getEndpointInfo2
|
|
16
|
-
} from "./chunk-g0m354bn.js";
|
|
17
|
-
export {
|
|
18
|
-
configExists2 as configExists,
|
|
19
|
-
getClaudeSettingsDir2 as getClaudeSettingsDir,
|
|
20
|
-
getClaudeSettingsPath2 as getClaudeSettingsPath,
|
|
21
|
-
getConfigDir2 as getConfigDir,
|
|
22
|
-
getConfigPath2 as getConfigPath,
|
|
23
|
-
getContextRefreshConfig2 as getContextRefreshConfig,
|
|
24
|
-
getEndpointInfo2 as getEndpointInfo,
|
|
25
|
-
getHonchoClientOptions2 as getHonchoClientOptions,
|
|
26
|
-
getSessionName2 as getSessionName,
|
|
27
|
-
loadConfig2 as loadConfig,
|
|
28
|
-
loadConfigFromEnv2 as loadConfigFromEnv,
|
|
29
|
-
saveConfig2 as saveConfig,
|
|
30
|
-
saveRootField2 as saveRootField,
|
|
31
|
-
setDetectedHost2 as setDetectedHost
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
//# debugId=A9EEEEAAE85E8F7464756E2164756E21
|
|
35
|
-
//# sourceMappingURL=chunk-81cb25yy.js.map
|