eminiar 0.13.3 → 0.13.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/.cursor-plugin/plugin.json +1 -1
- package/dist/cli.js +109 -54
- package/dist/{hook-async-3TLK23ZY.js → hook-async-7GK6H3OO.js} +3 -3
- package/dist/{hook-chunk-ZLRLOPLR.js → hook-chunk-6EFFDI3S.js} +24 -31
- package/dist/{hook-chunk-MVSMFCKL.js → hook-chunk-77LASZ3C.js} +2 -2
- package/dist/{hook-chunk-ETYHCPPH.js → hook-chunk-G7UP4ZVA.js} +36 -4
- package/dist/{hook-hooks-5U2AI6W7.js → hook-hooks-YGXLOZ6H.js} +4 -4
- package/dist/hook.js +29 -26
- package/dist/server.js +120 -67
- package/eminiar.config.schema.json +3 -0
- package/package.json +3 -1
|
@@ -20148,6 +20148,26 @@ function adjudicatorDefaults() {
|
|
|
20148
20148
|
privacy: { maxChars: 2e3, storeHead: true, captureExchanges: false }
|
|
20149
20149
|
};
|
|
20150
20150
|
}
|
|
20151
|
+
function graphGlobProblem(g) {
|
|
20152
|
+
if (g.length > 200) return "longer than 200 characters";
|
|
20153
|
+
if ((g.match(/\{/g)?.length ?? 0) > 4) return "more than 4 braces";
|
|
20154
|
+
if ((g.match(/\(/g)?.length ?? 0) > 2) return "more than 2 extglob groups";
|
|
20155
|
+
let total = 0;
|
|
20156
|
+
for (const seg of g.split(/[\\/]/)) {
|
|
20157
|
+
const groups = seg.match(/\*+|\?/g)?.length ?? 0;
|
|
20158
|
+
if (groups > 3) return "more than 3 wildcards in one path segment";
|
|
20159
|
+
total += groups;
|
|
20160
|
+
}
|
|
20161
|
+
return total > 8 ? "more than 8 wildcards" : void 0;
|
|
20162
|
+
}
|
|
20163
|
+
var GraphGlob = external_exports.string().superRefine((g, ctx) => {
|
|
20164
|
+
const why = graphGlobProblem(g);
|
|
20165
|
+
if (why)
|
|
20166
|
+
ctx.addIssue({
|
|
20167
|
+
code: "custom",
|
|
20168
|
+
message: `graph glob ${JSON.stringify(g.slice(0, 40))} is ${why}`
|
|
20169
|
+
});
|
|
20170
|
+
});
|
|
20151
20171
|
var BaseConfigSchema = external_exports.object({
|
|
20152
20172
|
routing: external_exports.object({
|
|
20153
20173
|
/** auto = annotate while context-mode is installed, enforce once it is gone. */
|
|
@@ -20174,18 +20194,21 @@ var BaseConfigSchema = external_exports.object({
|
|
|
20174
20194
|
dims: external_exports.number().int().positive().default(384)
|
|
20175
20195
|
}).prefault({}),
|
|
20176
20196
|
graph: external_exports.object({
|
|
20177
|
-
include: external_exports.array(
|
|
20197
|
+
include: external_exports.array(GraphGlob).default([
|
|
20178
20198
|
"**/*.ts",
|
|
20179
20199
|
"**/*.tsx",
|
|
20180
20200
|
"**/*.js",
|
|
20181
20201
|
"**/*.jsx",
|
|
20182
20202
|
"**/*.mjs",
|
|
20183
20203
|
"**/*.cjs",
|
|
20204
|
+
"**/*.mts",
|
|
20205
|
+
"**/*.cts",
|
|
20184
20206
|
"**/*.py",
|
|
20207
|
+
"**/*.pyi",
|
|
20185
20208
|
"**/*.go",
|
|
20186
20209
|
"**/*.php"
|
|
20187
20210
|
]),
|
|
20188
|
-
exclude: external_exports.array(
|
|
20211
|
+
exclude: external_exports.array(GraphGlob).default([
|
|
20189
20212
|
"**/node_modules/**",
|
|
20190
20213
|
"**/dist/**",
|
|
20191
20214
|
"**/build/**",
|
|
@@ -20616,6 +20639,11 @@ function resolveProjectRoot(hint) {
|
|
|
20616
20639
|
return root;
|
|
20617
20640
|
}
|
|
20618
20641
|
}
|
|
20642
|
+
function sessionRoot(cwd) {
|
|
20643
|
+
return resolveProjectRoot(
|
|
20644
|
+
process.env.CLAUDE_PROJECT_DIR || process.env.EMINIAR_PROJECT_ROOT || cwd || process.cwd()
|
|
20645
|
+
);
|
|
20646
|
+
}
|
|
20619
20647
|
function projectId(root) {
|
|
20620
20648
|
return createHash("sha256").update(root).digest("hex").slice(0, 16);
|
|
20621
20649
|
}
|
|
@@ -20632,6 +20660,9 @@ function getContext(rootHint) {
|
|
|
20632
20660
|
cache.set(root, ctx);
|
|
20633
20661
|
return ctx;
|
|
20634
20662
|
}
|
|
20663
|
+
function sessionContext(cwd) {
|
|
20664
|
+
return getContext(sessionRoot(cwd));
|
|
20665
|
+
}
|
|
20635
20666
|
|
|
20636
20667
|
// src/storage/dispatch.ts
|
|
20637
20668
|
init_esm_shims();
|
|
@@ -24107,9 +24138,10 @@ export {
|
|
|
24107
24138
|
PROJECT_RELATIVE_PATH_RE,
|
|
24108
24139
|
AdjudicatorConfigSchema,
|
|
24109
24140
|
loadConfig,
|
|
24110
|
-
findProjectRoot,
|
|
24111
24141
|
resolveProjectRoot,
|
|
24142
|
+
sessionRoot,
|
|
24112
24143
|
getContext,
|
|
24144
|
+
sessionContext,
|
|
24113
24145
|
tierOf,
|
|
24114
24146
|
KEPT_MODEL_FLAG,
|
|
24115
24147
|
keptModel,
|
|
@@ -24123,4 +24155,4 @@ export {
|
|
|
24123
24155
|
classifyToolCall,
|
|
24124
24156
|
classifyAssistant
|
|
24125
24157
|
};
|
|
24126
|
-
//# sourceMappingURL=hook-chunk-
|
|
24158
|
+
//# sourceMappingURL=hook-chunk-G7UP4ZVA.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
manifestPath,
|
|
9
9
|
readManifestAt,
|
|
10
10
|
resolvePrice
|
|
11
|
-
} from "./hook-chunk-
|
|
11
|
+
} from "./hook-chunk-6EFFDI3S.js";
|
|
12
12
|
import {
|
|
13
13
|
adjudicateOne,
|
|
14
14
|
briefUnitsOf,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveAdjudicator,
|
|
19
19
|
spawnAsyncJob,
|
|
20
20
|
topIntent
|
|
21
|
-
} from "./hook-chunk-
|
|
21
|
+
} from "./hook-chunk-77LASZ3C.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT_EFFORT_SINCE,
|
|
24
24
|
KEPT_MODEL_FLAG,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
init_esm_shims,
|
|
31
31
|
keptModel,
|
|
32
32
|
tierOf
|
|
33
|
-
} from "./hook-chunk-
|
|
33
|
+
} from "./hook-chunk-G7UP4ZVA.js";
|
|
34
34
|
|
|
35
35
|
// src/adjudicator/hooks.ts
|
|
36
36
|
init_esm_shims();
|
|
@@ -1826,4 +1826,4 @@ export {
|
|
|
1826
1826
|
withModel,
|
|
1827
1827
|
withNote
|
|
1828
1828
|
};
|
|
1829
|
-
//# sourceMappingURL=hook-hooks-
|
|
1829
|
+
//# sourceMappingURL=hook-hooks-YGXLOZ6H.js.map
|
package/dist/hook.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
swarmSubagentStop,
|
|
36
36
|
swarmTouch,
|
|
37
37
|
workerLacksTool
|
|
38
|
-
} from "./hook-chunk-
|
|
38
|
+
} from "./hook-chunk-6EFFDI3S.js";
|
|
39
39
|
import {
|
|
40
40
|
GUIDE_ORDER,
|
|
41
41
|
classifyAssistant,
|
|
@@ -50,9 +50,10 @@ import {
|
|
|
50
50
|
getStorage,
|
|
51
51
|
init_esm_shims,
|
|
52
52
|
projectDir,
|
|
53
|
+
sessionContext,
|
|
53
54
|
setStorageBusyTimeout,
|
|
54
55
|
withPriority
|
|
55
|
-
} from "./hook-chunk-
|
|
56
|
+
} from "./hook-chunk-G7UP4ZVA.js";
|
|
56
57
|
|
|
57
58
|
// src/hook.ts
|
|
58
59
|
init_esm_shims();
|
|
@@ -1834,7 +1835,7 @@ function persist(db, sessionId, events) {
|
|
|
1834
1835
|
}
|
|
1835
1836
|
}
|
|
1836
1837
|
function open(input) {
|
|
1837
|
-
const ctx =
|
|
1838
|
+
const ctx = sessionContext(input.cwd);
|
|
1838
1839
|
const db = getStorage(ctx, { vectors: false });
|
|
1839
1840
|
const sessionId = input.session_id || "unknown";
|
|
1840
1841
|
db.sessionUpsert({
|
|
@@ -1847,7 +1848,7 @@ function open(input) {
|
|
|
1847
1848
|
var usageFailureLogged = false;
|
|
1848
1849
|
function ingestUsage(db, input, sessionId) {
|
|
1849
1850
|
try {
|
|
1850
|
-
const ctx =
|
|
1851
|
+
const ctx = sessionContext(input.cwd);
|
|
1851
1852
|
if (!usageEnabled(ctx)) return;
|
|
1852
1853
|
const overrides = ctx.config.usage.pricing;
|
|
1853
1854
|
ingestSession(db, ctx.root, sessionId, input.transcript_path, { overrides });
|
|
@@ -1864,7 +1865,7 @@ function ingestUsage(db, input, sessionId) {
|
|
|
1864
1865
|
}
|
|
1865
1866
|
var userPromptSubmit = async (input) => {
|
|
1866
1867
|
if (!input.prompt?.trim()) return void 0;
|
|
1867
|
-
const ctx =
|
|
1868
|
+
const ctx = sessionContext(input.cwd);
|
|
1868
1869
|
const db = getStorage(ctx, { vectors: false });
|
|
1869
1870
|
const sessionId = input.session_id || "unknown";
|
|
1870
1871
|
try {
|
|
@@ -1901,7 +1902,7 @@ var userPromptSubmit = async (input) => {
|
|
|
1901
1902
|
let systemMessage;
|
|
1902
1903
|
if (ctx.config.adjudicator.enabled && input.client !== "cursor" && hasBudget(ADJUDICATOR_NEEDS_MS)) {
|
|
1903
1904
|
try {
|
|
1904
|
-
const { onPrompt } = await import("./hook-hooks-
|
|
1905
|
+
const { onPrompt } = await import("./hook-hooks-YGXLOZ6H.js");
|
|
1905
1906
|
const a = await onPrompt(ctx, db, input, sessionId);
|
|
1906
1907
|
if (a?.context) parts.push(a.context);
|
|
1907
1908
|
systemMessage = a?.systemMessage;
|
|
@@ -1936,9 +1937,9 @@ function detectLoop(db, sessionId, key, summary) {
|
|
|
1936
1937
|
}
|
|
1937
1938
|
var postToolUse = async (input) => {
|
|
1938
1939
|
if (!input.tool_name) return void 0;
|
|
1939
|
-
if (input.agent_id) swarmActivity(
|
|
1940
|
+
if (input.agent_id) swarmActivity(sessionContext(input.cwd), input, false);
|
|
1940
1941
|
const isAgent = input.tool_name === "Agent" || input.tool_name === "Task";
|
|
1941
|
-
if (isAgent) swarmAgentReturned(
|
|
1942
|
+
if (isAgent) swarmAgentReturned(sessionContext(input.cwd), input);
|
|
1942
1943
|
const { db, root, sessionId } = open(input);
|
|
1943
1944
|
const drafts = classifyToolCall({
|
|
1944
1945
|
toolName: input.tool_name,
|
|
@@ -1956,10 +1957,10 @@ var postToolUse = async (input) => {
|
|
|
1956
1957
|
}
|
|
1957
1958
|
}
|
|
1958
1959
|
if (isAgent && input.client !== "cursor") {
|
|
1959
|
-
const ctx =
|
|
1960
|
+
const ctx = sessionContext(input.cwd);
|
|
1960
1961
|
if (ctx.config.adjudicator.enabled) {
|
|
1961
1962
|
try {
|
|
1962
|
-
const { onPostAgent } = await import("./hook-hooks-
|
|
1963
|
+
const { onPostAgent } = await import("./hook-hooks-YGXLOZ6H.js");
|
|
1963
1964
|
onPostAgent(ctx, db, input);
|
|
1964
1965
|
} catch {
|
|
1965
1966
|
}
|
|
@@ -1988,7 +1989,7 @@ function bestEffortWrites(db) {
|
|
|
1988
1989
|
}
|
|
1989
1990
|
var postToolUseFailure = async (input) => {
|
|
1990
1991
|
if (!input.tool_name) return void 0;
|
|
1991
|
-
const ctx =
|
|
1992
|
+
const ctx = sessionContext(input.cwd);
|
|
1992
1993
|
if (input.tool_name === "Agent" || input.tool_name === "Task") swarmAgentReturned(ctx, input);
|
|
1993
1994
|
const db = getStorage(ctx, { vectors: false });
|
|
1994
1995
|
const sessionId = input.session_id || "unknown";
|
|
@@ -2028,7 +2029,7 @@ var postToolUseFailure = async (input) => {
|
|
|
2028
2029
|
return recalled ? { hookSpecificOutput: { hookEventName: "PostToolUseFailure", additionalContext: recalled } } : void 0;
|
|
2029
2030
|
};
|
|
2030
2031
|
var subagentStop = (input) => {
|
|
2031
|
-
if (input.agent_id) swarmSubagentStop(
|
|
2032
|
+
if (input.agent_id) swarmSubagentStop(sessionContext(input.cwd), input);
|
|
2032
2033
|
const { db, sessionId } = open(input);
|
|
2033
2034
|
const msg = input.last_assistant_message ?? "";
|
|
2034
2035
|
if (msg.trim()) {
|
|
@@ -2054,7 +2055,7 @@ var stop = (input) => {
|
|
|
2054
2055
|
return void 0;
|
|
2055
2056
|
};
|
|
2056
2057
|
var sessionEnd = async (input) => {
|
|
2057
|
-
const ctx =
|
|
2058
|
+
const ctx = sessionContext(input.cwd);
|
|
2058
2059
|
swarmSessionEnd(ctx, input);
|
|
2059
2060
|
const { db, sessionId } = open(input);
|
|
2060
2061
|
db.sessionUpsert({ id: sessionId, ended_at: Date.now() });
|
|
@@ -2064,7 +2065,7 @@ var sessionEnd = async (input) => {
|
|
|
2064
2065
|
ingestUsage(db, input, sessionId);
|
|
2065
2066
|
if (ctx.config.adjudicator.enabled && input.client !== "cursor") {
|
|
2066
2067
|
try {
|
|
2067
|
-
const { onSessionEnd } = await import("./hook-hooks-
|
|
2068
|
+
const { onSessionEnd } = await import("./hook-hooks-YGXLOZ6H.js");
|
|
2068
2069
|
onSessionEnd(ctx, db, input);
|
|
2069
2070
|
} catch {
|
|
2070
2071
|
}
|
|
@@ -2186,7 +2187,7 @@ function renderGuide(db, sessionId, budget = 2048) {
|
|
|
2186
2187
|
// src/hooks/pre-compact.ts
|
|
2187
2188
|
var SNAPSHOT_BUDGET = 2048;
|
|
2188
2189
|
var preCompact = (input) => {
|
|
2189
|
-
const ctx =
|
|
2190
|
+
const ctx = sessionContext(input.cwd);
|
|
2190
2191
|
const db = getStorage(ctx, { vectors: false });
|
|
2191
2192
|
const sessionId = input.session_id || "unknown";
|
|
2192
2193
|
const body = renderGuide(db, sessionId, SNAPSHOT_BUDGET);
|
|
@@ -3497,12 +3498,14 @@ function fileKnowledge(ctx, input) {
|
|
|
3497
3498
|
return void 0;
|
|
3498
3499
|
}
|
|
3499
3500
|
}
|
|
3500
|
-
function commitFiles(root, cmd) {
|
|
3501
|
-
const
|
|
3501
|
+
function commitFiles(root, cwd, cmd) {
|
|
3502
|
+
const top = git(cwd, ["rev-parse", "--show-toplevel"], { allowFail: true }).trim();
|
|
3503
|
+
if (!top) return [];
|
|
3504
|
+
const list = (args) => git(cwd, [...args, "-z"], { allowFail: true }).split("\0").filter(Boolean);
|
|
3502
3505
|
const files = new Set(list(["diff", "--cached", "--name-only"]));
|
|
3503
3506
|
if (/\s(-[a-zA-Z]*a[a-zA-Z]*|--all)\b/.test(cmd))
|
|
3504
3507
|
for (const f of list(["diff", "--name-only"])) files.add(f);
|
|
3505
|
-
return [...files];
|
|
3508
|
+
return [...files].map((f) => relative2(root, join7(top, f)));
|
|
3506
3509
|
}
|
|
3507
3510
|
function commitKnowledge(ctx, input) {
|
|
3508
3511
|
if (!ctx.config.recall.onCommit || input.tool_name !== "Bash") return void 0;
|
|
@@ -3510,7 +3513,7 @@ function commitKnowledge(ctx, input) {
|
|
|
3510
3513
|
if (!/(^|[;&|]\s*)git\s+commit\b/.test(cmd)) return void 0;
|
|
3511
3514
|
try {
|
|
3512
3515
|
const db = getStorage(ctx, { vectors: false });
|
|
3513
|
-
return commitContext(db, commitFiles(ctx.root, cmd)) || void 0;
|
|
3516
|
+
return commitContext(db, commitFiles(ctx.root, input.cwd || ctx.root, cmd)) || void 0;
|
|
3514
3517
|
} catch {
|
|
3515
3518
|
return void 0;
|
|
3516
3519
|
}
|
|
@@ -3572,14 +3575,14 @@ ${extra}` : extra
|
|
|
3572
3575
|
var preToolUse = async (input) => {
|
|
3573
3576
|
if (!input.tool_name || !input.tool_input) return void 0;
|
|
3574
3577
|
if (isSwarmTool(input.tool_name)) return swarmStampCaller(input);
|
|
3575
|
-
const ctx =
|
|
3578
|
+
const ctx = sessionContext(input.cwd);
|
|
3576
3579
|
if (input.agent_id) swarmTouch(ctx, input);
|
|
3577
3580
|
const spawn = swarmPreAgent(ctx, input);
|
|
3578
3581
|
if (spawn?.kind === "deny") return spawn.output;
|
|
3579
3582
|
const out = await route(ctx, input, spawn?.kind === "worker");
|
|
3580
3583
|
if (!ctx.config.adjudicator.enabled || input.client === "cursor") return out;
|
|
3581
3584
|
try {
|
|
3582
|
-
const { afterRouting } = await import("./hook-hooks-
|
|
3585
|
+
const { afterRouting } = await import("./hook-hooks-YGXLOZ6H.js");
|
|
3583
3586
|
return await afterRouting(ctx, input, spawn, out);
|
|
3584
3587
|
} catch {
|
|
3585
3588
|
return out;
|
|
@@ -3764,7 +3767,7 @@ function routingGuidance(mode) {
|
|
|
3764
3767
|
].join("\n");
|
|
3765
3768
|
}
|
|
3766
3769
|
var sessionStart = async (input) => {
|
|
3767
|
-
const ctx =
|
|
3770
|
+
const ctx = sessionContext(input.cwd);
|
|
3768
3771
|
const sessionId = input.session_id || "unknown";
|
|
3769
3772
|
setCurrentSession(ctx, sessionId);
|
|
3770
3773
|
const db = getStorage(ctx, { vectors: false });
|
|
@@ -3819,7 +3822,7 @@ ${guide}`);
|
|
|
3819
3822
|
if (swarm) parts.push(swarm);
|
|
3820
3823
|
if (ctx.config.adjudicator.enabled && input.client !== "cursor") {
|
|
3821
3824
|
try {
|
|
3822
|
-
const { onSessionStart } = await import("./hook-hooks-
|
|
3825
|
+
const { onSessionStart } = await import("./hook-hooks-YGXLOZ6H.js");
|
|
3823
3826
|
const line2 = onSessionStart(ctx, db, input);
|
|
3824
3827
|
if (line2) parts.push(line2);
|
|
3825
3828
|
} catch {
|
|
@@ -3956,7 +3959,7 @@ function failClosed(input, err) {
|
|
|
3956
3959
|
if (input.hook_event_name !== "PreToolUse" || input.client === "cursor" || input.tool_name !== "Agent" && input.tool_name !== "Task" || !rawEnforced({ cwd: input.cwd }))
|
|
3957
3960
|
return void 0;
|
|
3958
3961
|
try {
|
|
3959
|
-
swarmAgentReturned(
|
|
3962
|
+
swarmAgentReturned(sessionContext(input.cwd), input);
|
|
3960
3963
|
} catch {
|
|
3961
3964
|
}
|
|
3962
3965
|
return JSON.stringify({
|
|
@@ -3988,7 +3991,7 @@ async function runCursor(parsed, budgetMs2) {
|
|
|
3988
3991
|
}
|
|
3989
3992
|
let root = input.cwd;
|
|
3990
3993
|
try {
|
|
3991
|
-
root =
|
|
3994
|
+
root = sessionContext(input.cwd).root;
|
|
3992
3995
|
} catch {
|
|
3993
3996
|
}
|
|
3994
3997
|
try {
|
|
@@ -4012,7 +4015,7 @@ async function main() {
|
|
|
4012
4015
|
return;
|
|
4013
4016
|
}
|
|
4014
4017
|
if (process.argv.includes("--adjudicate")) {
|
|
4015
|
-
const { ASYNC_JOB_MAX_MS, runAsyncJob } = await import("./hook-async-
|
|
4018
|
+
const { ASYNC_JOB_MAX_MS, runAsyncJob } = await import("./hook-async-7GK6H3OO.js");
|
|
4016
4019
|
setTimeout(() => process.exit(0), ASYNC_JOB_MAX_MS).unref();
|
|
4017
4020
|
await runAsyncJob(raw, { log: (line2) => hookLog("info", line2) });
|
|
4018
4021
|
return;
|