@things-factory/codelingua 10.1.154 → 10.1.157

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.
@@ -1,4 +1,16 @@
1
- import { type AIClient } from '@things-factory/ai-client-base';
2
- export declare function getCodelinguaClient(): AIClient;
3
- /** Test 용 reset. */
4
- export declare function _resetCodelinguaClient(): void;
1
+ /**
2
+ * The AI codelingua answers with: the AI agent of the domain the request is made in (design/ai/agent-settings.md).
3
+ *
4
+ * Its use - an error message turned into a sentence a person can act on - belongs to no provider, so it takes the
5
+ * domain's agent like every other caller. A domain with no agent gets the fallback sentence.
6
+ */
7
+ import { type AgentClient } from '@things-factory/ai-client-base';
8
+ export interface CodelinguaRequest {
9
+ domain: {
10
+ id: string;
11
+ };
12
+ user?: {
13
+ id: string;
14
+ } | null;
15
+ }
16
+ export declare function getCodelinguaClient(request: CodelinguaRequest): Promise<AgentClient>;
@@ -1,46 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCodelinguaClient = getCodelinguaClient;
4
- exports._resetCodelinguaClient = _resetCodelinguaClient;
5
4
  /**
6
- * codelingua 의 AI client 획득 — backward 호환 + provider-agnostic.
5
+ * The AI codelingua answers with: the AI agent of the domain the request is made in (design/ai/agent-settings.md).
7
6
  *
8
- * 우선순위:
9
- * 1. ai-client-base 의 default client (config.aiClient — 권장 신규 방식)
10
- * 2. legacy config.openai: { organization, apiKey } (기존 codelingua 사용자)
11
- *
12
- * 둘 다 없으면 throw — 호출자 (controller) 가 fallback 메시지 처리.
13
- *
14
- * 참고 — codelingua 본연 기능이 "에러 메시지 → 사용자 친화 설명" (decipher-error-code)
15
- * 인 만큼 어떤 LLM provider 에 묶을 이유가 없다. ai-client-base 위에 올리면 사용자가
16
- * Anthropic / Gemini / OpenAI 중 자유 선택 가능.
7
+ * Its use - an error message turned into a sentence a person can act on - belongs to no provider, so it takes the
8
+ * domain's agent like every other caller. A domain with no agent gets the fallback sentence.
17
9
  */
18
- const env_1 = require("@things-factory/env");
19
10
  const ai_client_base_1 = require("@things-factory/ai-client-base");
