{"_id":"@edwinho/kotoba-gemini","_rev":"7-123ecf44d3e1b2ddc2abd1268ad3303d","name":"@edwinho/kotoba-gemini","dist-tags":{"latest":"0.3.4"},"versions":{"0.1.0":{"name":"@edwinho/kotoba-gemini","version":"0.1.0","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"author":{"name":"eho"},"license":"MIT","_id":"@edwinho/kotoba-gemini@0.1.0","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"homepage":"https://github.com/eho/kotoba","bugs":{"url":"https://github.com/eho/kotoba/issues"},"dist":{"shasum":"71a3fe2b4f2a245261f1c98d2f5d852efa5a0d56","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.1.0.tgz","fileCount":13,"integrity":"sha512-yfDnBDU4GVFnXV2SPb3qZkSWUxGfrqSvKdIQ0KygQ+8dxNPOKLkXUvFzXGwo4hgMLrk4FhmkpLLqPkcT+wRzYQ==","signatures":[{"sig":"MEUCIGNl7hGPse8FdMPdgrm3702UKMOL9lowzejjSqR6RV1BAiEA9PAlA5yDmzfLxweDo++9OmALo88P4ZctRzb1r3HPi+Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96367},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"86b781d98fd392d237fb7c2eb4d0cb8203950d94","scripts":{"test":"bun test","build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"repository":{"url":"git+https://github.com/eho/kotoba.git","type":"git","directory":"packages/gemini"},"_npmVersion":"11.9.0","description":"Gemini translation provider for Kotoba core translation drafts.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"~6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/kotoba-gemini_0.1.0_1780450410765_0.7379920880416941","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@edwinho/kotoba-gemini","version":"0.2.0","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"author":{"name":"eho"},"license":"MIT","_id":"@edwinho/kotoba-gemini@0.2.0","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"homepage":"https://github.com/eho/kotoba","bugs":{"url":"https://github.com/eho/kotoba/issues"},"dist":{"shasum":"1a541daf88ee5aba539adbd4dbaecd7027e553a3","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.2.0.tgz","fileCount":13,"integrity":"sha512-9om0jnO1dqclPQJ3OBvfZvUelkI34L9WjxGr8N3n76tzxWX7X1G1G1v0hWxT3z0crvYlS0mGG5beRln5L1JxJA==","signatures":[{"sig":"MEQCIGWGo+YfUT0t4v4tL0O2MjALcPf1XqHSn6K6AUPfWjzOAiAP8/pYSSLz8WyH9bt3sAuYvnwfOZ/DqPMlDpQ3lJNr1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102762},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"e8e47f69b0c82c3f75802bc0ecfc7b815070286c","scripts":{"test":"bun test","build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"repository":{"url":"git+https://github.com/eho/kotoba.git","type":"git","directory":"packages/gemini"},"_npmVersion":"11.9.0","description":"Gemini translation provider for Kotoba core translation drafts.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"~6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/kotoba-gemini_0.2.0_1780621592380_0.2284307459531809","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@edwinho/kotoba-gemini","version":"0.3.0","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"author":{"name":"eho"},"license":"MIT","_id":"@edwinho/kotoba-gemini@0.3.0","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"homepage":"https://github.com/eho/kotoba","bugs":{"url":"https://github.com/eho/kotoba/issues"},"dist":{"shasum":"548b2f929f296147c5130534ac4b84372afcea8f","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.3.0.tgz","fileCount":13,"integrity":"sha512-ORVbz5YeIN3XWKfYb6D1JB0ErW9R8TQV4cpHBLMOUtbNuHzIkMNqexsXSEuydv3tdvWmzQSa1uVHBlbGPPG3WA==","signatures":[{"sig":"MEUCIQD7GBK327JEtnCbx8kKBFhRuVOCoLaxGoAOCe032FP2hwIgJ/5rB6c2WNRgn3jVj3dgzXQ6cq3e2MSZxHqLnx5wGpA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":106387},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"acf91e7142d79744a918299cd5332da81d88bb0f","scripts":{"test":"bun test","build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"repository":{"url":"git+https://github.com/eho/kotoba.git","type":"git","directory":"packages/gemini"},"_npmVersion":"11.9.0","description":"Gemini translation provider for Kotoba core translation drafts.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"~6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/kotoba-gemini_0.3.0_1781086974902_0.8270367026205445","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@edwinho/kotoba-gemini","version":"0.3.1","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"author":"eho","license":"MIT","_id":"@edwinho/kotoba-gemini@0.3.1","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"homepage":"https://github.com/eho/kotoba","bugs":{"url":"https://github.com/eho/kotoba/issues"},"dist":{"shasum":"27d044f388ef382e907e5d621f621897ba374263","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.3.1.tgz","fileCount":13,"integrity":"sha512-TAzb1PosZ2dN/EzwxOBfT2hWXlGM4CO/2bMjTzYtlae3MBWSi39jB2ZO/2FOv14VlSf1e1c1ck/qQhevgBOBRA==","signatures":[{"sig":"MEYCIQDk2iWaHI8fMu0lnGGq1WSePH4EQDapMVmVRlwAuLO+6QIhAKdrfFcEwEvGJv+aQirH9EusRvtGIjiZtvF0+T12o/NE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":107701},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","shasum":"27d044f388ef382e907e5d621f621897ba374263","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"test":"bun test","build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"_integrity":"sha512-TAzb1PosZ2dN/EzwxOBfT2hWXlGM4CO/2bMjTzYtlae3MBWSi39jB2ZO/2FOv14VlSf1e1c1ck/qQhevgBOBRA==","repository":{"url":"https://github.com/eho/kotoba.git","type":"git","directory":"packages/gemini"},"_npmVersion":"10.8.3","description":"Gemini translation provider for Kotoba core translation drafts.","directories":{},"_nodeVersion":"24.3.0","dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"~6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/kotoba-gemini_0.3.1_1781132257077_0.26351705695584116","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@edwinho/kotoba-gemini","version":"0.3.2","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"author":{"name":"eho"},"license":"MIT","_id":"@edwinho/kotoba-gemini@0.3.2","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"homepage":"https://github.com/eho/kotoba","bugs":{"url":"https://github.com/eho/kotoba/issues"},"dist":{"shasum":"047eadf8f7a02aa3bb1ab1a57b826df94006d50a","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.3.2.tgz","fileCount":13,"integrity":"sha512-xYH45rzUi+pnae7DeDR5Tw8EUxG49l2/YaJJTSb4IzbTZo0KER1dN6ttemY4zFMICry1F5JaU08xgcFpzzrVgQ==","signatures":[{"sig":"MEUCIGRwWe7CXHrku7VwvPHsiv//jctU43EAYifBJFWq01gkAiEA/tRKFjEvqfOEfjjbzwU6ijhh18J12JF9RdHRNhMDoXA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":110169},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"60813bbef8c700eb7a9f4cdb48c88cd6c5514bde","scripts":{"test":"bun test","build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"repository":{"url":"git+https://github.com/eho/kotoba.git","type":"git","directory":"packages/gemini"},"_npmVersion":"11.9.0","description":"Gemini translation provider for Kotoba core translation drafts.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.2.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"~6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/kotoba-gemini_0.3.2_1781311917451_0.7809751497129493","host":"s3://npm-registry-packages-npm-production"}},"0.3.3":{"name":"@edwinho/kotoba-gemini","version":"0.3.3","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"author":{"name":"eho"},"license":"MIT","_id":"@edwinho/kotoba-gemini@0.3.3","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"homepage":"https://github.com/eho/kotoba","bugs":{"url":"https://github.com/eho/kotoba/issues"},"dist":{"shasum":"71bebdb7bf3e41a16c4ac5c4558afaaf311153e7","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.3.3.tgz","fileCount":13,"integrity":"sha512-j2ZA2JEz/u0yEAnM7usdc5YCSnS5o0mqib0K3VNqYROqthruUPdVNdcifxfRTu8U6hGOjIhkoyZyHSvpzmdXPw==","signatures":[{"sig":"MEQCIH236dxF2cZns3YzsImMPkYBpTu0e0IazG4r9qJ0lCY2AiBzg/AwscpfUgXrEoD/wVa0VbmPv/bP6GC4N7VvFobN+Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":117074},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"75fa576cbc7498cdb68cdf0bdc1c00bf30737c9e","scripts":{"test":"bun test","build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"repository":{"url":"git+https://github.com/eho/kotoba.git","type":"git","directory":"packages/gemini"},"_npmVersion":"11.9.0","description":"Gemini translation provider for Kotoba core translation drafts.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.2.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"~6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/kotoba-gemini_0.3.3_1781345279950_0.14782322671673565","host":"s3://npm-registry-packages-npm-production"}},"0.3.4":{"name":"@edwinho/kotoba-gemini","version":"0.3.4","description":"Gemini translation provider for Kotoba core translation drafts.","author":{"name":"eho"},"license":"MIT","type":"module","homepage":"https://github.com/eho/kotoba","repository":{"type":"git","url":"git+https://github.com/eho/kotoba.git","directory":"packages/gemini"},"bugs":{"url":"https://github.com/eho/kotoba/issues"},"keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"bun ../../scripts/clean-package-dist.ts . && bun build src/index.ts --outdir dist --target node --format esm --external @google/genai --external @edwinho/kotoba-core && tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","test":"bun test"},"dependencies":{"@google/genai":"^1.47.0","@edwinho/kotoba-core":"^0.2.5"},"devDependencies":{"typescript":"~6.0.3"},"publishConfig":{"access":"public"},"gitHead":"722733ca1ec311d2100427c4674715ae11606d9d","_id":"@edwinho/kotoba-gemini@0.3.4","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-LYiaLZbwSv352fDxUXiz0WejlLJ9udHucIw4T1Bmg9Z4IfFVFA1zzyWejPt8JKWtGXZSIyk05pznp7NDHW3TLA==","shasum":"8a26fa9428e34f4f10bcf2c068919aebcd6c64fb","tarball":"https://registry.npmjs.org/@edwinho/kotoba-gemini/-/kotoba-gemini-0.3.4.tgz","fileCount":13,"unpackedSize":117510,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICTrr+nOOe8azUVQmXJd6v3yZNRRC8cc0asMPjf1XIvcAiB+ygVjuUlt0+wQBmTW7gTCsco0nr//5FX2UvksL46OQg=="}]},"_npmUser":{"name":"edwinho","email":"edwin_ho@me.com"},"directories":{},"maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kotoba-gemini_0.3.4_1781421668207_0.7063121330868654"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-03T01:33:30.581Z","modified":"2026-06-14T07:21:08.452Z","0.1.0":"2026-06-03T01:33:30.957Z","0.2.0":"2026-06-05T01:06:32.530Z","0.3.0":"2026-06-10T10:22:55.081Z","0.3.1":"2026-06-10T22:57:37.257Z","0.3.2":"2026-06-13T00:51:57.599Z","0.3.3":"2026-06-13T10:08:00.180Z","0.3.4":"2026-06-14T07:21:08.341Z"},"bugs":{"url":"https://github.com/eho/kotoba/issues"},"author":{"name":"eho"},"license":"MIT","homepage":"https://github.com/eho/kotoba","keywords":["gemini","language-learning","translation","japanese","chinese","korean"],"repository":{"type":"git","url":"git+https://github.com/eho/kotoba.git","directory":"packages/gemini"},"description":"Gemini translation provider for Kotoba core translation drafts.","maintainers":[{"name":"edwinho","email":"edwin_ho@me.com"}],"readme":"# @edwinho/kotoba-gemini\n\nGemini translation provider for Kotoba `TranslationDraft` data. It is framework-neutral and depends only on `@edwinho/kotoba-core` and `@google/genai`.\n\n`@edwinho/kotoba-gemini` owns prompt construction, Gemini calls, response\nparsing, warning metadata, and draft normalization. Callers own where the\npackage runs, how API keys are stored, and any auth, quota, cache, persistence,\nor product policy around the request.\n\n## Provider Backends\n\nThe package does not read environment variables directly. Resolve provider\nconfiguration in the caller and pass it explicitly.\n\n### Gemini Developer API\n\nThe Developer API path is the default. Existing callers can keep passing only\n`apiKey`; `provider: \"developer_api\"` is optional.\n\n```ts\nimport { translateWithKotobaGemini } from \"@edwinho/kotoba-gemini\";\n\nconst result = await translateWithKotobaGemini(\n  {\n    inputText: \"thanks for today\",\n    learningLanguage: \"ja\",\n  },\n  {\n    provider: \"developer_api\",\n    apiKey: process.env.GEMINI_API_KEY ?? \"\",\n  }\n);\n```\n\nCallers may use `GEMINI_API_KEY`, a secret manager, or an explicit CLI flag.\nMissing keys throw a sanitized configuration error before any provider request\nis made.\n\n### Vertex AI\n\nUse Vertex AI when Gemini requests should be billed through a Google Cloud\nproject. The package passes `vertexai: true`, `project`, `location`, and\n`apiVersion` to `@google/genai`; `apiVersion` defaults to `\"v1\"`.\n\n```ts\nimport { translateWithKotobaGemini } from \"@edwinho/kotoba-gemini\";\n\nconst result = await translateWithKotobaGemini(\n  {\n    inputText: \"thanks for today\",\n    learningLanguage: \"ja\",\n  },\n  {\n    provider: \"vertex_ai\",\n    project: process.env.GOOGLE_CLOUD_PROJECT ?? \"\",\n    location: process.env.GOOGLE_CLOUD_LOCATION ?? \"global\",\n  }\n);\n```\n\nPass `googleAuthOptions` when the runtime needs explicit credentials. When no\nauth options are provided, `@google/genai` uses its normal runtime credential\nbehavior.\n\n```ts\nimport { createKotobaGeminiClient } from \"@edwinho/kotoba-gemini\";\n\nconst client = createKotobaGeminiClient({\n  provider: \"vertex_ai\",\n  project: \"kotoba-prod\",\n  location: \"global\",\n  googleAuthOptions: {\n    credentials: {\n      client_email: serviceAccount.client_email,\n      private_key: serviceAccount.private_key,\n    },\n  },\n});\n```\n\nMissing Vertex `project` or `location` values throw sanitized configuration\nerrors before any provider request is made. Successful translation results\nreturn `provider: \"gemini\"` and `providerBackend` as either `\"developer_api\"` or\n`\"vertex_ai\"` so callers can log the selected backend without changing the\ntranslation draft contract.\n\n## Privacy\n\nInput text and draft context are sent to Gemini to generate enrichment. Do not pass secrets, credentials, or personal data that should not be processed by the provider. The package returns sanitized warnings and does not log API keys or Vertex credentials.\n\nWhen used by `@edwinho/kotoba-cli`, the CLI sends the user's input text directly\nto Gemini using the user's Gemini API key.\n\n## Examples\n\nJapanese:\n\n```ts\nconst japanese = await translateWithKotobaGemini(\n  { inputText: \"I am hungry\", learningLanguage: \"ja\" },\n  { apiKey }\n);\nconsole.log(japanese.draft.targetText);\n```\n\nMandarin:\n\n```ts\nconst mandarin = await translateWithKotobaGemini(\n  {\n    inputText: \"welcome\",\n    learningLanguage: \"zh\",\n    chineseVariant: \"mandarin-simplified\",\n  },\n  { apiKey }\n);\nconsole.log(mandarin.draft.readingSystem);\n```\n\nKorean:\n\n```ts\nconst korean = await translateWithKotobaGemini(\n  { inputText: \"thank you\", learningLanguage: \"ko\" },\n  { apiKey }\n);\nconsole.log(korean.draft.enrichment?.korean);\n```\n\nThe default model is `gemini-2.5-flash-lite`. Pass `model` in the options\nobject to override it for evaluation. Google model availability changes over\ntime, so production integrations should periodically rerun Japanese morphology\nevals against current Flash and Flash-Lite models before changing their runtime\ndefault. Keep the package default when cost and speed are the priority; consider\na stronger Flash model for Japanese morphology-sensitive paths or as a runtime\nfallback after repeated JSON or metadata-quality warnings.\n\n## Study Token Metadata\n\nVersion `0.2.0` includes Gemini prompt, schema, and normalization support for\nJapanese study-token metadata.\n\nThe provider asks Gemini to include `metadata` for every confident Japanese verb\nor adjective study token, especially full inflected surfaces such as `食べます`\nor `高かった`. The field remains nullable for non-Japanese tokens,\nnon-morphology tokens, and low-confidence analysis. The package validates\nmetadata through `@edwinho/kotoba-core`, preserves valid metadata on the\nnormalized draft, and drops malformed metadata with a warning while keeping the\ntoken itself.\n\nGemini responses are still treated as provider output, not ground truth. The\nprovider layer retries malformed JSON up to two times and can ask Gemini to\nrepair missing verb/adjective metadata once. Core then applies deterministic\nvalidation and bounded Japanese morphology repairs. For example, if Gemini splits\n`食べました` into `食べ` + `ました`, or splits `高くないです` into `高く` +\n`ない` + `です`, core can keep `metadata.surface` aligned to the owning token\nand set `metadata.observedSurface` to the full observed phrase when the spans\nand morphology evidence are contiguous. If the provider does not return enough\nreliable evidence, callers should expect missing metadata rather than a guessed\nform table.\n\n```ts\nconst result = await translateWithKotobaGemini(\n  { inputText: \"I drank tea\", learningLanguage: \"ja\" },\n  { apiKey }\n);\n\nconst verbMetadata = result.draft.studyTokens.find(\n  (token) => token.surface === \"飲んだ\"\n)?.metadata;\n```\n\nOnly Japanese verb and adjective metadata is supported in this phase. Gemini\ndoes not return pre-rendered form tables; callers can pass validated metadata to\n`generateJapaneseFormTable()` from `@edwinho/kotoba-core`.\n\nFor learner-facing UI, treat form tables as AI-assisted grammar support. They\nare most reliable for common ichidan/godan verbs and common i-adjective and\nna-adjective forms. Retain provider warnings in logs so bad translations,\nunexpected tokenization, and repair failures can be audited.\n\n## Development\n\n```bash\nbun run --cwd packages/gemini build\nbun run --cwd packages/gemini typecheck\nbun run --cwd packages/gemini test\n```\n","readmeFilename":"README.md"}