@skroyc/librarian 0.1.0
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 +176 -0
- package/LICENSE +210 -0
- package/README.md +614 -0
- package/biome.jsonc +9 -0
- package/dist/agents/context-schema.d.ts +17 -0
- package/dist/agents/context-schema.d.ts.map +1 -0
- package/dist/agents/context-schema.js +16 -0
- package/dist/agents/context-schema.js.map +1 -0
- package/dist/agents/react-agent.d.ts +38 -0
- package/dist/agents/react-agent.d.ts.map +1 -0
- package/dist/agents/react-agent.js +719 -0
- package/dist/agents/react-agent.js.map +1 -0
- package/dist/agents/tool-runtime.d.ts +7 -0
- package/dist/agents/tool-runtime.d.ts.map +1 -0
- package/dist/agents/tool-runtime.js +2 -0
- package/dist/agents/tool-runtime.js.map +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +172 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +243 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +470 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/file-finding.tool.d.ts +24 -0
- package/dist/tools/file-finding.tool.d.ts.map +1 -0
- package/dist/tools/file-finding.tool.js +198 -0
- package/dist/tools/file-finding.tool.js.map +1 -0
- package/dist/tools/file-listing.tool.d.ts +12 -0
- package/dist/tools/file-listing.tool.d.ts.map +1 -0
- package/dist/tools/file-listing.tool.js +132 -0
- package/dist/tools/file-listing.tool.js.map +1 -0
- package/dist/tools/file-reading.tool.d.ts +9 -0
- package/dist/tools/file-reading.tool.d.ts.map +1 -0
- package/dist/tools/file-reading.tool.js +112 -0
- package/dist/tools/file-reading.tool.js.map +1 -0
- package/dist/tools/grep-content.tool.d.ts +27 -0
- package/dist/tools/grep-content.tool.d.ts.map +1 -0
- package/dist/tools/grep-content.tool.js +229 -0
- package/dist/tools/grep-content.tool.js.map +1 -0
- package/dist/utils/file-utils.d.ts +2 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +28 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/logger.d.ts +32 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +177 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-utils.d.ts +2 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +9 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/package.json +84 -0
- package/src/agents/context-schema.ts +61 -0
- package/src/agents/react-agent.ts +928 -0
- package/src/agents/tool-runtime.ts +21 -0
- package/src/cli.ts +206 -0
- package/src/config.ts +309 -0
- package/src/index.ts +628 -0
- package/src/tools/file-finding.tool.ts +324 -0
- package/src/tools/file-listing.tool.ts +212 -0
- package/src/tools/file-reading.tool.ts +154 -0
- package/src/tools/grep-content.tool.ts +325 -0
- package/src/utils/file-utils.ts +39 -0
- package/src/utils/logger.ts +295 -0
- package/src/utils/path-utils.ts +17 -0
- package/tsconfig.json +37 -0
- package/tsconfig.test.json +17 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Context Schema for Agent Runtime
|
|
5
|
+
*
|
|
6
|
+
* Defines context object that is passed to agent during invocation.
|
|
7
|
+
* This provides static runtime context that tools can access via ToolRuntime.
|
|
8
|
+
*/
|
|
9
|
+
export const contextSchema = z.object({
|
|
10
|
+
/** The absolute path to sandbox directory where all file operations should be confined */
|
|
11
|
+
workingDir: z.string().describe("The absolute path to sandbox directory"),
|
|
12
|
+
/** Optional environment identifier (e.g., 'development', 'production') */
|
|
13
|
+
environment: z.string().optional().describe("Optional environment identifier"),
|
|
14
|
+
/** The technology group name (e.g., 'default', 'langchain') */
|
|
15
|
+
group: z.string().describe("The technology group name"),
|
|
16
|
+
/** The technology/repo name (e.g., 'react', 'openai') */
|
|
17
|
+
technology: z.string().describe("The technology/repo name"),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Type inference from contextSchema
|
|
22
|
+
* Use this type for context objects throughout the application
|
|
23
|
+
*/
|
|
24
|
+
export type Context = z.infer<typeof contextSchema>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Agent Context type passed during invocation.
|
|
28
|
+
* This matches the structure that LangChain tools expect (config.context.workingDir).
|
|
29
|
+
*/
|
|
30
|
+
export interface AgentContext {
|
|
31
|
+
workingDir: string;
|
|
32
|
+
environment?: string;
|
|
33
|
+
group: string;
|
|
34
|
+
technology: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Re-export for convenience
|
|
38
|
+
export type { AgentContext as AgentContextType };
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a context object with the given parameters.
|
|
42
|
+
*
|
|
43
|
+
* @param workingDir - The absolute path to sandbox directory
|
|
44
|
+
* @param group - The technology group name
|
|
45
|
+
* @param technology - The technology/repo name
|
|
46
|
+
* @param environment - Optional environment identifier
|
|
47
|
+
* @returns A validated context object
|
|
48
|
+
*/
|
|
49
|
+
export function createContext(
|
|
50
|
+
workingDir: string,
|
|
51
|
+
group: string,
|
|
52
|
+
technology: string,
|
|
53
|
+
environment?: string
|
|
54
|
+
): Context {
|
|
55
|
+
return contextSchema.parse({
|
|
56
|
+
workingDir,
|
|
57
|
+
group,
|
|
58
|
+
technology,
|
|
59
|
+
environment,
|
|
60
|
+
});
|
|
61
|
+
}
|