@agentprojectcontext/apx 1.15.5 → 1.15.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentprojectcontext/apx",
3
- "version": "1.15.5",
3
+ "version": "1.15.6",
4
4
  "description": "APX — unified CLI + daemon for the Agent Project Context (APC) standard.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -5,33 +5,28 @@ import { resolveProvider, getAdapter } from "./engines/index.js";
5
5
 
6
6
  const WAKEUP_COOLDOWN_MS = 30 * 60 * 1000; // 30 min
7
7
 
8
- // Detect preferred language from identity, then fall back to system LANG env.
9
- function detectLanguage(identity) {
10
- if (identity.language) return identity.language;
8
+ const ISO_TO_LANGUAGE = {
9
+ es: "Spanish", en: "English", fr: "French", pt: "Portuguese",
10
+ de: "German", it: "Italian", nl: "Dutch", ru: "Russian",
11
+ ja: "Japanese", zh: "Chinese", ko: "Korean", ar: "Arabic",
12
+ };
13
+
14
+ // Exported for unit testing.
15
+ // Priority: config.user.language (ISO 639-1) → identity.language (legacy) → system LANG env.
16
+ export function detectLanguage(identity, config) {
17
+ const cfgLang = config?.user?.language;
18
+ if (cfgLang) return ISO_TO_LANGUAGE[cfgLang.toLowerCase()] || cfgLang;
19
+ if (identity?.language) return identity.language;
11
20
  const lang = process.env.LANG || process.env.LC_MESSAGES || process.env.LC_ALL || "";
12
21
  const code = lang.split(/[_\.]/)[0].toLowerCase();
13
- const map = {
14
- es: "Spanish",
15
- en: "English",
16
- fr: "French",
17
- pt: "Portuguese",
18
- de: "German",
19
- it: "Italian",
20
- nl: "Dutch",
21
- ru: "Russian",
22
- ja: "Japanese",
23
- zh: "Chinese",
24
- ko: "Korean",
25
- ar: "Arabic",
26
- };
27
- return map[code] || "English";
22
+ return ISO_TO_LANGUAGE[code] || "English";
28
23
  }
29
24
 
30
25
  async function generateMessage(identity, engineConfig) {
31
26
  try {
32
27
  const { provider, model } = resolveProvider("ollama:qwen2.5:14b");
33
28
  const engine = getAdapter(provider);
34
- const language = detectLanguage(identity);
29
+ const language = detectLanguage(identity, engineConfig);
35
30
  const result = await engine.chat({
36
31
  system: `You are ${identity.agent_name}, an AI agent assistant. Your personality: ${identity.personality || "direct, curious, helpful"}. Your owner is ${identity.owner_name}. Context: ${identity.owner_context || "AI developer"}.`,
37
32
  messages: [