openryoko 2026.8.21 → 2026.8.27

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 (164) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/cli/initial-config.d.ts +13 -0
  3. package/dist/src/cli/initial-config.d.ts.map +1 -0
  4. package/dist/src/cli/initial-config.js +39 -0
  5. package/dist/src/cli/initial-config.js.map +1 -0
  6. package/dist/src/cli/setup.d.ts.map +1 -1
  7. package/dist/src/cli/setup.js +4 -47
  8. package/dist/src/cli/setup.js.map +1 -1
  9. package/dist/src/cli/skills.d.ts +6 -0
  10. package/dist/src/cli/skills.d.ts.map +1 -1
  11. package/dist/src/cli/skills.js +96 -30
  12. package/dist/src/cli/skills.js.map +1 -1
  13. package/dist/src/gateway/api.d.ts.map +1 -1
  14. package/dist/src/gateway/api.js +36 -35
  15. package/dist/src/gateway/api.js.map +1 -1
  16. package/dist/src/gateway/onboarding-personalize.d.ts +15 -0
  17. package/dist/src/gateway/onboarding-personalize.d.ts.map +1 -0
  18. package/dist/src/gateway/onboarding-personalize.js +31 -0
  19. package/dist/src/gateway/onboarding-personalize.js.map +1 -0
  20. package/dist/src/gateway/portal-config.d.ts +14 -0
  21. package/dist/src/gateway/portal-config.d.ts.map +1 -0
  22. package/dist/src/gateway/portal-config.js +47 -0
  23. package/dist/src/gateway/portal-config.js.map +1 -0
  24. package/dist/src/sessions/context.d.ts +1 -0
  25. package/dist/src/sessions/context.d.ts.map +1 -1
  26. package/dist/src/sessions/context.js +44 -28
  27. package/dist/src/sessions/context.js.map +1 -1
  28. package/dist/src/shared/paths.d.ts +2 -0
  29. package/dist/src/shared/paths.d.ts.map +1 -1
  30. package/dist/src/shared/paths.js +9 -1
  31. package/dist/src/shared/paths.js.map +1 -1
  32. package/dist/web/404.html +1 -1
  33. package/dist/web/__next.__PAGE__.txt +1 -1
  34. package/dist/web/__next._full.txt +1 -1
  35. package/dist/web/__next._tree.txt +1 -1
  36. package/dist/web/_next/static/chunks/{0y5p4spyfs35l.js → 302onz3a3kflv.js} +1 -1
  37. package/dist/web/_not-found/__next._full.txt +1 -1
  38. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
  39. package/dist/web/_not-found/__next._tree.txt +1 -1
  40. package/dist/web/_not-found.html +1 -1
  41. package/dist/web/_not-found.txt +1 -1
  42. package/dist/web/chat/__next._full.txt +2 -2
  43. package/dist/web/chat/__next._tree.txt +1 -1
  44. package/dist/web/chat/__next.chat.__PAGE__.txt +2 -2
  45. package/dist/web/chat.html +1 -1
  46. package/dist/web/chat.txt +2 -2
  47. package/dist/web/cron/__next._full.txt +1 -1
  48. package/dist/web/cron/__next._tree.txt +1 -1
  49. package/dist/web/cron/__next.cron.__PAGE__.txt +1 -1
  50. package/dist/web/cron.html +1 -1
  51. package/dist/web/cron.txt +1 -1
  52. package/dist/web/index.html +1 -1
  53. package/dist/web/index.txt +1 -1
  54. package/dist/web/kanban/__next._full.txt +1 -1
  55. package/dist/web/kanban/__next._tree.txt +1 -1
  56. package/dist/web/kanban/__next.kanban.__PAGE__.txt +1 -1
  57. package/dist/web/kanban.html +1 -1
  58. package/dist/web/kanban.txt +1 -1
  59. package/dist/web/logs/__next._full.txt +1 -1
  60. package/dist/web/logs/__next._tree.txt +1 -1
  61. package/dist/web/logs/__next.logs.__PAGE__.txt +1 -1
  62. package/dist/web/logs.html +1 -1
  63. package/dist/web/logs.txt +1 -1
  64. package/dist/web/org/__next._full.txt +1 -1
  65. package/dist/web/org/__next._tree.txt +1 -1
  66. package/dist/web/org/__next.org.__PAGE__.txt +1 -1
  67. package/dist/web/org.html +1 -1
  68. package/dist/web/org.txt +1 -1
  69. package/dist/web/sessions/__next._full.txt +1 -1
  70. package/dist/web/sessions/__next._tree.txt +1 -1
  71. package/dist/web/sessions/__next.sessions.__PAGE__.txt +1 -1
  72. package/dist/web/sessions.html +1 -1
  73. package/dist/web/sessions.txt +1 -1
  74. package/dist/web/settings/__next._full.txt +1 -1
  75. package/dist/web/settings/__next._tree.txt +1 -1
  76. package/dist/web/settings/__next.settings.__PAGE__.txt +1 -1
  77. package/dist/web/settings.html +1 -1
  78. package/dist/web/settings.txt +1 -1
  79. package/dist/web/skills/__next._full.txt +1 -1
  80. package/dist/web/skills/__next._tree.txt +1 -1
  81. package/dist/web/skills/__next.skills.__PAGE__.txt +1 -1
  82. package/dist/web/skills.html +1 -1
  83. package/dist/web/skills.txt +1 -1
  84. package/package.json +2 -2
  85. package/template/BOOTSTRAP.md +5 -3
  86. package/template/config.default.yaml +4 -4
  87. package/template/docs/architecture.md +2 -2
  88. package/template/docs/cron.md +5 -3
  89. package/template/docs/mcp.md +1 -1
  90. package/template/docs/org.md +17 -11
  91. package/template/docs/overview.md +4 -3
  92. package/template/docs/self-modification.md +7 -7
  93. package/template/docs/skills.md +11 -8
  94. package/template/skills/cron-manager/SKILL.md +7 -7
  95. package/template/skills/management/SKILL.md +1 -1
  96. package/template/skills/self-heal/SKILL.md +7 -7
  97. package/template/skills/skill-creator/SKILL.md +9 -9
  98. package/dist/web/__next._head.txt +0 -6
  99. package/dist/web/__next._index.txt +0 -6
  100. package/dist/web/_next/static/chunks/012aakl34ff5a.js +0 -5
  101. package/dist/web/_next/static/chunks/03~yq9q893hmn.js +0 -1
  102. package/dist/web/_next/static/chunks/0a2uy1kw.~j~c.js +0 -1
  103. package/dist/web/_next/static/chunks/0agxgztb0b~.7.js +0 -5
  104. package/dist/web/_next/static/chunks/0dtbl8648b3u9.js +0 -7
  105. package/dist/web/_next/static/chunks/0e3pdjkorr5zl.js +0 -2
  106. package/dist/web/_next/static/chunks/0ewpxy-mzj3j3.js +0 -1
  107. package/dist/web/_next/static/chunks/0g6xt.91k~0bc.js +0 -5
  108. package/dist/web/_next/static/chunks/0jm3e~uc~qd~p.js +0 -79
  109. package/dist/web/_next/static/chunks/0jzw1gpuag8bc.js +0 -5
  110. package/dist/web/_next/static/chunks/0lkp92-ovteta.js +0 -5
  111. package/dist/web/_next/static/chunks/0lt7kv1k1jla0.js +0 -1
  112. package/dist/web/_next/static/chunks/0msmlzd_~uk0y.js +0 -5
  113. package/dist/web/_next/static/chunks/0ru56x83x4rkk.js +0 -1
  114. package/dist/web/_next/static/chunks/0tcvgwr3rcw29.js +0 -1
  115. package/dist/web/_next/static/chunks/0tf9kpygstdls.js +0 -1
  116. package/dist/web/_next/static/chunks/0y3dnnq~kxyz_.js +0 -1
  117. package/dist/web/_next/static/chunks/0~6m1p5hnsx2f.js +0 -1
  118. package/dist/web/_next/static/chunks/10-liamt-ipcu.js +0 -1
  119. package/dist/web/_next/static/chunks/103zsy0q9psfj.css +0 -1
  120. package/dist/web/_next/static/chunks/10l08hq.acixl.js +0 -5
  121. package/dist/web/_next/static/chunks/11rbefjn.e-3-.js +0 -1
  122. package/dist/web/_next/static/chunks/11rodb4s1x4of.js +0 -1
  123. package/dist/web/_next/static/chunks/12_uxtnrqhoo1.js +0 -1
  124. package/dist/web/_next/static/chunks/12m97bwrg1tuu.js +0 -5
  125. package/dist/web/_next/static/chunks/13juizw904g.e.js +0 -1
  126. package/dist/web/_next/static/chunks/14ge_q22f0n.f.js +0 -1
  127. package/dist/web/_next/static/chunks/17-u9c_weg12-.js +0 -31
  128. package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +0 -1
  129. package/dist/web/_next/static/chunks/turbopack-0dt987bw_1nyf.js +0 -1
  130. package/dist/web/_next/static/media/apple-icon.0.wpl4.d-5bkf.jpg +0 -0
  131. package/dist/web/_next/static/media/icon.0.wpl4.d-5bkf.jpg +0 -0
  132. package/dist/web/_next/static/qeykWjfc1T7SjJSULdD7s/_buildManifest.js +0 -11
  133. package/dist/web/_next/static/qeykWjfc1T7SjJSULdD7s/_clientMiddlewareManifest.js +0 -1
  134. package/dist/web/_next/static/qeykWjfc1T7SjJSULdD7s/_ssgManifest.js +0 -1
  135. package/dist/web/_not-found/__next._head.txt +0 -6
  136. package/dist/web/_not-found/__next._index.txt +0 -6
  137. package/dist/web/_not-found/__next._not-found.txt +0 -5
  138. package/dist/web/chat/__next._head.txt +0 -6
  139. package/dist/web/chat/__next._index.txt +0 -6
  140. package/dist/web/chat/__next.chat.txt +0 -5
  141. package/dist/web/cron/__next._head.txt +0 -6
  142. package/dist/web/cron/__next._index.txt +0 -6
  143. package/dist/web/cron/__next.cron.txt +0 -5
  144. package/dist/web/kanban/__next._head.txt +0 -6
  145. package/dist/web/kanban/__next._index.txt +0 -6
  146. package/dist/web/kanban/__next.kanban.txt +0 -5
  147. package/dist/web/logs/__next._head.txt +0 -6
  148. package/dist/web/logs/__next._index.txt +0 -6
  149. package/dist/web/logs/__next.logs.txt +0 -5
  150. package/dist/web/org/__next._head.txt +0 -6
  151. package/dist/web/org/__next._index.txt +0 -6
  152. package/dist/web/org/__next.org.txt +0 -5
  153. package/dist/web/sessions/__next._head.txt +0 -6
  154. package/dist/web/sessions/__next._index.txt +0 -6
  155. package/dist/web/sessions/__next.sessions.txt +0 -5
  156. package/dist/web/settings/__next._head.txt +0 -6
  157. package/dist/web/settings/__next._index.txt +0 -6
  158. package/dist/web/settings/__next.settings.txt +0 -5
  159. package/dist/web/skills/__next._head.txt +0 -6
  160. package/dist/web/skills/__next._index.txt +0 -6
  161. package/dist/web/skills/__next.skills.txt +0 -5
  162. /package/dist/web/_next/static/{UDwWEfKiZ-eIOpfOIPKQr → Da2BlMpDPFofGxzd6GngP}/_buildManifest.js +0 -0
  163. /package/dist/web/_next/static/{UDwWEfKiZ-eIOpfOIPKQr → Da2BlMpDPFofGxzd6GngP}/_clientMiddlewareManifest.js +0 -0
  164. /package/dist/web/_next/static/{UDwWEfKiZ-eIOpfOIPKQr → Da2BlMpDPFofGxzd6GngP}/_ssgManifest.js +0 -0
