@autonav/core 1.0.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/README.md +115 -0
- package/dist/adapter/claude-adapter.d.ts +136 -0
- package/dist/adapter/claude-adapter.d.ts.map +1 -0
- package/dist/adapter/claude-adapter.js +340 -0
- package/dist/adapter/claude-adapter.js.map +1 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +7 -0
- package/dist/adapter/index.js.map +1 -0
- package/dist/cli/autonav.d.ts +11 -0
- package/dist/cli/autonav.d.ts.map +1 -0
- package/dist/cli/autonav.js +79 -0
- package/dist/cli/autonav.js.map +1 -0
- package/dist/cli/nav-chat.d.ts +3 -0
- package/dist/cli/nav-chat.d.ts.map +1 -0
- package/dist/cli/nav-chat.js +151 -0
- package/dist/cli/nav-chat.js.map +1 -0
- package/dist/cli/nav-init.d.ts +3 -0
- package/dist/cli/nav-init.d.ts.map +1 -0
- package/dist/cli/nav-init.js +366 -0
- package/dist/cli/nav-init.js.map +1 -0
- package/dist/cli/nav-query.d.ts +3 -0
- package/dist/cli/nav-query.d.ts.map +1 -0
- package/dist/cli/nav-query.js +217 -0
- package/dist/cli/nav-query.js.map +1 -0
- package/dist/conversation/App.d.ts +14 -0
- package/dist/conversation/App.d.ts.map +1 -0
- package/dist/conversation/App.js +229 -0
- package/dist/conversation/App.js.map +1 -0
- package/dist/conversation/index.d.ts +29 -0
- package/dist/conversation/index.d.ts.map +1 -0
- package/dist/conversation/index.js +44 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/prompts.d.ts +9 -0
- package/dist/conversation/prompts.d.ts.map +1 -0
- package/dist/conversation/prompts.js +47 -0
- package/dist/conversation/prompts.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/interview/App.d.ts +14 -0
- package/dist/interview/App.d.ts.map +1 -0
- package/dist/interview/App.js +159 -0
- package/dist/interview/App.js.map +1 -0
- package/dist/interview/index.d.ts +30 -0
- package/dist/interview/index.d.ts.map +1 -0
- package/dist/interview/index.js +52 -0
- package/dist/interview/index.js.map +1 -0
- package/dist/interview/prompts.d.ts +36 -0
- package/dist/interview/prompts.d.ts.map +1 -0
- package/dist/interview/prompts.js +116 -0
- package/dist/interview/prompts.js.map +1 -0
- package/dist/pack-installer/github.d.ts +41 -0
- package/dist/pack-installer/github.d.ts.map +1 -0
- package/dist/pack-installer/github.js +294 -0
- package/dist/pack-installer/github.js.map +1 -0
- package/dist/pack-installer/index.d.ts +57 -0
- package/dist/pack-installer/index.d.ts.map +1 -0
- package/dist/pack-installer/index.js +257 -0
- package/dist/pack-installer/index.js.map +1 -0
- package/dist/plugins/config-schema.d.ts +32 -0
- package/dist/plugins/config-schema.d.ts.map +1 -0
- package/dist/plugins/config-schema.js +26 -0
- package/dist/plugins/config-schema.js.map +1 -0
- package/dist/plugins/implementations/file-watcher/index.d.ts +110 -0
- package/dist/plugins/implementations/file-watcher/index.d.ts.map +1 -0
- package/dist/plugins/implementations/file-watcher/index.js +212 -0
- package/dist/plugins/implementations/file-watcher/index.js.map +1 -0
- package/dist/plugins/implementations/github/index.d.ts +201 -0
- package/dist/plugins/implementations/github/index.d.ts.map +1 -0
- package/dist/plugins/implementations/github/index.js +337 -0
- package/dist/plugins/implementations/github/index.js.map +1 -0
- package/dist/plugins/implementations/slack/index.d.ts +153 -0
- package/dist/plugins/implementations/slack/index.d.ts.map +1 -0
- package/dist/plugins/implementations/slack/index.js +221 -0
- package/dist/plugins/implementations/slack/index.js.map +1 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +35 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +66 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.js +198 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/plugins/types.d.ts +102 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +38 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/plugins/utils/security.d.ts +43 -0
- package/dist/plugins/utils/security.d.ts.map +1 -0
- package/dist/plugins/utils/security.js +115 -0
- package/dist/plugins/utils/security.js.map +1 -0
- package/dist/query-engine/index.d.ts +10 -0
- package/dist/query-engine/index.d.ts.map +1 -0
- package/dist/query-engine/index.js +10 -0
- package/dist/query-engine/index.js.map +1 -0
- package/dist/query-engine/navigator-loader.d.ts +37 -0
- package/dist/query-engine/navigator-loader.d.ts.map +1 -0
- package/dist/query-engine/navigator-loader.js +167 -0
- package/dist/query-engine/navigator-loader.js.map +1 -0
- package/dist/query-engine/output-formatter.d.ts +55 -0
- package/dist/query-engine/output-formatter.d.ts.map +1 -0
- package/dist/query-engine/output-formatter.js +165 -0
- package/dist/query-engine/output-formatter.js.map +1 -0
- package/dist/query-engine/response-validator.d.ts +55 -0
- package/dist/query-engine/response-validator.d.ts.map +1 -0
- package/dist/query-engine/response-validator.js +92 -0
- package/dist/query-engine/response-validator.js.map +1 -0
- package/dist/templates/.gitignore.template +23 -0
- package/dist/templates/CLAUDE-pack.md.template +32 -0
- package/dist/templates/CLAUDE.md.template +128 -0
- package/dist/templates/README.md.template +174 -0
- package/dist/templates/config-pack.json.template +16 -0
- package/dist/templates/config.json.template +11 -0
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +32 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/plugins.json.template +33 -0
- package/dist/templates/system-configuration.md.template +66 -0
- package/dist/tools/handler.d.ts +20 -0
- package/dist/tools/handler.d.ts.map +1 -0
- package/dist/tools/handler.js +202 -0
- package/dist/tools/handler.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/response.d.ts +30 -0
- package/dist/tools/response.d.ts.map +1 -0
- package/dist/tools/response.js +68 -0
- package/dist/tools/response.js.map +1 -0
- package/dist/tools/self-config.d.ts +54 -0
- package/dist/tools/self-config.d.ts.map +1 -0
- package/dist/tools/self-config.js +84 -0
- package/dist/tools/self-config.js.map +1 -0
- package/dist/validation/index.d.ts +19 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +91 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response Tools for Autonav Navigators
|
|
3
|
+
*
|
|
4
|
+
* These tools allow navigators to submit structured responses
|
|
5
|
+
* using Zod-validated schemas, providing the benefits of
|
|
6
|
+
* Claude's Structured Outputs through tool use.
|
|
7
|
+
*
|
|
8
|
+
* Uses MCP format for integration with Claude Agent SDK.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
|
|
12
|
+
import { NavigatorResponseSchema, PROTOCOL_VERSION, } from "@autonav/communication-layer";
|
|
13
|
+
/**
|
|
14
|
+
* Create an MCP server with response tools
|
|
15
|
+
*
|
|
16
|
+
* The submit_answer tool allows Claude to submit structured responses
|
|
17
|
+
* that are validated against the NavigatorResponse schema.
|
|
18
|
+
* This achieves the same result as Claude's Structured Outputs
|
|
19
|
+
* but works within the Claude Agent SDK's tool use flow.
|
|
20
|
+
*/
|
|
21
|
+
export function createResponseMcpServer() {
|
|
22
|
+
const submitAnswerTool = tool("submit_answer", `Submit your final answer to the user's question. You MUST use this tool to provide your response.
|
|
23
|
+
|
|
24
|
+
This ensures your answer follows the required structure with proper source citations.
|
|
25
|
+
Do NOT respond with plain text - always use this tool to submit your answer.`, {
|
|
26
|
+
answer: z.string().min(1).describe("Your complete answer to the question, grounded in the knowledge base. Include relevant details and cite sources inline where helpful."),
|
|
27
|
+
sources: z.array(z.object({
|
|
28
|
+
file: z.string().min(1).describe("Filename from knowledge base (relative path)"),
|
|
29
|
+
section: z.string().min(1).describe("Specific section or heading in the file"),
|
|
30
|
+
relevance: z.string().min(1).describe("Brief explanation of why this source supports the answer"),
|
|
31
|
+
})).min(1).describe("List of sources from the knowledge base that support your answer. Must include at least one source."),
|
|
32
|
+
confidence: z.number().min(0).max(1).describe("Confidence score from 0 to 1. Use 0.8-1.0 for well-grounded answers with multiple sources, 0.5-0.8 for partially supported answers, below 0.5 if uncertain."),
|
|
33
|
+
}, async (args) => {
|
|
34
|
+
// Validate against the full schema (adds protocolVersion, timestamp, etc.)
|
|
35
|
+
const response = NavigatorResponseSchema.parse({
|
|
36
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
37
|
+
query: "", // Will be populated by ClaudeAdapter
|
|
38
|
+
answer: args.answer,
|
|
39
|
+
sources: args.sources,
|
|
40
|
+
confidence: args.confidence,
|
|
41
|
+
timestamp: new Date().toISOString(),
|
|
42
|
+
});
|
|
43
|
+
// Return success - the ClaudeAdapter will extract the response
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: JSON.stringify({
|
|
49
|
+
success: true,
|
|
50
|
+
message: "Answer submitted successfully",
|
|
51
|
+
response,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
isError: false,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
return createSdkMcpServer({
|
|
59
|
+
name: "autonav-response",
|
|
60
|
+
version: "1.0.0",
|
|
61
|
+
tools: [submitAnswerTool],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Tool name constant for detection in ClaudeAdapter
|
|
66
|
+
*/
|
|
67
|
+
export const SUBMIT_ANSWER_TOOL = "submit_answer";
|
|
68
|
+
//# sourceMappingURL=response.js.map
|
|
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E,gBAAgB;YACjC,KAAK,EAAE,EAAE,EAAE,qCAAqC;YAChD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;QAEH,+DAA+D;QAC/D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,+BAA+B;wBACxC,QAAQ;qBACT,CAAC;iBACH;aACF;YACD,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,CAAC,gBAAgB,CAAC;KAC1B,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Configuration Tools for Autonav Navigators
|
|
3
|
+
*
|
|
4
|
+
* These tools allow navigators to modify their own configuration
|
|
5
|
+
* during conversations, enabling autonomous self-management.
|
|
6
|
+
*
|
|
7
|
+
* Uses MCP format for integration with Claude Agent SDK.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* User: "Check in with me tomorrow at 3pm"
|
|
11
|
+
* Nav: [Uses update_plugin_config tool to schedule check-in]
|
|
12
|
+
*/
|
|
13
|
+
import type { PluginManager } from "../plugins/index.js";
|
|
14
|
+
/**
|
|
15
|
+
* Available plugins that can be configured
|
|
16
|
+
*/
|
|
17
|
+
export declare const CONFIGURABLE_PLUGINS: readonly ["slack", "signal", "github", "email"];
|
|
18
|
+
export type ConfigurablePlugin = (typeof CONFIGURABLE_PLUGINS)[number];
|
|
19
|
+
/**
|
|
20
|
+
* Input type for update_plugin_config tool
|
|
21
|
+
*/
|
|
22
|
+
export interface UpdatePluginConfigInput {
|
|
23
|
+
plugin: ConfigurablePlugin;
|
|
24
|
+
updates: Record<string, unknown>;
|
|
25
|
+
reason: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Input type for get_plugin_config tool
|
|
29
|
+
*/
|
|
30
|
+
export interface GetPluginConfigInput {
|
|
31
|
+
plugin: ConfigurablePlugin | "all";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Result of a self-configuration operation
|
|
35
|
+
*/
|
|
36
|
+
export interface SelfConfigResult {
|
|
37
|
+
success: boolean;
|
|
38
|
+
message: string;
|
|
39
|
+
plugin: string;
|
|
40
|
+
changes?: Record<string, unknown>;
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create an MCP server with self-configuration tools
|
|
45
|
+
*
|
|
46
|
+
* The tools allow the navigator to:
|
|
47
|
+
* - Read its current plugin configuration
|
|
48
|
+
* - Update plugin settings (scheduling, notifications, etc.)
|
|
49
|
+
*
|
|
50
|
+
* @param pluginManager - Optional plugin manager for runtime updates
|
|
51
|
+
* @param pluginsConfigPath - Path to the plugins.json configuration file
|
|
52
|
+
*/
|
|
53
|
+
export declare function createSelfConfigMcpServer(pluginManager: PluginManager | undefined, pluginsConfigPath: string): import("@anthropic-ai/claude-agent-sdk").McpSdkServerConfigWithInstance;
|
|
54
|
+
//# sourceMappingURL=self-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-config.d.ts","sourceRoot":"","sources":["../../src/tools/self-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzD;;GAEG;AACH,eAAO,MAAM,oBAAoB,iDAAkD,CAAC;AACpF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,kBAAkB,GAAG,KAAK,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,iBAAiB,EAAE,MAAM,2EAmF1B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Configuration Tools for Autonav Navigators
|
|
3
|
+
*
|
|
4
|
+
* These tools allow navigators to modify their own configuration
|
|
5
|
+
* during conversations, enabling autonomous self-management.
|
|
6
|
+
*
|
|
7
|
+
* Uses MCP format for integration with Claude Agent SDK.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* User: "Check in with me tomorrow at 3pm"
|
|
11
|
+
* Nav: [Uses update_plugin_config tool to schedule check-in]
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
|
|
15
|
+
import { handleUpdatePluginConfig, handleGetPluginConfig, } from "./handler.js";
|
|
16
|
+
/**
|
|
17
|
+
* Available plugins that can be configured
|
|
18
|
+
*/
|
|
19
|
+
export const CONFIGURABLE_PLUGINS = ["slack", "signal", "github", "email"];
|
|
20
|
+
/**
|
|
21
|
+
* Create an MCP server with self-configuration tools
|
|
22
|
+
*
|
|
23
|
+
* The tools allow the navigator to:
|
|
24
|
+
* - Read its current plugin configuration
|
|
25
|
+
* - Update plugin settings (scheduling, notifications, etc.)
|
|
26
|
+
*
|
|
27
|
+
* @param pluginManager - Optional plugin manager for runtime updates
|
|
28
|
+
* @param pluginsConfigPath - Path to the plugins.json configuration file
|
|
29
|
+
*/
|
|
30
|
+
export function createSelfConfigMcpServer(pluginManager, pluginsConfigPath) {
|
|
31
|
+
const updatePluginConfigTool = tool("update_plugin_config", `Update your own plugin configuration. Use this when the user asks you to:
|
|
32
|
+
- Schedule check-ins or reminders (signal plugin)
|
|
33
|
+
- Change notification settings or frequency
|
|
34
|
+
- Enable/disable plugins
|
|
35
|
+
- Update channel preferences (slack plugin)
|
|
36
|
+
- Modify any plugin behavior
|
|
37
|
+
|
|
38
|
+
This allows you to autonomously manage your own behavior based on user requests.`, {
|
|
39
|
+
plugin: z.enum(CONFIGURABLE_PLUGINS).describe("The plugin to configure (slack, signal, github, or email)"),
|
|
40
|
+
updates: z.record(z.unknown()).describe(`Configuration updates to apply. Common patterns:
|
|
41
|
+
- signal: { checkInSchedule: "custom", nextCheckIn: "2025-01-15T15:00:00Z", notificationTypes: ["urgent"] }
|
|
42
|
+
- slack: { channels: ["platform-team"], summaryFrequency: "weekly" }
|
|
43
|
+
- github: { repositories: ["org/repo"], issueLabels: ["docs"] }`),
|
|
44
|
+
reason: z.string().describe("Brief explanation of why you're making this change (for logging)"),
|
|
45
|
+
}, async (args) => {
|
|
46
|
+
const result = await handleUpdatePluginConfig({
|
|
47
|
+
plugin: args.plugin,
|
|
48
|
+
updates: args.updates,
|
|
49
|
+
reason: args.reason,
|
|
50
|
+
}, pluginManager, pluginsConfigPath);
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: JSON.stringify(result),
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
isError: !result.success,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const getPluginConfigTool = tool("get_plugin_config", `Read your current plugin configuration. Use this to:
|
|
62
|
+
- Check what plugins are currently enabled
|
|
63
|
+
- See current notification settings before changing them
|
|
64
|
+
- Verify your current schedule or preferences`, {
|
|
65
|
+
plugin: z.enum([...CONFIGURABLE_PLUGINS, "all"]).describe("The plugin to read configuration for, or 'all' for all plugins"),
|
|
66
|
+
}, async (args) => {
|
|
67
|
+
const result = await handleGetPluginConfig({ plugin: args.plugin }, pluginsConfigPath);
|
|
68
|
+
return {
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
type: "text",
|
|
72
|
+
text: JSON.stringify(result),
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
isError: !result.success,
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
return createSdkMcpServer({
|
|
79
|
+
name: "autonav-self-config",
|
|
80
|
+
version: "1.0.0",
|
|
81
|
+
tools: [updatePluginConfigTool, getPluginConfigTool],
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=self-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-config.js","sourceRoot":"","sources":["../../src/tools/self-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AA8BpF;;;;;;;;;GASG;AACH,MA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e;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;iBAC7B;aACF;YACD,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO;SACzB,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;KACrD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for navigator names and structure
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Validate navigator name
|
|
6
|
+
* Names must be valid directory names without special characters (except hyphens and underscores)
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateNavigatorName(name: string): {
|
|
9
|
+
valid: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Validate created navigator structure
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateNavigatorStructure(navigatorDir: string): {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
errors: string[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG;IACnD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAqCA;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAuDA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for navigator names and structure
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Validate navigator name
|
|
6
|
+
* Names must be valid directory names without special characters (except hyphens and underscores)
|
|
7
|
+
*/
|
|
8
|
+
export function validateNavigatorName(name) {
|
|
9
|
+
if (!name || name.trim().length === 0) {
|
|
10
|
+
return { valid: false, error: "Navigator name cannot be empty" };
|
|
11
|
+
}
|
|
12
|
+
if (name.startsWith("-") || name.startsWith(".")) {
|
|
13
|
+
return {
|
|
14
|
+
valid: false,
|
|
15
|
+
error: "Navigator name cannot start with '-' or '.'",
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// Check for invalid characters (allow alphanumeric, hyphens, underscores)
|
|
19
|
+
const invalidChars = /[^a-zA-Z0-9\-_]/;
|
|
20
|
+
if (invalidChars.test(name)) {
|
|
21
|
+
return {
|
|
22
|
+
valid: false,
|
|
23
|
+
error: "Navigator name can only contain letters, numbers, hyphens, and underscores",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// Reserved names
|
|
27
|
+
const reserved = [
|
|
28
|
+
"node_modules",
|
|
29
|
+
".git",
|
|
30
|
+
".env",
|
|
31
|
+
"dist",
|
|
32
|
+
"build",
|
|
33
|
+
"test",
|
|
34
|
+
"tests",
|
|
35
|
+
];
|
|
36
|
+
if (reserved.includes(name.toLowerCase())) {
|
|
37
|
+
return { valid: false, error: `'${name}' is a reserved name` };
|
|
38
|
+
}
|
|
39
|
+
return { valid: true };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validate created navigator structure
|
|
43
|
+
*/
|
|
44
|
+
export function validateNavigatorStructure(navigatorDir) {
|
|
45
|
+
const errors = [];
|
|
46
|
+
const fs = require("node:fs");
|
|
47
|
+
const path = require("node:path");
|
|
48
|
+
// Check required files exist
|
|
49
|
+
const requiredFiles = ["config.json", "CLAUDE.md", ".gitignore"];
|
|
50
|
+
for (const file of requiredFiles) {
|
|
51
|
+
const filePath = path.join(navigatorDir, file);
|
|
52
|
+
if (!fs.existsSync(filePath)) {
|
|
53
|
+
errors.push(`Missing required file: ${file}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Check required directories exist
|
|
57
|
+
const requiredDirs = ["knowledge", ".claude"];
|
|
58
|
+
for (const dir of requiredDirs) {
|
|
59
|
+
const dirPath = path.join(navigatorDir, dir);
|
|
60
|
+
if (!fs.existsSync(dirPath)) {
|
|
61
|
+
errors.push(`Missing required directory: ${dir}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Check config.json is valid JSON
|
|
65
|
+
try {
|
|
66
|
+
const configPath = path.join(navigatorDir, "config.json");
|
|
67
|
+
if (fs.existsSync(configPath)) {
|
|
68
|
+
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
69
|
+
JSON.parse(configContent);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
errors.push(`Invalid config.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
74
|
+
}
|
|
75
|
+
// Check plugins.json is valid JSON if it exists
|
|
76
|
+
try {
|
|
77
|
+
const pluginsPath = path.join(navigatorDir, ".claude", "plugins.json");
|
|
78
|
+
if (fs.existsSync(pluginsPath)) {
|
|
79
|
+
const pluginsContent = fs.readFileSync(pluginsPath, "utf-8");
|
|
80
|
+
JSON.parse(pluginsContent);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
errors.push(`Invalid plugins.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
valid: errors.length === 0,
|
|
88
|
+
errors,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MA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,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACvE,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7D,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CACT,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autonav/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tools and Claude SDK Adapter for Autonav navigators",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"autonav": "./dist/cli/autonav.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc && node scripts/post-build.mjs",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"typecheck": "tsc --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"autonav",
|
|
26
|
+
"navigator",
|
|
27
|
+
"cli",
|
|
28
|
+
"claude",
|
|
29
|
+
"agent-sdk"
|
|
30
|
+
],
|
|
31
|
+
"author": "Terra",
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/terraboops/platform-ai.git",
|
|
36
|
+
"directory": "packages/autonav"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/terraboops/platform-ai#readme",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/terraboops/platform-ai/issues"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@anthropic-ai/claude-agent-sdk": "^0.1.55",
|
|
48
|
+
"@anthropic-ai/sdk": "^0.52.0",
|
|
49
|
+
"@autonav/communication-layer": "*",
|
|
50
|
+
"@octokit/rest": "^20.0.2",
|
|
51
|
+
"@slack/web-api": "^6.11.2",
|
|
52
|
+
"@types/micromatch": "^4.0.10",
|
|
53
|
+
"chalk": "^4.1.2",
|
|
54
|
+
"chokidar": "^3.5.3",
|
|
55
|
+
"commander": "^14.0.2",
|
|
56
|
+
"ink": "^5.1.0",
|
|
57
|
+
"ink-text-input": "^6.0.0",
|
|
58
|
+
"micromatch": "^4.0.8",
|
|
59
|
+
"ora": "^5.4.1",
|
|
60
|
+
"react": "^18.3.1",
|
|
61
|
+
"tar": "^6.2.0",
|
|
62
|
+
"zod": "^3.24.1"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^20.0.0",
|
|
66
|
+
"@types/react": "^18.3.0",
|
|
67
|
+
"@types/tar": "^6.1.0",
|
|
68
|
+
"typescript": "^5.3.0",
|
|
69
|
+
"vitest": "^1.2.0"
|
|
70
|
+
}
|
|
71
|
+
}
|