20
- let _cached;
21
- function getCodelinguaClient() {
22
- if (_cached)
23
- return _cached;
24
- // 1) ai-client-base default — config.aiClient 가 있으면 거기서.
25
- const defaultClient = (0, ai_client_base_1.getDefaultAIClient)();
26
- if (defaultClient) {
27
- _cached = defaultClient;
28
- return _cached;
29
- }
30
- // 2) legacy config.openai backward 호환.
31
- const legacy = env_1.config.get('openai', null);
32
- if (legacy && legacy.apiKey) {
33
- _cached = (0, ai_client_base_1.createAIClient)({
34
- provider: 'openai',
35
- apiKey: legacy.apiKey,
36
- ...(legacy.organization && { organization: legacy.organization })
37
- });
38
- return _cached;
39
- }
40
- throw new Error('codelingua: no AI client available. Configure config.aiClient (preferred) or legacy config.openai.');
41
- }
42
- /** Test 용 reset. */
43
- function _resetCodelinguaClient() {
44
- _cached = undefined;
11
+ async function getCodelinguaClient(request) {
12
+ return (0, ai_client_base_1.aiClientFor)(request);
45
13
  }
46
14
  //# sourceMappingURL=ai-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-client.js","sourceRoot":"","sources":["../../server/controllers/ai-client.ts"],"names":[],"mappings":";;AAsBA,kDAwBC;AAGD,wDAEC;AAnDD;;;;;;;;;;;;GAYG;AACH,6CAA4C;AAC5C,mEAIuC;AAEvC,IAAI,OAA6B,CAAA;AAEjC,SAAgB,mBAAmB;IACjC,IAAI,OAAO;QAAE,OAAO,OAAO,CAAA;IAE3B,yDAAyD;IACzD,MAAM,aAAa,GAAG,IAAA,mCAAkB,GAAE,CAAA;IAC1C,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,GAAG,aAAa,CAAA;QACvB,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,uCAAuC;IACvC,MAAM,MAAM,GAAG,YAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAsD,CAAA;IAC9F,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,OAAO,GAAG,IAAA,+BAAc,EAAC;YACvB,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;SAClE,CAAC,CAAA;QACF,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAA;AACH,CAAC;AAED,oBAAoB;AACpB,SAAgB,sBAAsB;IACpC,OAAO,GAAG,SAAS,CAAA;AACrB,CAAC","sourcesContent":["/**\n * codelingua 의 AI client 획득 — backward 호환 + provider-agnostic.\n *\n * 우선순위:\n * 1. ai-client-base 의 default client (config.aiClient — 권장 신규 방식)\n * 2. legacy config.openai: { organization, apiKey } (기존 codelingua 사용자)\n *\n * 둘 다 없으면 throw — 호출자 (controller) 가 fallback 메시지 처리.\n *\n * 참고 — codelingua 본연 기능이 \"에러 메시지 → 사용자 친화 설명\" (decipher-error-code)\n * 인 만큼 어떤 LLM provider 에 묶을 이유가 없다. ai-client-base 위에 올리면 사용자가\n * Anthropic / Gemini / OpenAI 중 자유 선택 가능.\n */\nimport { config } from '@things-factory/env'\nimport {\n createAIClient,\n getDefaultAIClient,\n type AIClient\n} from '@things-factory/ai-client-base'\n\nlet _cached: AIClient | undefined\n\nexport function getCodelinguaClient(): AIClient {\n if (_cached) return _cached\n\n // 1) ai-client-base default — config.aiClient 가 있으면 거기서.\n const defaultClient = getDefaultAIClient()\n if (defaultClient) {\n _cached = defaultClient\n return _cached\n }\n\n // 2) legacy config.openai backward 호환.\n const legacy = config.get('openai', null) as { organization?: string; apiKey?: string } | null\n if (legacy && legacy.apiKey) {\n _cached = createAIClient({\n provider: 'openai',\n apiKey: legacy.apiKey,\n ...(legacy.organization && { organization: legacy.organization })\n })\n return _cached\n }\n\n throw new Error(\n 'codelingua: no AI client available. Configure config.aiClient (preferred) or legacy config.openai.'\n )\n}\n\n/** Test 용 reset. */\nexport function _resetCodelinguaClient(): void {\n _cached = undefined\n}\n"]}
1
+ {"version":3,"file":"ai-client.js","sourceRoot":"","sources":["../../server/controllers/ai-client.ts"],"names":[],"mappings":";;AAaA,kDAEC;AAfD;;;;;GAKG;AACH,mEAA8E;AAOvE,KAAK,UAAU,mBAAmB,CAAC,OAA0B;IAClE,OAAO,IAAA,4BAAW,EAAC,OAAc,CAAC,CAAA;AACpC,CAAC","sourcesContent":["/**\n * The AI codelingua answers with: the AI agent of the domain the request is made in (design/ai/agent-settings.md).\n *\n * Its use - an error message turned into a sentence a person can act on - belongs to no provider, so it takes the\n * domain's agent like every other caller. A domain with no agent gets the fallback sentence.\n */\nimport { aiClientFor, type AgentClient } from '@things-factory/ai-client-base'\n\nexport interface CodelinguaRequest {\n domain: { id: string }\n user?: { id: string } | null\n}\n\nexport async function getCodelinguaClient(request: CodelinguaRequest): Promise<AgentClient> {\n return aiClientFor(request as any)\n}\n"]}
@@ -1,5 +1,15 @@
1
+ /**
2
+ * 알 수 없는 시스템 에러 메시지를 사용자 친화적 설명으로 변환.
3
+ *
4
+ * codelingua 의 핵심 use case — 운영 환경에서 사용자가 SQLITE_CONSTRAINT 같은
5
+ * 메시지를 그대로 보고 막히는 상황을, 한국어/현지어로 "원인 + 다음 행동" 형태로
6
+ * 풀어주는 것.
7
+ *
8
+ * provider-agnostic — the domain's AI agent answers, whichever provider it uses.
9
+ */
10
+ import { type CodelinguaRequest } from './ai-client';
1
11
  export declare function decipherErrorCode({ code, system, language }: {
2
12
  code: string;
3
13
  system?: string;
4
14
  language?: string;
5
- }): Promise<string>;
15
+ }, request: CodelinguaRequest): Promise<string>;
@@ -8,8 +8,7 @@ exports.decipherErrorCode = decipherErrorCode;
8
8
  * 메시지를 그대로 보고 막히는 상황을, 한국어/현지어로 "원인 + 다음 행동" 형태로
9
9
  * 풀어주는 것.
10
10
  *
11
- * provider-agnostic — ai-client-base 를 통해 OpenAI / Anthropic / Gemini 어느 쪽이든
12
- * config 에 따라 사용. 모델 / 온도는 옵션, 미지정 시 client 의 default.
11
+ * provider-agnostic — the domain's AI agent answers, whichever provider it uses.
13
12
  */
14
13
  const ai_client_1 = require("./ai-client");
15
14
  const FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.';
@@ -21,9 +20,9 @@ Your response MUST be:
21
20
  3. Actionable — end with a concrete next action the user can take.
22
21
  4. Localized — written entirely in the requested locale.
