akemon 0.1.71 → 0.1.73

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/dist/cli.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  .option("-w, --workdir <path>", "Working directory for the engine (default: cwd)")
26
26
  .option("-n, --name <name>", "Agent name", "my-agent")
27
27
  .option("-m, --model <model>", "Model to use (e.g. claude-sonnet-4-6, gpt-4o)")
28
- .option("--engine <engine>", "Engine: claude, codex, opencode, gemini, local, human, or any CLI", "claude")
28
+ .option("--engine <engine>", "Engine: claude, codex, opencode, gemini, raw, human, or any CLI", "claude")
29
29
  .option("--desc <description>", "Agent description (for discovery)")
30
30
  .option("--tags <tags>", "Comma-separated tags (e.g. vue,frontend,review)")
31
31
  .option("--public", "Allow anyone to call this agent without a key")
package/dist/server.js CHANGED
@@ -717,13 +717,14 @@ Now:
717
717
  Reply in the same language as the question.`;
718
718
  return await runEngine(engine, model, allowAll, synthesisPrompt, workdir);
719
719
  }
720
- const LLM_ENGINES = new Set(["claude", "codex", "opencode", "gemini", "local"]);
720
+ const LLM_ENGINES = new Set(["claude", "codex", "opencode", "gemini", "raw"]);
721
721
  // ---------------------------------------------------------------------------
722
- // Local engine: tool call loop over OpenAI-compatible API (Ollama, llama.cpp)
722
+ // Raw engine: tool call loop over OpenAI-compatible API (Ollama, llama.cpp, OpenRouter, etc)
723
723
  // ---------------------------------------------------------------------------
724
- const LOCAL_API_URL = process.env.AKEMON_LOCAL_URL || "http://localhost:11434/v1";
725
- const LOCAL_MAX_ROUNDS = 20;
726
- const LOCAL_TOOLS = [
724
+ const RAW_API_URL = process.env.AKEMON_RAW_URL || "http://localhost:11434/v1";
725
+ const RAW_API_KEY = process.env.AKEMON_RAW_KEY || "";
726
+ const RAW_MAX_ROUNDS = 20;
727
+ const RAW_TOOLS = [
727
728
  {
728
729
  type: "function",
729
730
  function: {
@@ -782,7 +783,7 @@ const LOCAL_TOOLS = [
782
783
  },
783
784
  },
784
785
  ];
785
- async function executeLocalTool(name, args, workdir) {
786
+ async function executeRawTool(name, args, workdir) {
786
787
  const { readFile: rf, writeFile: wf, mkdir: mkd } = await import("fs/promises");
787
788
  const { join, dirname, isAbsolute } = await import("path");
788
789
  const resolvePath = (p) => isAbsolute(p) ? p : join(workdir, p);
@@ -819,21 +820,23 @@ async function executeLocalTool(name, args, workdir) {
819
820
  return `[error] ${err.message}`;
820
821
  }
821
822
  }
822
- async function runLocalEngine(task, model, workdir) {
823
- const apiUrl = LOCAL_API_URL + "/chat/completions";
823
+ async function runRawEngine(task, model, workdir) {
824
+ const apiUrl = RAW_API_URL + "/chat/completions";
824
825
  const modelName = model || "gemma4:4b";
825
- console.log(`[local] Task:\n${task}`);
826
+ console.log(`[raw] Task:\n${task}`);
826
827
  const messages = [
827
828
  { role: "system", content: "You are a helpful agent. Use tools when needed to complete the task. When done, reply with your final answer in plain text." },
828
829
  { role: "user", content: task },
829
830
  ];
830
- for (let round = 0; round < LOCAL_MAX_ROUNDS; round++) {
831
- const body = { model: modelName, messages, tools: LOCAL_TOOLS };
831
+ for (let round = 0; round < RAW_MAX_ROUNDS; round++) {
832
+ const body = { model: modelName, messages, tools: RAW_TOOLS };
832
833
  let data;
833
834
  try {
834
835
  const res = await fetch(apiUrl, {
835
836
  method: "POST",
836
- headers: { "Content-Type": "application/json" },
837
+ headers: RAW_API_KEY
838
+ ? { "Content-Type": "application/json", "Authorization": `Bearer ${RAW_API_KEY}` }
839
+ : { "Content-Type": "application/json" },
837
840
  body: JSON.stringify(body),
838
841
  signal: AbortSignal.timeout(300_000),
839
842
  });
@@ -844,7 +847,7 @@ async function runLocalEngine(task, model, workdir) {
844
847
  data = await res.json();
845
848
  }
846
849
  catch (err) {
847
- console.log(`[local] API error: ${err.message}`);
850
+ console.log(`[raw] API error: ${err.message}`);
848
851
  throw err;
849
852
  }
850
853
  const choice = data.choices?.[0];
@@ -865,8 +868,8 @@ async function runLocalEngine(task, model, workdir) {
865
868
  catch {
866
869
  fnArgs = {};
867
870
  }
868
- console.log(`[local] Tool call: ${fnName}(${JSON.stringify(fnArgs).slice(0, 100)})`);
869
- const result = await executeLocalTool(fnName, fnArgs, workdir);
871
+ console.log(`[raw] Tool call: ${fnName}(${JSON.stringify(fnArgs).slice(0, 100)})`);
872
+ const result = await executeRawTool(fnName, fnArgs, workdir);
870
873
  messages.push({
871
874
  role: "tool",
872
875
  tool_call_id: tc.id,
@@ -878,16 +881,16 @@ async function runLocalEngine(task, model, workdir) {
878
881
  // No tool calls — this is the final response
879
882
  const content = msg.content || "";
880
883
  if (content.trim()) {
881
- console.log(`[local] Done in ${round + 1} round(s), response:\n${content}`);
884
+ console.log(`[raw] Done in ${round + 1} round(s), response:\n${content}`);
882
885
  return content.trim();
883
886
  }
884
887
  }
885
- throw new Error(`Local engine exceeded ${LOCAL_MAX_ROUNDS} rounds without final answer`);
888
+ throw new Error(`Raw engine exceeded ${RAW_MAX_ROUNDS} rounds without final answer`);
886
889
  }
887
890
  /** Unified engine runner — dispatches to local API or external CLI */
888
891
  function runEngine(engine, model, allowAll, task, workdir, extraAllowedTools) {
889
- if (engine === "local") {
890
- return runLocalEngine(task, model, workdir);
892
+ if (engine === "raw") {
893
+ return runRawEngine(task, model, workdir);
891
894
  }
892
895
  const engineCmd = buildEngineCommand(engine, model, allowAll, extraAllowedTools);
893
896
  return runCommand(engineCmd.cmd, engineCmd.args, task, workdir, engineCmd.stdinMode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akemon",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "description": "Agent work marketplace — train your agent, let it work for others",
5
5
  "type": "module",
6
6
  "license": "MIT",