@@ -35,6 +35,8 @@ import { getDiskSpaceStatus } from "../shared/storage-health.js";
35
35
  import { ptySnapshotStore } from "../engines/pty-snapshot.js";
36
36
  import { collectClaudeUsage } from "../shared/claude-usage.js";
37
37
  import { PairingAttemptLimiter, pairingAttemptKey } from "./pairing-rate-limit.js";
38
+ import { personalizeInstructionMd, personalizeIdentityMd, resolveEffectiveName } from "./onboarding-personalize.js";
39
+ import { patchPortalSection, writeFileAtomic } from "./portal-config.js";
38
40
  /** Max bytes accepted on /api/internal/hook (loopback-only relay payloads are tiny). */
39
41
  const HOOK_BODY_MAX_BYTES = 64 * 1024;
40
42
  const PAIR_BODY_MAX_BYTES = 1024;
@@ -1886,51 +1888,50 @@ Handle this as a priority request from a colleague.`;
1886
1888
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1887
1889
  const body = _parsed.body;
1888
1890
  const { portalName, operatorName, language } = body;
1889
- // Read current config and merge portal settings
1891
+ // Read current config and merge portal settings. Empty strings are
1892
+ // treated as "not provided" — deleting the key would silently revert
1893
+ // the portal to its defaults.
1890
1894
  const config = context.getConfig();
1891
- const updated = {
1892
- ...config,
1893
- portal: {
1894
- ...config.portal,
1895
- onboarded: true,
1896
- ...(portalName !== undefined && { portalName: portalName || undefined }),
1897
- ...(operatorName !== undefined && { operatorName: operatorName || undefined }),
1898
- ...(language !== undefined && { language: language || undefined }),
1899
- },
1895
+ const provided = (v) => typeof v === "string" && v.trim() !== "";
1896
+ const portalPatch = {
1897
+ ...config.portal,
1898
+ onboarded: true,
1899
+ ...(provided(portalName) && { portalName }),
1900
+ ...(provided(operatorName) && { operatorName }),
1901
+ ...(provided(language) && { language }),
1900
1902
  };
1901
- // Write updated config
1902
- const yamlStr = yaml.dump(updated, { lineWidth: -1 });
1903
- fs.writeFileSync(CONFIG_PATH, yamlStr);
1903
+ const updated = { ...config, portal: portalPatch };
1904
+ // Patch only the portal block — a whole-file yaml.dump would strip
1905
+ // every comment the shipped config template carries.
1906
+ const rawConfig = fs.existsSync(CONFIG_PATH) ? fs.readFileSync(CONFIG_PATH, "utf-8") : "";
1907
+ writeFileAtomic(CONFIG_PATH, patchPortalSection(rawConfig, portalPatch));
1904
1908
  logger.info(`Onboarding: portal name="${portalName}", operator="${operatorName}", language="${language}"`);
1905
- const effectiveName = portalName || "Ryoko";
1909
+ const effectiveName = resolveEffectiveName(portalName, config.portal?.portalName);
1906
1910
  const languageSection = language && language !== "English"
1907
1911
  ? `\n\n## Language\nAlways respond in ${language}. All communication with the user must be in ${language}.`
