kibi-agent-core 0.0.0 → 0.1.1
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/CHANGELOG.md +19 -0
- package/dist/kb-mcp-tools.d.ts +18 -0
- package/dist/kb-mcp-tools.js +32 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# kibi-agent-core
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 676bac9: The Claude Code, Codex, Cursor, and ZCode plugins now tell the Kibi MCP server which workspace each call is about, so sessions working in a git worktree are answered from that worktree's branch instead of the checkout the server started in. Nothing changes for sessions that stay in one project.
|
|
8
|
+
- Each plugin's pre-tool hook adds `workspaceRoot`, the agent's current Kibi workspace, to every Kibi MCP call. Claude Code, Cursor, and ZCode send it without a permission decision so the host's own approval flow is unchanged; Codex requires `permissionDecision: "allow"` for input rewrites, which does not override a server's tool approval mode.
|
|
9
|
+
- `kibi-agent-core` exports `KIBI_WORKSPACE_ARGUMENT`, `isKibiMcpToolName`, and `stampKibiWorkspace` for the plugins.
|
|
10
|
+
- The Codex hook parser now reads `hook_event_name`, the field Codex actually sends; the Claude and ZCode `PreToolUse` matchers include `mcp__.*__kb_.*`.
|
|
11
|
+
- The ZCode launcher sets `KIBI_MCP_HOST=zcode` so its usage rows are attributed like the other hosts'.
|
|
12
|
+
|
|
13
|
+
## 0.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 5a06c03: Kibi's agent plugins now share one fast, consistent implementation for source-path classification, Kibi MCP tool recognition, and symbol-manifest indexing. Codex and ZCode now recognize production code outside `src/`, while Cursor reuses the same size-and-mtime-keyed scanner as Claude instead of parsing the full symbol manifest before an edit.
|
|
18
|
+
- Add `kibi-agent-core` as the common Node 18-compatible hook-helper package.
|
|
19
|
+
- Keep host adapters thin while preserving their host-specific event and state contracts.
|
|
20
|
+
- Replace Cursor's YAML parser dependency with the shared cached line scanner.
|
|
21
|
+
|
|
3
22
|
## 0.0.0
|
|
4
23
|
|
|
5
24
|
- Initial shared hook-helper package.
|
package/dist/kb-mcp-tools.d.ts
CHANGED
|
@@ -4,6 +4,24 @@
|
|
|
4
4
|
* `MCP:kb_check`, `kibi_kb_check`); an unprefixed `kb_check` passes through.
|
|
5
5
|
*/
|
|
6
6
|
export declare function canonicalKbToolName(toolName: string | undefined): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* The public tool argument naming the workspace a Kibi MCP call is about.
|
|
9
|
+
* Host pre-tool hooks fill it from the agent's current directory on every
|
|
10
|
+
* Kibi MCP call; kibi-mcp answers from that workspace, so a session working
|
|
11
|
+
* in a git worktree is never answered from another checkout's branch.
|
|
12
|
+
*/
|
|
13
|
+
export declare const KIBI_WORKSPACE_ARGUMENT = "workspaceRoot";
|
|
14
|
+
/**
|
|
15
|
+
* True for a Kibi MCP tool as hosts name it in pre-tool hooks:
|
|
16
|
+
* `mcp__<server>__kb_*` from a server whose name mentions kibi, or Cursor's
|
|
17
|
+
* `MCP:kb_*` (Cursor does not name the server there).
|
|
18
|
+
*/
|
|
19
|
+
export declare function isKibiMcpToolName(toolName: string | undefined): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The Kibi MCP tool input with the workspace stamp added, or undefined when
|
|
22
|
+
* the tool is not a Kibi MCP tool or no workspace is known.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stampKibiWorkspace(toolName: string | undefined, toolInput: unknown, workspaceRoot: string | undefined): Record<string, unknown> | undefined;
|
|
7
25
|
export type KbMcpToolCall = {
|
|
8
26
|
toolName: string;
|
|
9
27
|
impactCheckRun: boolean;
|
package/dist/kb-mcp-tools.js
CHANGED
|
@@ -52,6 +52,38 @@ export function canonicalKbToolName(toolName) {
|
|
|
52
52
|
const operation = lastSegment.replace(/^kibi_/, "");
|
|
53
53
|
return operation.startsWith("kb_") ? operation : undefined;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* The public tool argument naming the workspace a Kibi MCP call is about.
|
|
57
|
+
* Host pre-tool hooks fill it from the agent's current directory on every
|
|
58
|
+
* Kibi MCP call; kibi-mcp answers from that workspace, so a session working
|
|
59
|
+
* in a git worktree is never answered from another checkout's branch.
|
|
60
|
+
*/
|
|
61
|
+
export const KIBI_WORKSPACE_ARGUMENT = "workspaceRoot";
|
|
62
|
+
/**
|
|
63
|
+
* True for a Kibi MCP tool as hosts name it in pre-tool hooks:
|
|
64
|
+
* `mcp__<server>__kb_*` from a server whose name mentions kibi, or Cursor's
|
|
65
|
+
* `MCP:kb_*` (Cursor does not name the server there).
|
|
66
|
+
*/
|
|
67
|
+
export function isKibiMcpToolName(toolName) {
|
|
68
|
+
const name = toolName?.trim() ?? "";
|
|
69
|
+
if (/^MCP:kb_[a-z_]+$/i.test(name))
|
|
70
|
+
return true;
|
|
71
|
+
const segments = name.split("__");
|
|
72
|
+
if (segments.length < 3 || segments[0] !== "mcp")
|
|
73
|
+
return false;
|
|
74
|
+
const server = segments.slice(1, -1).join("__");
|
|
75
|
+
return /kibi/i.test(server) && /^kb_[a-z_]+$/.test(segments.at(-1) ?? "");
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The Kibi MCP tool input with the workspace stamp added, or undefined when
|
|
79
|
+
* the tool is not a Kibi MCP tool or no workspace is known.
|
|
80
|
+
*/
|
|
81
|
+
export function stampKibiWorkspace(toolName, toolInput, workspaceRoot) {
|
|
82
|
+
if (!workspaceRoot || !isKibiMcpToolName(toolName))
|
|
83
|
+
return undefined;
|
|
84
|
+
const base = isRecord(toolInput) ? toolInput : {};
|
|
85
|
+
return { ...base, [KIBI_WORKSPACE_ARGUMENT]: workspaceRoot };
|
|
86
|
+
}
|
|
55
87
|
export function resolveKibiInterface(mcpState, workspaceTrusted) {
|
|
56
88
|
if (mcpState === "observed") {
|
|
57
89
|
return "mcp";
|