@wanghuimvp/axon 0.4.1 → 0.4.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +22 -12
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -834,6 +834,21 @@ ${truncate2(text, 2e3)}`);
834
834
  return parts.join("\n\n");
835
835
  }
836
836
 
837
+ // src/core/systemPrompt.ts
838
+ function buildSystemPrompt(opts) {
839
+ const identity = `You are the coding agent inside Axon, a command-line coding tool. Axon is the CLI program \u2014 it is NOT a language model. You are powered by the model "${opts.model}" via the ${opts.provider} provider. If the user asks which model or LLM you are, answer honestly: "${opts.model}" (via ${opts.provider}), running inside the Axon CLI. Never claim that "Axon" is a model.`;
840
+ const toolLine = opts.tools === "all" ? `Use the tools to inspect AND modify the project: read_file, list_dir, glob, grep (read-only) and write_file, edit_file, shell (these change the workspace; the user is prompted to approve each). Prefer edit_file for surgical changes.` : `Use the read-only tools to inspect the project: read_file, list_dir, glob, grep.`;
841
+ const closing = `Explain briefly what you are doing. When the task is done, stop calling tools.`;
842
+ let prompt = `${identity}
843
+
844
+ ${toolLine} ${closing}`;
845
+ if (opts.context) prompt += `
846
+
847
+ Project context:
848
+ ${opts.context}`;
849
+ return prompt;
850
+ }
851
+
837
852
  // src/ui/permissionController.ts
838
853
  function createPermissionController() {
839
854
  const sessionAllow = /* @__PURE__ */ new Set();
@@ -1119,7 +1134,6 @@ function Setup({
1119
1134
 
1120
1135
  // src/ui/runTui.tsx
1121
1136
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1122
- var TUI_SYSTEM = `You are Axon, an interactive agentic coding assistant. Use the tools to inspect and modify the project: read_file, list_dir, glob, grep (read-only) and write_file, edit_file, shell (these change the workspace; the user is prompted to approve each). Prefer edit_file for surgical changes. Explain briefly what you are doing.`;
1123
1137
  function Root({ deps }) {
1124
1138
  const { cfg, controller, yolo, buildEngine, persistKey } = deps;
1125
1139
  const [ready, setReady] = useState3(hasUsableKey(cfg));
@@ -1180,10 +1194,7 @@ function runTui(opts) {
1180
1194
  const tools = buildAllTools();
1181
1195
  const gate = opts.yolo ? allowAllGate : controller.gate;
1182
1196
  const context = loadProjectContext(process.cwd());
1183
- const system = TUI_SYSTEM + (context ? `
1184
-
1185
- Project context:
1186
- ${context}` : "");
1197
+ const system = buildSystemPrompt({ provider: cfg.provider, model: resolveModel(cfg), tools: "all", context });
1187
1198
  return new Engine({ provider, tools, system, cwd: process.cwd(), gate });
1188
1199
  }
1189
1200
  };
@@ -1195,8 +1206,6 @@ ${context}` : "");
1195
1206
  }
1196
1207
 
1197
1208
  // src/cli.ts
1198
- var READONLY_SYSTEM = `You are Axon, an agentic coding assistant. Use the read-only tools \u2014 read_file, list_dir, glob, grep \u2014 to inspect the project and answer precisely. When done, stop calling tools.`;
1199
- var YOLO_SYSTEM = `You are Axon, an agentic coding assistant. Use the provided tools to inspect AND modify the project: read_file, list_dir, glob, grep (read-only), and write_file, edit_file, shell (these change the workspace). Prefer edit_file for surgical changes. When done, stop calling tools.`;
1200
1209
  function redactKeys(cfg) {
1201
1210
  const providers = cfg.providers;
1202
1211
  if (!providers || typeof providers !== "object") return cfg;
@@ -1242,12 +1251,13 @@ async function main(opts) {
1242
1251
  const provider = createProvider(cfg);
1243
1252
  const tools = opts.yolo ? buildAllTools() : buildReadOnlyTools();
1244
1253
  const gate = opts.yolo ? allowAllGate : denyGate;
1245
- const baseSystem = opts.yolo ? YOLO_SYSTEM : READONLY_SYSTEM;
1246
1254
  const context = loadProjectContext(process.cwd());
1247
- const system = baseSystem + (context ? `
1248
-
1249
- Project context:
1250
- ${context}` : "");
1255
+ const system = buildSystemPrompt({
1256
+ provider: cfg.provider,
1257
+ model: resolveModel(cfg),
1258
+ tools: opts.yolo ? "all" : "readonly",
1259
+ context
1260
+ });
1251
1261
  const engine = new Engine({ provider, tools, system, cwd: process.cwd(), gate });
1252
1262
  printRunner(engine, (s) => process.stdout.write(s));
1253
1263
  process.stderr.write(`[axon: ${cfg.provider} / ${resolveModel(cfg)}${opts.yolo ? " / yolo" : ""}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wanghuimvp/axon",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Axon — a multi-provider agentic coding CLI (Anthropic, OpenAI + OpenAI-compatible endpoints, Gemini). Runs a multi-step tool loop over your codebase.",
5
5
  "type": "module",
6
6
  "bin": {