1908
1912
  : "";
1909
- // Update CLAUDE.md with personalized COO name and language
1910
- const claudeMdPath = path.join(JINN_HOME, "CLAUDE.md");
1911
- if (fs.existsSync(claudeMdPath)) {
1912
- let claudeMd = fs.readFileSync(claudeMdPath, "utf-8");
1913
- // Replace the identity line in CLAUDE.md
1914
- claudeMd = claudeMd.replace(/^You are \w+, the COO of the user's AI organization\.$/m, `You are ${effectiveName}, the COO of the user's AI organization.`);
1915
- // Remove existing language section if present, then add new one if needed
1916
- claudeMd = claudeMd.replace(/\n\n## Language\nAlways respond in .+\. All communication with the user must be in .+\./m, "");
1917
- if (languageSection) {
1918
- claudeMd = claudeMd.trimEnd() + languageSection + "\n";
1913
+ // Update CLAUDE.md / AGENTS.md: language section always; the name only
1914
+ // when this request actually carries one (a language-only update must
1915
+ // not rename a customized assistant back to the default).
1916
+ for (const filename of ["CLAUDE.md", "AGENTS.md"]) {
1917
+ const mdPath = path.join(JINN_HOME, filename);
1918
+ if (!fs.existsSync(mdPath))
1919
+ continue;
1920
+ let md = fs.readFileSync(mdPath, "utf-8");
1921
+ if (provided(portalName)) {
1922
+ md = personalizeInstructionMd(md, effectiveName);
1919
1923
  }
1920
- fs.writeFileSync(claudeMdPath, claudeMd);
1921
- }
1922
- // Update AGENTS.md with personalized name and language
1923
- const agentsMdPath = path.join(JINN_HOME, "AGENTS.md");
1924
- if (fs.existsSync(agentsMdPath)) {
1925
- let agentsMd = fs.readFileSync(agentsMdPath, "utf-8");
1926
- // Replace the bold identity line (e.g. "You are **Jinn**")
1927
- agentsMd = agentsMd.replace(/You are \*\*\w+\*\*/, `You are **${effectiveName}**`);
1928
1924
  // Remove existing language section if present, then add new one if needed
1929
- agentsMd = agentsMd.replace(/\n\n## Language\nAlways respond in .+\. All communication with the user must be in .+\./m, "");
1925
+ md = md.replace(/\n\n## Language\nAlways respond in .+\. All communication with the user must be in .+\./m, "");
1930
1926
  if (languageSection) {
1931
- agentsMd = agentsMd.trimEnd() + languageSection + "\n";
1927
+ md = md.trimEnd() + languageSection + "\n";
1932
1928
  }
1933
- fs.writeFileSync(agentsMdPath, agentsMd);
1929
+ writeFileAtomic(mdPath, md);
1930
+ }
1931
+ // Keep the persona file's Name section in sync
1932
+ const identityMdPath = path.join(JINN_HOME, "IDENTITY.md");
1933
+ if (provided(portalName) && fs.existsSync(identityMdPath)) {
1934
+ writeFileAtomic(identityMdPath, personalizeIdentityMd(fs.readFileSync(identityMdPath, "utf-8"), effectiveName));
1934
1935
  }
1935
1936
  context.emit("config:updated", { portal: updated.portal });
1936
1937
  return json(res, { status: "ok", portal: updated.portal });