23
22
  Do NOT include the original error code verbatim, do NOT add disclaimers like "I am an AI".`;
24
- async function decipherErrorCode({ code, system, language = 'en-US' }) {
23
+ async function decipherErrorCode({ code, system, language = 'en-US' }, request) {
25
24
  try {
26
- const client = (0, ai_client_1.getCodelinguaClient)();
25
+ const client = await (0, ai_client_1.getCodelinguaClient)(request);
27
26
  const userMsg = system
28
27
  ? `Source system: ${system}\nError message: ${code}\nLocale: ${language}`
29
28
  : `Error message: ${code}\nLocale: ${language}`;
@@ -1 +1 @@
1
- {"version":3,"file":"decipher-error-code.js","sourceRoot":"","sources":["../../server/controllers/decipher-error-code.ts"],"names":[],"mappings":";;AAuBA,8CA0BC;AAjDD;;;;;;;;;GASG;AACH,2CAAiD;AAEjD,MAAM,gBAAgB,GAAG,6FAA6F,CAAA;AAEtH,MAAM,aAAa,GAAG;;;;;;;2FAOqE,CAAA;AAEpF,KAAK,UAAU,iBAAiB,CAAC,EACtC,IAAI,EACJ,MAAM,EACN,QAAQ,GAAG,OAAO,EAKnB;IACC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,+BAAmB,GAAE,CAAA;QACpC,MAAM,OAAO,GAAG,MAAM;YACpB,CAAC,CAAC,kBAAkB,MAAM,oBAAoB,IAAI,aAAa,QAAQ,EAAE;YACzE,CAAC,CAAC,kBAAkB,IAAI,aAAa,QAAQ,EAAE,CAAA;QACjD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAC7B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EACpC;YACE,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,GAAG,CAAC,sBAAsB;SACxC,CACF,CAAA;QACD,OAAO,KAAK,IAAI,gBAAgB,CAAA;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAA;QAC9D,OAAO,gBAAgB,CAAA;IACzB,CAAC;AACH,CAAC","sourcesContent":["/**\n * 알 수 없는 시스템 에러 메시지를 사용자 친화적 설명으로 변환.\n *\n * codelingua 의 핵심 use case — 운영 환경에서 사용자가 SQLITE_CONSTRAINT 같은\n * 메시지를 그대로 보고 막히는 상황을, 한국어/현지어로 \"원인 + 다음 행동\" 형태로\n * 풀어주는 것.\n *\n * provider-agnostic — ai-client-base 를 통해 OpenAI / Anthropic / Gemini 어느 쪽이든\n * config 에 따라 사용. 모델 / 온도는 옵션, 미지정 시 client 의 default.\n */\nimport { getCodelinguaClient } from './ai-client'\n\nconst FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n\nconst SYSTEM_PROMPT = `You are a helpful assistant that translates cryptic system / framework / database error messages into clear, user-friendly explanations.\n\nYour response MUST be:\n1. Concise — 2 to 4 sentences. No headers, no markdown lists.\n2. Causal — explain the most likely cause in plain language.\n3. Actionable — end with a concrete next action the user can take.\n4. Localized — written entirely in the requested locale.\nDo NOT include the original error code verbatim, do NOT add disclaimers like \"I am an AI\".`\n\nexport async function decipherErrorCode({\n code,\n system,\n language = 'en-US'\n}: {\n code: string\n system?: string\n language?: string\n}): Promise<string> {\n try {\n const client = getCodelinguaClient()\n const userMsg = system\n ? `Source system: ${system}\\nError message: ${code}\\nLocale: ${language}`\n : `Error message: ${code}\\nLocale: ${language}`\n const reply = await client.chat(\n [{ role: 'user', content: userMsg }],\n {\n systemPrompt: SYSTEM_PROMPT,\n temperature: 0.3 // 결정적 — 동일 에러는 비슷한 설명\n }\n )\n return reply || FALLBACK_MESSAGE\n } catch (error) {\n console.error('[codelingua] decipherErrorCode failed:', error)\n return FALLBACK_MESSAGE\n }\n}\n"]}
1
+ {"version":3,"file":"decipher-error-code.js","sourceRoot":"","sources":["../../server/controllers/decipher-error-code.ts"],"names":[],"mappings":";;AAsBA,8CA6BC;AAnDD;;;;;;;;GAQG;AACH,2CAAyE;AAEzE,MAAM,gBAAgB,GAAG,6FAA6F,CAAA;AAEtH,MAAM,aAAa,GAAG;;;;;;;2FAOqE,CAAA;AAEpF,KAAK,UAAU,iBAAiB,CACrC,EACE,IAAI,EACJ,MAAM,EACN,QAAQ,GAAG,OAAO,EAKnB,EACD,OAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,+BAAmB,EAAC,OAAO,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,MAAM;YACpB,CAAC,CAAC,kBAAkB,MAAM,oBAAoB,IAAI,aAAa,QAAQ,EAAE;YACzE,CAAC,CAAC,kBAAkB,IAAI,aAAa,QAAQ,EAAE,CAAA;QACjD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAC7B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EACpC;YACE,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,GAAG,CAAC,sBAAsB;SACxC,CACF,CAAA;QACD,OAAO,KAAK,IAAI,gBAAgB,CAAA;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAA;QAC9D,OAAO,gBAAgB,CAAA;IACzB,CAAC;AACH,CAAC","sourcesContent":["/**\n * 알 수 없는 시스템 에러 메시지를 사용자 친화적 설명으로 변환.\n *\n * codelingua 의 핵심 use case — 운영 환경에서 사용자가 SQLITE_CONSTRAINT 같은\n * 메시지를 그대로 보고 막히는 상황을, 한국어/현지어로 \"원인 + 다음 행동\" 형태로\n * 풀어주는 것.\n *\n * provider-agnostic — the domain's AI agent answers, whichever provider it uses.\n */\nimport { type CodelinguaRequest, getCodelinguaClient } from './ai-client'\n\nconst FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n\nconst SYSTEM_PROMPT = `You are a helpful assistant that translates cryptic system / framework / database error messages into clear, user-friendly explanations.\n\nYour response MUST be:\n1. Concise — 2 to 4 sentences. No headers, no markdown lists.\n2. Causal — explain the most likely cause in plain language.\n3. Actionable — end with a concrete next action the user can take.\n4. Localized — written entirely in the requested locale.\nDo NOT include the original error code verbatim, do NOT add disclaimers like \"I am an AI\".`\n\nexport async function decipherErrorCode(\n {\n code,\n system,\n language = 'en-US'\n }: {\n code: string\n system?: string\n language?: string\n },\n request: CodelinguaRequest\n): Promise<string> {\n try {\n const client = await getCodelinguaClient(request)\n const userMsg = system\n ? `Source system: ${system}\\nError message: ${code}\\nLocale: ${language}`\n : `Error message: ${code}\\nLocale: ${language}`\n const reply = await client.chat(\n [{ role: 'user', content: userMsg }],\n {\n systemPrompt: SYSTEM_PROMPT,\n temperature: 0.3 // 결정적 — 동일 에러는 비슷한 설명\n }\n )\n return reply || FALLBACK_MESSAGE\n } catch (error) {\n console.error('[codelingua] decipherErrorCode failed:', error)\n return FALLBACK_MESSAGE\n }\n}\n"]}
@@ -1,5 +1,13 @@
1
+ /**
2
+ * i18n JSON 자동 번역 — 원본 JSON + 원본 locale + 대상 locale 배열을 받아서 같은 키
3
+ * 구조로 다국어 JSON 묶음을 생성.
4
+ *
5
+ * 이전 hardcoded "ko → en/ja/zh/ms" 에서 source/target 동적 파라미터로 일반화.
6
+ * provider-agnostic (ai-client-base).
7
+ */
8
+ import { type CodelinguaRequest } from './ai-client';
1
9
  export declare function i18nCompletion({ json, sourceLocale, targetLocales }: {
2
10
  json: string;
3
11
  sourceLocale?: string;
4
12
  targetLocales?: string[];
5
- }): Promise<string>;
13
+ }, request: CodelinguaRequest): Promise<string>;
@@ -15,14 +15,14 @@ const DEFAULT_TARGET_LOCALES = ['en', 'ja', 'zh', 'ms', 'es'];
15
15
  const SYSTEM_PROMPT = `You are a translation assistant. You receive a JSON object of i18n key-value pairs in a single source locale, and produce equivalent JSON objects for the requested target locales.
16
16
 
17
17
  Output strictly as a single JSON object whose top-level keys are the target locale codes, and each value is a translated JSON object preserving the EXACT same key structure as the source. Translate values only — never translate keys. Preserve placeholders like {{name}}, %{var}, {0} verbatim. No commentary, no explanation, no markdown — JSON only.`;
18
- async function i18nCompletion({ json, sourceLocale, targetLocales }) {
18
+ async function i18nCompletion({ json, sourceLocale, targetLocales }, request) {
19
19
  try {
20
20
  const src = sourceLocale && sourceLocale.length > 0 ? sourceLocale : DEFAULT_SOURCE_LOCALE;
21
21
  const targets = targetLocales && targetLocales.length > 0 ? targetLocales : DEFAULT_TARGET_LOCALES;
22
22
  const userMsg = `Source locale: ${src}\n` +
23
23
  `Target locales: ${JSON.stringify(targets)}\n` +
24
24
  `Source JSON:\n${json}`;
25
- const client = (0, ai_client_1.getCodelinguaClient)();
25
+ const client = await (0, ai_client_1.getCodelinguaClient)(request);
26
26
  const reply = await client.chat([{ role: 'user', content: userMsg }], {
27
27
  systemPrompt: SYSTEM_PROMPT,
28
28
  temperature: 0.2 // 번역은 일관성 우선
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-completion.js","sourceRoot":"","sources":["../../server/controllers/i18n-completion.ts"],"names":[],"mappings":";;AAkBA,wCAgCC;AAlDD;;;;;;GAMG;AACH,2CAAiD;AAEjD,MAAM,gBAAgB,GAAG,6FAA6F,CAAA;AAEtH,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAClC,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE7D,MAAM,aAAa,GAAG;;6VAEuU,CAAA;AAEtV,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,aAAa,EAKd;IACC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAA;QAC1F,MAAM,OAAO,GACX,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,sBAAsB,CAAA;QAEpF,MAAM,OAAO,GACX,kBAAkB,GAAG,IAAI;YACzB,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI;YAC9C,iBAAiB,IAAI,EAAE,CAAA;QAEzB,MAAM,MAAM,GAAG,IAAA,+BAAmB,GAAE,CAAA;QACpC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAC7B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EACpC;YACE,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,GAAG,CAAC,aAAa;SAC/B,CACF,CAAA;QACD,OAAO,KAAK,IAAI,gBAAgB,CAAA;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAA;QAC3D,OAAO,gBAAgB,CAAA;IACzB,CAAC;AACH,CAAC","sourcesContent":["/**\n * i18n JSON 자동 번역 — 원본 JSON + 원본 locale + 대상 locale 배열을 받아서 같은 키\n * 구조로 다국어 JSON 묶음을 생성.\n *\n * 이전 hardcoded \"ko → en/ja/zh/ms\" 에서 source/target 동적 파라미터로 일반화.\n * provider-agnostic (ai-client-base).\n */\nimport { getCodelinguaClient } from './ai-client'\n\nconst FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n\nconst DEFAULT_SOURCE_LOCALE = 'ko'\nconst DEFAULT_TARGET_LOCALES = ['en', 'ja', 'zh', 'ms', 'es']\n\nconst SYSTEM_PROMPT = `You are a translation assistant. You receive a JSON object of i18n key-value pairs in a single source locale, and produce equivalent JSON objects for the requested target locales.\n\nOutput strictly as a single JSON object whose top-level keys are the target locale codes, and each value is a translated JSON object preserving the EXACT same key structure as the source. Translate values only — never translate keys. Preserve placeholders like {{name}}, %{var}, {0} verbatim. No commentary, no explanation, no markdown — JSON only.`\n\nexport async function i18nCompletion({\n json,\n sourceLocale,\n targetLocales\n}: {\n json: string\n sourceLocale?: string\n targetLocales?: string[]\n}): Promise<string> {\n try {\n const src = sourceLocale && sourceLocale.length > 0 ? sourceLocale : DEFAULT_SOURCE_LOCALE\n const targets =\n targetLocales && targetLocales.length > 0 ? targetLocales : DEFAULT_TARGET_LOCALES\n\n const userMsg =\n `Source locale: ${src}\\n` +\n `Target locales: ${JSON.stringify(targets)}\\n` +\n `Source JSON:\\n${json}`\n\n const client = getCodelinguaClient()\n const reply = await client.chat(\n [{ role: 'user', content: userMsg }],\n {\n systemPrompt: SYSTEM_PROMPT,\n temperature: 0.2 // 번역은 일관성 우선\n }\n )\n return reply || FALLBACK_MESSAGE\n } catch (error) {\n console.error('[codelingua] i18nCompletion failed:', error)\n return FALLBACK_MESSAGE\n }\n}\n"]}
1
+ {"version":3,"file":"i18n-completion.js","sourceRoot":"","sources":["../../server/controllers/i18n-completion.ts"],"names":[],"mappings":";;AAkBA,wCAmCC;AArDD;;;;;;GAMG;AACH,2CAAyE;AAEzE,MAAM,gBAAgB,GAAG,6FAA6F,CAAA;AAEtH,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAClC,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE7D,MAAM,aAAa,GAAG;;6VAEuU,CAAA;AAEtV,KAAK,UAAU,cAAc,CAClC,EACE,IAAI,EACJ,YAAY,EACZ,aAAa,EAKd,EACD,OAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAA;QAC1F,MAAM,OAAO,GACX,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,sBAAsB,CAAA;QAEpF,MAAM,OAAO,GACX,kBAAkB,GAAG,IAAI;YACzB,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI;YAC9C,iBAAiB,IAAI,EAAE,CAAA;QAEzB,MAAM,MAAM,GAAG,MAAM,IAAA,+BAAmB,EAAC,OAAO,CAAC,CAAA;QACjD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAC7B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EACpC;YACE,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,GAAG,CAAC,aAAa;SAC/B,CACF,CAAA;QACD,OAAO,KAAK,IAAI,gBAAgB,CAAA;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAA;QAC3D,OAAO,gBAAgB,CAAA;IACzB,CAAC;AACH,CAAC","sourcesContent":["/**\n * i18n JSON 자동 번역 — 원본 JSON + 원본 locale + 대상 locale 배열을 받아서 같은 키\n * 구조로 다국어 JSON 묶음을 생성.\n *\n * 이전 hardcoded \"ko → en/ja/zh/ms\" 에서 source/target 동적 파라미터로 일반화.\n * provider-agnostic (ai-client-base).\n */\nimport { type CodelinguaRequest, getCodelinguaClient } from './ai-client'\n\nconst FALLBACK_MESSAGE = 'The Code Lingua service is currently unavailable. Please contact your system administrator.'\n\nconst DEFAULT_SOURCE_LOCALE = 'ko'\nconst DEFAULT_TARGET_LOCALES = ['en', 'ja', 'zh', 'ms', 'es']\n\nconst SYSTEM_PROMPT = `You are a translation assistant. You receive a JSON object of i18n key-value pairs in a single source locale, and produce equivalent JSON objects for the requested target locales.\n\nOutput strictly as a single JSON object whose top-level keys are the target locale codes, and each value is a translated JSON object preserving the EXACT same key structure as the source. Translate values only — never translate keys. Preserve placeholders like {{name}}, %{var}, {0} verbatim. No commentary, no explanation, no markdown — JSON only.`\n\nexport async function i18nCompletion(\n {\n json,\n sourceLocale,\n targetLocales\n }: {\n json: string\n sourceLocale?: string\n targetLocales?: string[]\n },\n request: CodelinguaRequest\n): Promise<string> {\n try {\n const src = sourceLocale && sourceLocale.length > 0 ? sourceLocale : DEFAULT_SOURCE_LOCALE\n const targets =\n targetLocales && targetLocales.length > 0 ? targetLocales : DEFAULT_TARGET_LOCALES\n\n const userMsg =\n `Source locale: ${src}\\n` +\n `Target locales: ${JSON.stringify(targets)}\\n` +\n `Source JSON:\\n${json}`\n\n const client = await getCodelinguaClient(request)\n const reply = await client.chat(\n [{ role: 'user', content: userMsg }],\n {\n systemPrompt: SYSTEM_PROMPT,\n temperature: 0.2 // 번역은 일관성 우선\n }\n )\n return reply || FALLBACK_MESSAGE\n } catch (error) {\n console.error('[codelingua] i18nCompletion failed:', error)\n return FALLBACK_MESSAGE\n }\n}\n"]}
@@ -1,18 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const controllers_1 = require("./controllers");
4
- process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
5
- globalPublicRouter.post('/i18n-completion', async (context, next) => {
4
+ process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
5
+ domainPrivateRouter.post('/i18n-completion', async (context, next) => {
6
6
  const { json, sourceLocale, targetLocales } = context.request.body;
7
- const message = await (0, controllers_1.i18nCompletion)({ json, sourceLocale, targetLocales });
7
+ const { domain, user } = context.state;
8
+ const message = await (0, controllers_1.i18nCompletion)({ json, sourceLocale, targetLocales }, { domain, user });
8
9
  context.body = {
9
10
  message
10
11
  };
11
12
  });
12
- globalPublicRouter.post('/error-code-decipher', async (context, next) => {
13
+ domainPrivateRouter.post('/error-code-decipher', async (context, next) => {
13
14
  const { code, system, language: requestedLanguage } = context.request.body;
14
15
  const language = requestedLanguage || context.language;
15
- const message = await (0, controllers_1.decipherErrorCode)({ code, system, language });
16
+ const { domain, user } = context.state;
17
+ const message = await (0, controllers_1.decipherErrorCode)({ code, system, language }, { domain, user });
16
18
  context.body = {
17
19
  message
18
20
  };
@@ -20,5 +22,4 @@ process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) =>
20
22
  });
21
23
  process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => { });
22
24
  process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => { });
23
- process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => { });
24
25
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAYA,+CAAiE;AAGjE,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,kBAAkB,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAClE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAA2B,CAAA;QAEzF,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAc,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAA;QAE3E,OAAO,CAAC,IAAI,GAAG;YACb,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,kBAAkB,CAAC,IAAI,CAAC,sBAAsB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAyB,CAAA;QAC/F,MAAM,QAAQ,GAAG,iBAAiB,IAAK,OAAe,CAAC,QAAQ,CAAA;QAE/D,MAAM,OAAO,GAAG,MAAM,IAAA,+BAAiB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;QAEnE,OAAO,CAAC,IAAI,GAAG;YACb,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA;AAC5F,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA;AAC1F,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA","sourcesContent":["/**\n * codelingua HTTP routes — global public.\n *\n * 노출되는 두 endpoint 가 패키지의 정체성:\n * - POST /error-code-decipher : 에러 메시지 → 사용자 친화 설명 (decipherErrorCode)\n * - POST /i18n-completion : i18n JSON 다국어 자동 번역\n *\n * 5개 legacy endpoint (chat-completion / api-doc-completion / code-decipher /\n * codereview-completion / image-completion) 는 v10 에서 제거됨. board-ai 의 자연어\n * 인터페이스가 더 풍부한 대안.\n */\nimport { CodeDecipherInput } from './service/code-decipher/code-decipher-type'\nimport { decipherErrorCode, i18nCompletion } from './controllers'\nimport { i18nCompletionInput } from './service/i18n-completion/i18n-completion-type'\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n globalPublicRouter.post('/i18n-completion', async (context, next) => {\n const { json, sourceLocale, targetLocales } = context.request.body as i18nCompletionInput\n\n const message = await i18nCompletion({ json, sourceLocale, targetLocales })\n\n context.body = {\n message\n }\n })\n\n globalPublicRouter.post('/error-code-decipher', async (context, next) => {\n const { code, system, language: requestedLanguage } = context.request.body as CodeDecipherInput\n const language = requestedLanguage || (context as any).language\n\n const message = await decipherErrorCode({ code, system, language })\n\n context.body = {\n message\n }\n })\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {})\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {})\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {})\n"]}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAaA,+CAAiE;AAGjE,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF,mBAAmB,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACnE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAA2B,CAAA;QAEzF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAY,CAAA;QAC7C,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAc,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QAE7F,OAAO,CAAC,IAAI,GAAG;YACb,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,CAAC,sBAAsB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACvE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAyB,CAAA;QAC/F,MAAM,QAAQ,GAAG,iBAAiB,IAAK,OAAe,CAAC,QAAQ,CAAA;QAE/D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAI,OAAe,CAAC,KAAK,CAAA;QAC/C,MAAM,OAAO,GAAG,MAAM,IAAA,+BAAiB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QAErF,OAAO,CAAC,IAAI,GAAG;YACb,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA;AAC5F,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA","sourcesContent":["/**\n * codelingua HTTP routes — in a domain, signed in. The answer spends the domain's AI agent\n * (design/ai/agent-settings.md), so a request names its domain and its person.\n *\n * 노출되는 두 endpoint 가 패키지의 정체성:\n * - POST /error-code-decipher : 에러 메시지 → 사용자 친화 설명 (decipherErrorCode)\n * - POST /i18n-completion : i18n JSON 다국어 자동 번역\n *\n * 5개 legacy endpoint (chat-completion / api-doc-completion / code-decipher /\n * codereview-completion / image-completion) 는 v10 에서 제거됨. board-ai 의 자연어\n * 인터페이스가 더 풍부한 대안.\n */\nimport { CodeDecipherInput } from './service/code-decipher/code-decipher-type'\nimport { decipherErrorCode, i18nCompletion } from './controllers'\nimport { i18nCompletionInput } from './service/i18n-completion/i18n-completion-type'\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n domainPrivateRouter.post('/i18n-completion', async (context, next) => {\n const { json, sourceLocale, targetLocales } = context.request.body as i18nCompletionInput\n\n const { domain, user } = context.state as any\n const message = await i18nCompletion({ json, sourceLocale, targetLocales }, { domain, user })\n\n context.body = {\n message\n }\n })\n\n domainPrivateRouter.post('/error-code-decipher', async (context, next) => {\n const { code, system, language: requestedLanguage } = context.request.body as CodeDecipherInput\n const language = requestedLanguage || (context as any).language\n\n const { domain, user } = (context as any).state\n const message = await decipherErrorCode({ code, system, language }, { domain, user })\n\n context.body = {\n message\n }\n })\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {})\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {})\n"]}
@@ -10,7 +10,7 @@ let CodeDecipherResolver = class CodeDecipherResolver {
10
10
  async decipherErrorCode(input, context) {
11
11
  const { code, system, language: requestedLanguage } = input;
12
12
  const language = requestedLanguage || context.language;
13
- const message = await (0, controllers_1.decipherErrorCode)({ code, system, language });
13
+ const message = await (0, controllers_1.decipherErrorCode)({ code, system, language }, { domain: context.state.domain, user: context.state.user });
14
14
  return { message };
15
15
  }
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"code-decipher-resolver.js","sourceRoot":"","sources":["../../../server/service/code-decipher/code-decipher-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,6DAA4E;AAC5E,mDAAqD;AAG9C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAKzB,AAAN,KAAK,CAAC,iBAAiB,CACP,KAAwB,EAC/B,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAA;QAC3D,MAAM,QAAQ,GAAG,iBAAiB,IAAK,OAAe,CAAC,QAAQ,CAAA;QAE/D,MAAM,OAAO,GAAG,MAAM,IAAA,+BAAiB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;QAEnE,OAAO,EAAE,OAAO,EAAE,CAAA;IACpB,CAAC;CACF,CAAA;AAhBY,oDAAoB;AAKzB;IAJL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,uCAAkB,EAAE;QAC/B,WAAW,EACT,kIAAkI;KACrI,CAAC;IAEC,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,sCAAiB;;6DASvC;+BAfU,oBAAoB;IADhC,IAAA,uBAAQ,GAAE;GACE,oBAAoB,CAgBhC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { CodeDecipherInput, CodeDecipherOutput } from './code-decipher-type'\nimport { decipherErrorCode } from '../../controllers'\n\n@Resolver()\nexport class CodeDecipherResolver {\n @Query(() => CodeDecipherOutput, {\n description:\n 'Translate a cryptic system / framework / database error message into a concise, localized, actionable explanation for end users.'\n })\n async decipherErrorCode(\n @Arg('input') input: CodeDecipherInput,\n @Ctx() context: ResolverContext\n ): Promise<CodeDecipherOutput> {\n const { code, system, language: requestedLanguage } = input\n const language = requestedLanguage || (context as any).language\n\n const message = await decipherErrorCode({ code, system, language })\n\n return { message }\n }\n}\n"]}
1
+ {"version":3,"file":"code-decipher-resolver.js","sourceRoot":"","sources":["../../../server/service/code-decipher/code-decipher-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,6DAA4E;AAC5E,mDAAqD;AAG9C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAKzB,AAAN,KAAK,CAAC,iBAAiB,CACP,KAAwB,EAC/B,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAA;QAC3D,MAAM,QAAQ,GAAG,iBAAiB,IAAK,OAAe,CAAC,QAAQ,CAAA;QAE/D,MAAM,OAAO,GAAG,MAAM,IAAA,+BAAiB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;QAE/H,OAAO,EAAE,OAAO,EAAE,CAAA;IACpB,CAAC;CACF,CAAA;AAhBY,oDAAoB;AAKzB;IAJL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,uCAAkB,EAAE;QAC/B,WAAW,EACT,kIAAkI;KACrI,CAAC;IAEC,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,sCAAiB;;6DASvC;+BAfU,oBAAoB;IADhC,IAAA,uBAAQ,GAAE;GACE,oBAAoB,CAgBhC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { CodeDecipherInput, CodeDecipherOutput } from './code-decipher-type'\nimport { decipherErrorCode } from '../../controllers'\n\n@Resolver()\nexport class CodeDecipherResolver {\n @Query(() => CodeDecipherOutput, {\n description:\n 'Translate a cryptic system / framework / database error message into a concise, localized, actionable explanation for end users.'\n })\n async decipherErrorCode(\n @Arg('input') input: CodeDecipherInput,\n @Ctx() context: ResolverContext\n ): Promise<CodeDecipherOutput> {\n const { code, system, language: requestedLanguage } = input\n const language = requestedLanguage || (context as any).language\n\n const message = await decipherErrorCode({ code, system, language }, { domain: context.state.domain, user: context.state.user })\n\n return { message }\n }\n}\n"]}
@@ -9,7 +9,7 @@ const controllers_1 = require("../../controllers");
9
9
  let i18nCompletionResolver = class i18nCompletionResolver {
10
10
  async i18nCompletion(input, context) {
11
11
  const { json, sourceLocale, targetLocales } = input;
12
- const message = await (0, controllers_1.i18nCompletion)({ json, sourceLocale, targetLocales });
12
+ const message = await (0, controllers_1.i18nCompletion)({ json, sourceLocale, targetLocales }, { domain: context.state.domain, user: context.state.user });
13
13
  return {
14
14
  message
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-completion-resolver.js","sourceRoot":"","sources":["../../../server/service/i18n-completion/i18n-completion-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,iEAAkF;AAClF,mDAAkD;AAG3C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAK3B,AAAN,KAAK,CAAC,cAAc,CACJ,KAA0B,EACjC,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;QAEnD,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAc,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAA;QAE3E,OAAO;YACL,OAAO;SACR,CAAA;IACH,CAAC;CACF,CAAA;AAjBY,wDAAsB;AAK3B;IAJL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,2CAAoB,EAAE;QACjC,WAAW,EACT,yLAAyL;KAC5L,CAAC;IAEC,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,0CAAmB;;4DAUzC;iCAhBU,sBAAsB;IADlC,IAAA,uBAAQ,GAAE;GACE,sBAAsB,CAiBlC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { i18nCompletionInput, i18nCompletionOutput } from './i18n-completion-type'\nimport { i18nCompletion } from '../../controllers'\n\n@Resolver()\nexport class i18nCompletionResolver {\n @Query(() => i18nCompletionOutput, {\n description:\n 'Translate an i18n JSON (key-value) from a source locale into multiple target locales. Source/target locales are configurable; defaults preserve historical \"ko → en/ja/zh/ms\" behavior.'\n })\n async i18nCompletion(\n @Arg('input') input: i18nCompletionInput,\n @Ctx() context: ResolverContext\n ): Promise<i18nCompletionOutput> {\n const { json, sourceLocale, targetLocales } = input\n\n const message = await i18nCompletion({ json, sourceLocale, targetLocales })\n\n return {\n message\n }\n }\n}\n"]}
1
+ {"version":3,"file":"i18n-completion-resolver.js","sourceRoot":"","sources":["../../../server/service/i18n-completion/i18n-completion-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AACxD,qCAAkC,CAAC,sBAAsB;AACzD,iEAAkF;AAClF,mDAAkD;AAG3C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAK3B,AAAN,KAAK,CAAC,cAAc,CACJ,KAA0B,EACjC,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;QAEnD,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAc,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;QAEvI,OAAO;YACL,OAAO;SACR,CAAA;IACH,CAAC;CACF,CAAA;AAjBY,wDAAsB;AAK3B;IAJL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,2CAAoB,EAAE;QACjC,WAAW,EACT,yLAAyL;KAC5L,CAAC;IAEC,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADe,0CAAmB;;4DAUzC;iCAhBU,sBAAsB;IADlC,IAAA,uBAAQ,GAAE;GACE,sBAAsB,CAiBlC","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport '@things-factory/auth-base' // for ResolverContext\nimport { i18nCompletionInput, i18nCompletionOutput } from './i18n-completion-type'\nimport { i18nCompletion } from '../../controllers'\n\n@Resolver()\nexport class i18nCompletionResolver {\n @Query(() => i18nCompletionOutput, {\n description:\n 'Translate an i18n JSON (key-value) from a source locale into multiple target locales. Source/target locales are configurable; defaults preserve historical \"ko → en/ja/zh/ms\" behavior.'\n })\n async i18nCompletion(\n @Arg('input') input: i18nCompletionInput,\n @Ctx() context: ResolverContext\n ): Promise<i18nCompletionOutput> {\n const { json, sourceLocale, targetLocales } = input\n\n const message = await i18nCompletion({ json, sourceLocale, targetLocales }, { domain: context.state.domain, user: context.state.user })\n\n return {\n message\n }\n }\n}\n"]}