@zwbigi/ink-xy 0.1.2 → 0.1.4

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 (598) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -2
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/server/app/_global-error.html +1 -1
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +1 -1
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  15. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  16. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/.next/server/app/api/inkos/route.js.nft.json +1 -1
  21. package/.next/server/app/api/skills/install/route.js.nft.json +1 -1
  22. package/.next/server/app/api/skills/search/route.js.nft.json +1 -1
  23. package/.next/server/app/index.html +1 -1
  24. package/.next/server/app/index.rsc +1 -1
  25. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  26. package/.next/server/app/index.segments/_full.segment.rsc +1 -1
  27. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  28. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  29. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/app-paths-manifest.json +2 -2
  31. package/.next/server/chunks/162.js +1 -1
  32. package/.next/server/middleware-build-manifest.js +1 -1
  33. package/.next/server/pages/404.html +1 -1
  34. package/.next/server/pages/500.html +1 -1
  35. package/.next/trace +4 -4
  36. package/.next/trace-build +1 -1
  37. package/bin/pi-web.js +4 -1
  38. package/inkos/.env.example +20 -0
  39. package/inkos/.node-version +1 -0
  40. package/inkos/.nvmrc +1 -0
  41. package/inkos/CHANGELOG.md +787 -0
  42. package/inkos/CONTRIBUTING.md +89 -0
  43. package/inkos/LICENSE +661 -0
  44. package/inkos/README.en.md +483 -0
  45. package/inkos/README.ja.md +461 -0
  46. package/inkos/README.md +272 -0
  47. package/inkos/assets/15qun.jpg +0 -0
  48. package/inkos/assets/41777702961_.pic.jpg +0 -0
  49. package/inkos/assets/inkos-short-demo-cover.png +0 -0
  50. package/inkos/assets/inkos-text.svg +40 -0
  51. package/inkos/assets/logo.svg +47 -0
  52. package/inkos/assets/screenshot-chapters.png +0 -0
  53. package/inkos/assets/screenshot-pipeline.png +0 -0
  54. package/inkos/assets/screenshot-state.png +0 -0
  55. package/inkos/assets/screenshot-terminal.png +0 -0
  56. package/inkos/assets/wechat-group-v8.jpg +0 -0
  57. package/inkos/package.json +42 -0
  58. package/inkos/packages/cli/package.json +74 -0
  59. package/inkos/packages/cli/src/__tests__/analytics.test.ts +154 -0
  60. package/inkos/packages/cli/src/__tests__/cli-integration.test.ts +1031 -0
  61. package/inkos/packages/cli/src/__tests__/daemon.test.ts +93 -0
  62. package/inkos/packages/cli/src/__tests__/doctor.test.ts +36 -0
  63. package/inkos/packages/cli/src/__tests__/interact-command.test.ts +142 -0
  64. package/inkos/packages/cli/src/__tests__/interaction-tools.test.ts +107 -0
  65. package/inkos/packages/cli/src/__tests__/llm-overrides.test.ts +25 -0
  66. package/inkos/packages/cli/src/__tests__/localization.test.ts +121 -0
  67. package/inkos/packages/cli/src/__tests__/progress-text.test.ts +92 -0
  68. package/inkos/packages/cli/src/__tests__/project-bootstrap.test.ts +71 -0
  69. package/inkos/packages/cli/src/__tests__/publish-package.test.ts +272 -0
  70. package/inkos/packages/cli/src/__tests__/revision-command.test.ts +82 -0
  71. package/inkos/packages/cli/src/__tests__/runtime-requirements.test.ts +89 -0
  72. package/inkos/packages/cli/src/__tests__/short-fiction-command.test.ts +48 -0
  73. package/inkos/packages/cli/src/__tests__/studio-runtime.test.ts +142 -0
  74. package/inkos/packages/cli/src/__tests__/studio.test.ts +87 -0
  75. package/inkos/packages/cli/src/__tests__/tui-activity-state.test.ts +20 -0
  76. package/inkos/packages/cli/src/__tests__/tui-agent-session.test.ts +213 -0
  77. package/inkos/packages/cli/src/__tests__/tui-chat-depth.test.ts +27 -0
  78. package/inkos/packages/cli/src/__tests__/tui-chat-draft.test.ts +44 -0
  79. package/inkos/packages/cli/src/__tests__/tui-command.test.ts +86 -0
  80. package/inkos/packages/cli/src/__tests__/tui-composer-caret.test.ts +46 -0
  81. package/inkos/packages/cli/src/__tests__/tui-composer-display.test.ts +40 -0
  82. package/inkos/packages/cli/src/__tests__/tui-dashboard.test.tsx +219 -0
  83. package/inkos/packages/cli/src/__tests__/tui-effects-i18n.test.ts +29 -0
  84. package/inkos/packages/cli/src/__tests__/tui-i18n.test.ts +22 -0
  85. package/inkos/packages/cli/src/__tests__/tui-input-chrome.test.ts +10 -0
  86. package/inkos/packages/cli/src/__tests__/tui-input-history.test.ts +40 -0
  87. package/inkos/packages/cli/src/__tests__/tui-layout.test.ts +55 -0
  88. package/inkos/packages/cli/src/__tests__/tui-local-commands.test.ts +47 -0
  89. package/inkos/packages/cli/src/__tests__/tui-session-store.test.ts +81 -0
  90. package/inkos/packages/cli/src/__tests__/tui-setup-i18n.test.ts +31 -0
  91. package/inkos/packages/cli/src/__tests__/tui-slash-autocomplete.test.ts +33 -0
  92. package/inkos/packages/cli/src/commands/agent.ts +65 -0
  93. package/inkos/packages/cli/src/commands/analytics.ts +77 -0
  94. package/inkos/packages/cli/src/commands/audit.ts +52 -0
  95. package/inkos/packages/cli/src/commands/book.ts +260 -0
  96. package/inkos/packages/cli/src/commands/compose.ts +50 -0
  97. package/inkos/packages/cli/src/commands/config.ts +328 -0
  98. package/inkos/packages/cli/src/commands/consolidate.ts +50 -0
  99. package/inkos/packages/cli/src/commands/daemon.ts +121 -0
  100. package/inkos/packages/cli/src/commands/detect.ts +125 -0
  101. package/inkos/packages/cli/src/commands/doctor.ts +391 -0
  102. package/inkos/packages/cli/src/commands/draft.ts +43 -0
  103. package/inkos/packages/cli/src/commands/eval.ts +217 -0
  104. package/inkos/packages/cli/src/commands/export.ts +45 -0
  105. package/inkos/packages/cli/src/commands/fanfic.ts +183 -0
  106. package/inkos/packages/cli/src/commands/genre.ts +160 -0
  107. package/inkos/packages/cli/src/commands/import.ts +158 -0
  108. package/inkos/packages/cli/src/commands/init.ts +47 -0
  109. package/inkos/packages/cli/src/commands/interact.ts +109 -0
  110. package/inkos/packages/cli/src/commands/plan.ts +54 -0
  111. package/inkos/packages/cli/src/commands/radar.ts +60 -0
  112. package/inkos/packages/cli/src/commands/review.ts +253 -0
  113. package/inkos/packages/cli/src/commands/revise.ts +58 -0
  114. package/inkos/packages/cli/src/commands/short-fiction.ts +294 -0
  115. package/inkos/packages/cli/src/commands/status.ts +138 -0
  116. package/inkos/packages/cli/src/commands/studio.ts +194 -0
  117. package/inkos/packages/cli/src/commands/style.ts +99 -0
  118. package/inkos/packages/cli/src/commands/tui.ts +18 -0
  119. package/inkos/packages/cli/src/commands/update.ts +45 -0
  120. package/inkos/packages/cli/src/commands/write.ts +324 -0
  121. package/inkos/packages/cli/src/index.ts +5 -0
  122. package/inkos/packages/cli/src/interaction/tools.ts +49 -0
  123. package/inkos/packages/cli/src/localization.ts +215 -0
  124. package/inkos/packages/cli/src/program.ts +106 -0
  125. package/inkos/packages/cli/src/progress-text.ts +85 -0
  126. package/inkos/packages/cli/src/project-bootstrap.ts +175 -0
  127. package/inkos/packages/cli/src/runtime-requirements.ts +135 -0
  128. package/inkos/packages/cli/src/tui/__tests__/markdown.test.ts +64 -0
  129. package/inkos/packages/cli/src/tui/activity-state.ts +41 -0
  130. package/inkos/packages/cli/src/tui/agent-input.ts +264 -0
  131. package/inkos/packages/cli/src/tui/ansi.ts +72 -0
  132. package/inkos/packages/cli/src/tui/app.ts +130 -0
  133. package/inkos/packages/cli/src/tui/chat-depth.ts +22 -0
  134. package/inkos/packages/cli/src/tui/chat-draft.ts +42 -0
  135. package/inkos/packages/cli/src/tui/composer-caret.ts +22 -0
  136. package/inkos/packages/cli/src/tui/composer-display.ts +26 -0
  137. package/inkos/packages/cli/src/tui/dashboard-model.ts +164 -0
  138. package/inkos/packages/cli/src/tui/dashboard.tsx +544 -0
  139. package/inkos/packages/cli/src/tui/effects.ts +542 -0
  140. package/inkos/packages/cli/src/tui/i18n.ts +278 -0
  141. package/inkos/packages/cli/src/tui/input-history.ts +69 -0
  142. package/inkos/packages/cli/src/tui/local-commands.ts +55 -0
  143. package/inkos/packages/cli/src/tui/markdown.ts +64 -0
  144. package/inkos/packages/cli/src/tui/session-store.ts +6 -0
  145. package/inkos/packages/cli/src/tui/setup.ts +397 -0
  146. package/inkos/packages/cli/src/tui/slash-autocomplete.ts +62 -0
  147. package/inkos/packages/cli/src/tui/theme.ts +17 -0
  148. package/inkos/packages/cli/src/utils.ts +222 -0
  149. package/inkos/packages/cli/tsconfig.json +9 -0
  150. package/inkos/packages/core/genres/cozy.md +43 -0
  151. package/inkos/packages/core/genres/cultivation.md +42 -0
  152. package/inkos/packages/core/genres/dungeon-core.md +40 -0
  153. package/inkos/packages/core/genres/horror.md +51 -0
  154. package/inkos/packages/core/genres/isekai.md +43 -0
  155. package/inkos/packages/core/genres/litrpg.md +43 -0
  156. package/inkos/packages/core/genres/other.md +24 -0
  157. package/inkos/packages/core/genres/progression.md +41 -0
  158. package/inkos/packages/core/genres/romantasy.md +45 -0
  159. package/inkos/packages/core/genres/sci-fi.md +42 -0
  160. package/inkos/packages/core/genres/system-apocalypse.md +40 -0
  161. package/inkos/packages/core/genres/tower-climber.md +41 -0
  162. package/inkos/packages/core/genres/urban.md +53 -0
  163. package/inkos/packages/core/genres/xianxia.md +46 -0
  164. package/inkos/packages/core/genres/xuanhuan.md +64 -0
  165. package/inkos/packages/core/package.json +61 -0
  166. package/inkos/packages/core/src/__tests__/agent-max-tokens-policy.test.ts +29 -0
  167. package/inkos/packages/core/src/__tests__/agent-session.test.ts +866 -0
  168. package/inkos/packages/core/src/__tests__/agent-system-prompt.test.ts +167 -0
  169. package/inkos/packages/core/src/__tests__/agent-tools-params.test.ts +197 -0
  170. package/inkos/packages/core/src/__tests__/agent-tools.test.ts +421 -0
  171. package/inkos/packages/core/src/__tests__/ai-tells.test.ts +90 -0
  172. package/inkos/packages/core/src/__tests__/architect-phase5-consolidated.test.ts +445 -0
  173. package/inkos/packages/core/src/__tests__/architect-phase5.test.ts +455 -0
  174. package/inkos/packages/core/src/__tests__/architect-phase7.test.ts +210 -0
  175. package/inkos/packages/core/src/__tests__/architect.test.ts +859 -0
  176. package/inkos/packages/core/src/__tests__/audit-parse.test.ts +78 -0
  177. package/inkos/packages/core/src/__tests__/book-id.test.ts +26 -0
  178. package/inkos/packages/core/src/__tests__/book-session-store.test.ts +447 -0
  179. package/inkos/packages/core/src/__tests__/book-session.test.ts +113 -0
  180. package/inkos/packages/core/src/__tests__/chapter-analyzer.test.ts +574 -0
  181. package/inkos/packages/core/src/__tests__/chapter-memo-parser.test.ts +247 -0
  182. package/inkos/packages/core/src/__tests__/chapter-persistence.test.ts +198 -0
  183. package/inkos/packages/core/src/__tests__/chapter-review-cycle.test.ts +294 -0
  184. package/inkos/packages/core/src/__tests__/chapter-splitter.test.ts +156 -0
  185. package/inkos/packages/core/src/__tests__/chapter-state-recovery.test.ts +235 -0
  186. package/inkos/packages/core/src/__tests__/chapter-truth-validation.test.ts +253 -0
  187. package/inkos/packages/core/src/__tests__/composer.test.ts +627 -0
  188. package/inkos/packages/core/src/__tests__/config-loader.test.ts +325 -0
  189. package/inkos/packages/core/src/__tests__/config-migration.test.ts +102 -0
  190. package/inkos/packages/core/src/__tests__/consolidator.test.ts +32 -0
  191. package/inkos/packages/core/src/__tests__/context-filter.test.ts +60 -0
  192. package/inkos/packages/core/src/__tests__/context-transform.test.ts +108 -0
  193. package/inkos/packages/core/src/__tests__/continuity.test.ts +391 -0
  194. package/inkos/packages/core/src/__tests__/detection-insights.test.ts +59 -0
  195. package/inkos/packages/core/src/__tests__/detector.test.ts +86 -0
  196. package/inkos/packages/core/src/__tests__/draft-directive-parser.test.ts +386 -0
  197. package/inkos/packages/core/src/__tests__/edit-controller.test.ts +190 -0
  198. package/inkos/packages/core/src/__tests__/effective-llm-config.test.ts +486 -0
  199. package/inkos/packages/core/src/__tests__/fanfic-dimensions.test.ts +58 -0
  200. package/inkos/packages/core/src/__tests__/fanfic-models.test.ts +69 -0
  201. package/inkos/packages/core/src/__tests__/governed-working-set.test.ts +155 -0
  202. package/inkos/packages/core/src/__tests__/hook-arbiter.test.ts +124 -0
  203. package/inkos/packages/core/src/__tests__/hook-governance.test.ts +228 -0
  204. package/inkos/packages/core/src/__tests__/hook-health.test.ts +166 -0
  205. package/inkos/packages/core/src/__tests__/hook-ledger-validator.test.ts +236 -0
  206. package/inkos/packages/core/src/__tests__/hook-promotion.test.ts +192 -0
  207. package/inkos/packages/core/src/__tests__/hook-stale-detection.test.ts +136 -0
  208. package/inkos/packages/core/src/__tests__/index-notify-lazy.test.ts +20 -0
  209. package/inkos/packages/core/src/__tests__/interaction-chat-tokens.test.ts +170 -0
  210. package/inkos/packages/core/src/__tests__/interaction-models.test.ts +155 -0
  211. package/inkos/packages/core/src/__tests__/interaction-nl-router.test.ts +223 -0
  212. package/inkos/packages/core/src/__tests__/interaction-runtime.test.ts +633 -0
  213. package/inkos/packages/core/src/__tests__/interaction-tools.test.ts +343 -0
  214. package/inkos/packages/core/src/__tests__/length-metrics.test.ts +82 -0
  215. package/inkos/packages/core/src/__tests__/length-normalizer.test.ts +331 -0
  216. package/inkos/packages/core/src/__tests__/list-models.test.ts +109 -0
  217. package/inkos/packages/core/src/__tests__/llm-env.test.ts +31 -0
  218. package/inkos/packages/core/src/__tests__/logger.test.ts +175 -0
  219. package/inkos/packages/core/src/__tests__/long-span-fatigue.test.ts +160 -0
  220. package/inkos/packages/core/src/__tests__/memory-retrieval.test.ts +1303 -0
  221. package/inkos/packages/core/src/__tests__/models.test.ts +918 -0
  222. package/inkos/packages/core/src/__tests__/outline-paths.test.ts +97 -0
  223. package/inkos/packages/core/src/__tests__/path-safety.test.ts +22 -0
  224. package/inkos/packages/core/src/__tests__/persisted-governed-plan.test.ts +134 -0
  225. package/inkos/packages/core/src/__tests__/phase5-cleanup.test.ts +393 -0
  226. package/inkos/packages/core/src/__tests__/phase5-hotfix.test.ts +288 -0
  227. package/inkos/packages/core/src/__tests__/phase7-hotfix.test.ts +614 -0
  228. package/inkos/packages/core/src/__tests__/pipeline-agent.test.ts +354 -0
  229. package/inkos/packages/core/src/__tests__/pipeline-runner-memory-sync.test.ts +317 -0
  230. package/inkos/packages/core/src/__tests__/pipeline-runner.test.ts +5200 -0
  231. package/inkos/packages/core/src/__tests__/planner-context.test.ts +137 -0
  232. package/inkos/packages/core/src/__tests__/planner-prompts-ratio.test.ts +11 -0
  233. package/inkos/packages/core/src/__tests__/planner-prompts.test.ts +171 -0
  234. package/inkos/packages/core/src/__tests__/planner.test.ts +362 -0
  235. package/inkos/packages/core/src/__tests__/planning-materials.test.ts +90 -0
  236. package/inkos/packages/core/src/__tests__/polisher.test.ts +189 -0
  237. package/inkos/packages/core/src/__tests__/post-write-validator.test.ts +291 -0
  238. package/inkos/packages/core/src/__tests__/probe.test.ts +77 -0
  239. package/inkos/packages/core/src/__tests__/project-interaction.test.ts +241 -0
  240. package/inkos/packages/core/src/__tests__/provider.test.ts +953 -0
  241. package/inkos/packages/core/src/__tests__/providers-group.test.ts +34 -0
  242. package/inkos/packages/core/src/__tests__/providers-lookup.test.ts +81 -0
  243. package/inkos/packages/core/src/__tests__/providers-schema.test.ts +158 -0
  244. package/inkos/packages/core/src/__tests__/proxy-fetch.test.ts +75 -0
  245. package/inkos/packages/core/src/__tests__/revise-foundation.test.ts +514 -0
  246. package/inkos/packages/core/src/__tests__/reviser.test.ts +859 -0
  247. package/inkos/packages/core/src/__tests__/runtime-state-store.test.ts +388 -0
  248. package/inkos/packages/core/src/__tests__/scheduler.test.ts +123 -0
  249. package/inkos/packages/core/src/__tests__/secrets-migration.test.ts +71 -0
  250. package/inkos/packages/core/src/__tests__/secrets.test.ts +95 -0
  251. package/inkos/packages/core/src/__tests__/sensitive-words.test.ts +88 -0
  252. package/inkos/packages/core/src/__tests__/service-presets-regression.test.ts +73 -0
  253. package/inkos/packages/core/src/__tests__/service-resolver-regression.test.ts +75 -0
  254. package/inkos/packages/core/src/__tests__/service-resolver.test.ts +228 -0
  255. package/inkos/packages/core/src/__tests__/session-transcript-restore.test.ts +1311 -0
  256. package/inkos/packages/core/src/__tests__/session-transcript.test.ts +195 -0
  257. package/inkos/packages/core/src/__tests__/settler-delta-parser.test.ts +133 -0
  258. package/inkos/packages/core/src/__tests__/short-fiction-public.test.ts +241 -0
  259. package/inkos/packages/core/src/__tests__/spot-fix-patches.test.ts +104 -0
  260. package/inkos/packages/core/src/__tests__/state-manager.test.ts +1298 -0
  261. package/inkos/packages/core/src/__tests__/state-projections.test.ts +130 -0
  262. package/inkos/packages/core/src/__tests__/state-reducer.test.ts +372 -0
  263. package/inkos/packages/core/src/__tests__/state-validator-agent.test.ts +165 -0
  264. package/inkos/packages/core/src/__tests__/state-validator.test.ts +122 -0
  265. package/inkos/packages/core/src/__tests__/style-analyzer.test.ts +61 -0
  266. package/inkos/packages/core/src/__tests__/temperature-constraints.test.ts +57 -0
  267. package/inkos/packages/core/src/__tests__/v13-hotfix-round4.test.ts +343 -0
  268. package/inkos/packages/core/src/__tests__/verify-service.test.ts +77 -0
  269. package/inkos/packages/core/src/__tests__/webhook.test.ts +91 -0
  270. package/inkos/packages/core/src/__tests__/writer-parser.test.ts +348 -0
  271. package/inkos/packages/core/src/__tests__/writer-prompts.test.ts +269 -0
  272. package/inkos/packages/core/src/__tests__/writer.test.ts +1360 -0
  273. package/inkos/packages/core/src/agent/agent-session.ts +737 -0
  274. package/inkos/packages/core/src/agent/agent-system-prompt.ts +199 -0
  275. package/inkos/packages/core/src/agent/agent-tools.ts +835 -0
  276. package/inkos/packages/core/src/agent/context-transform.ts +85 -0
  277. package/inkos/packages/core/src/agent/index.ts +14 -0
  278. package/inkos/packages/core/src/agents/ai-tells.ts +161 -0
  279. package/inkos/packages/core/src/agents/architect.ts +1291 -0
  280. package/inkos/packages/core/src/agents/base.ts +100 -0
  281. package/inkos/packages/core/src/agents/chapter-analyzer.ts +634 -0
  282. package/inkos/packages/core/src/agents/composer.ts +469 -0
  283. package/inkos/packages/core/src/agents/consolidator.ts +218 -0
  284. package/inkos/packages/core/src/agents/continuity.ts +824 -0
  285. package/inkos/packages/core/src/agents/detection-insights.ts +72 -0
  286. package/inkos/packages/core/src/agents/detector.ts +224 -0
  287. package/inkos/packages/core/src/agents/en-prompt-sections.ts +129 -0
  288. package/inkos/packages/core/src/agents/fanfic-canon-importer.ts +146 -0
  289. package/inkos/packages/core/src/agents/fanfic-dimensions.ts +87 -0
  290. package/inkos/packages/core/src/agents/fanfic-prompt-sections.ts +109 -0
  291. package/inkos/packages/core/src/agents/foundation-reviewer.ts +204 -0
  292. package/inkos/packages/core/src/agents/length-normalizer.ts +218 -0
  293. package/inkos/packages/core/src/agents/observer-prompts.ts +127 -0
  294. package/inkos/packages/core/src/agents/planner-context.ts +297 -0
  295. package/inkos/packages/core/src/agents/planner-prompts.ts +404 -0
  296. package/inkos/packages/core/src/agents/planner.ts +783 -0
  297. package/inkos/packages/core/src/agents/polisher.ts +153 -0
  298. package/inkos/packages/core/src/agents/post-write-validator.ts +873 -0
  299. package/inkos/packages/core/src/agents/radar-source.ts +123 -0
  300. package/inkos/packages/core/src/agents/radar.ts +120 -0
  301. package/inkos/packages/core/src/agents/reviser.ts +701 -0
  302. package/inkos/packages/core/src/agents/rules-reader.ts +155 -0
  303. package/inkos/packages/core/src/agents/sensitive-words.ts +142 -0
  304. package/inkos/packages/core/src/agents/settler-delta-parser.ts +53 -0
  305. package/inkos/packages/core/src/agents/settler-parser.ts +38 -0
  306. package/inkos/packages/core/src/agents/settler-prompts.ts +230 -0
  307. package/inkos/packages/core/src/agents/short-fiction.ts +429 -0
  308. package/inkos/packages/core/src/agents/state-validator.ts +322 -0
  309. package/inkos/packages/core/src/agents/style-analyzer.ts +93 -0
  310. package/inkos/packages/core/src/agents/writer-parser.ts +178 -0
  311. package/inkos/packages/core/src/agents/writer-prompts.ts +899 -0
  312. package/inkos/packages/core/src/agents/writer.ts +1450 -0
  313. package/inkos/packages/core/src/index.ts +392 -0
  314. package/inkos/packages/core/src/interaction/book-session-store.ts +226 -0
  315. package/inkos/packages/core/src/interaction/draft-directive-parser.ts +266 -0
  316. package/inkos/packages/core/src/interaction/edit-controller.ts +270 -0
  317. package/inkos/packages/core/src/interaction/events.ts +41 -0
  318. package/inkos/packages/core/src/interaction/export-artifact.ts +151 -0
  319. package/inkos/packages/core/src/interaction/intents.ts +63 -0
  320. package/inkos/packages/core/src/interaction/modes.ts +13 -0
  321. package/inkos/packages/core/src/interaction/nl-router.ts +258 -0
  322. package/inkos/packages/core/src/interaction/project-control.ts +150 -0
  323. package/inkos/packages/core/src/interaction/project-session-store.ts +81 -0
  324. package/inkos/packages/core/src/interaction/project-tools.ts +704 -0
  325. package/inkos/packages/core/src/interaction/request-router.ts +5 -0
  326. package/inkos/packages/core/src/interaction/runtime.ts +1167 -0
  327. package/inkos/packages/core/src/interaction/session-transcript-legacy.ts +113 -0
  328. package/inkos/packages/core/src/interaction/session-transcript-restore.ts +607 -0
  329. package/inkos/packages/core/src/interaction/session-transcript-schema.ts +76 -0
  330. package/inkos/packages/core/src/interaction/session-transcript.ts +189 -0
  331. package/inkos/packages/core/src/interaction/session.ts +226 -0
  332. package/inkos/packages/core/src/interaction/truth-authority.ts +45 -0
  333. package/inkos/packages/core/src/llm/config-migration.ts +58 -0
  334. package/inkos/packages/core/src/llm/cover-providers.ts +45 -0
  335. package/inkos/packages/core/src/llm/provider.ts +1331 -0
  336. package/inkos/packages/core/src/llm/providers/endpoints/ai360.ts +42 -0
  337. package/inkos/packages/core/src/llm/providers/endpoints/anthropic.ts +82 -0
  338. package/inkos/packages/core/src/llm/providers/endpoints/astronCodingPlan.ts +30 -0
  339. package/inkos/packages/core/src/llm/providers/endpoints/baichuan.ts +28 -0
  340. package/inkos/packages/core/src/llm/providers/endpoints/bailian.ts +65 -0
  341. package/inkos/packages/core/src/llm/providers/endpoints/bailianCodingPlan.ts +30 -0
  342. package/inkos/packages/core/src/llm/providers/endpoints/custom.ts +22 -0
  343. package/inkos/packages/core/src/llm/providers/endpoints/deepseek.ts +35 -0
  344. package/inkos/packages/core/src/llm/providers/endpoints/giteeai.ts +41 -0
  345. package/inkos/packages/core/src/llm/providers/endpoints/githubCopilot.ts +43 -0
  346. package/inkos/packages/core/src/llm/providers/endpoints/glmCodingPlan.ts +28 -0
  347. package/inkos/packages/core/src/llm/providers/endpoints/google.ts +51 -0
  348. package/inkos/packages/core/src/llm/providers/endpoints/hunyuan.ts +42 -0
  349. package/inkos/packages/core/src/llm/providers/endpoints/infiniai.ts +72 -0
  350. package/inkos/packages/core/src/llm/providers/endpoints/internlm.ts +28 -0
  351. package/inkos/packages/core/src/llm/providers/endpoints/kimiCode.ts +23 -0
  352. package/inkos/packages/core/src/llm/providers/endpoints/kimiCodingPlan.ts +24 -0
  353. package/inkos/packages/core/src/llm/providers/endpoints/kkaiapi.ts +56 -0
  354. package/inkos/packages/core/src/llm/providers/endpoints/longcat.ts +25 -0
  355. package/inkos/packages/core/src/llm/providers/endpoints/minimax.ts +39 -0
  356. package/inkos/packages/core/src/llm/providers/endpoints/minimaxCodingPlan.ts +28 -0
  357. package/inkos/packages/core/src/llm/providers/endpoints/mistral.ts +40 -0
  358. package/inkos/packages/core/src/llm/providers/endpoints/modelscope.ts +30 -0
  359. package/inkos/packages/core/src/llm/providers/endpoints/moonshot.ts +39 -0
  360. package/inkos/packages/core/src/llm/providers/endpoints/newapi.ts +21 -0
  361. package/inkos/packages/core/src/llm/providers/endpoints/ollama.ts +73 -0
  362. package/inkos/packages/core/src/llm/providers/endpoints/openai.ts +77 -0
  363. package/inkos/packages/core/src/llm/providers/endpoints/opencodeCodingPlan.ts +30 -0
  364. package/inkos/packages/core/src/llm/providers/endpoints/openrouter.ts +87 -0
  365. package/inkos/packages/core/src/llm/providers/endpoints/ppio.ts +86 -0
  366. package/inkos/packages/core/src/llm/providers/endpoints/qiniu.ts +32 -0
  367. package/inkos/packages/core/src/llm/providers/endpoints/sensenova.ts +45 -0
  368. package/inkos/packages/core/src/llm/providers/endpoints/siliconcloud.ts +126 -0
  369. package/inkos/packages/core/src/llm/providers/endpoints/spark.ts +33 -0
  370. package/inkos/packages/core/src/llm/providers/endpoints/stepfun.ts +35 -0
  371. package/inkos/packages/core/src/llm/providers/endpoints/tencentcloud.ts +25 -0
  372. package/inkos/packages/core/src/llm/providers/endpoints/volcengine.ts +52 -0
  373. package/inkos/packages/core/src/llm/providers/endpoints/volcengineCodingPlan.ts +42 -0
  374. package/inkos/packages/core/src/llm/providers/endpoints/wenxin.ts +106 -0
  375. package/inkos/packages/core/src/llm/providers/endpoints/xai.ts +34 -0
  376. package/inkos/packages/core/src/llm/providers/endpoints/xiaomimimo.ts +26 -0
  377. package/inkos/packages/core/src/llm/providers/endpoints/zeroone.ts +34 -0
  378. package/inkos/packages/core/src/llm/providers/endpoints/zhipu.ts +61 -0
  379. package/inkos/packages/core/src/llm/providers/index.ts +71 -0
  380. package/inkos/packages/core/src/llm/providers/lookup.ts +70 -0
  381. package/inkos/packages/core/src/llm/providers/probe.ts +35 -0
  382. package/inkos/packages/core/src/llm/providers/types.ts +89 -0
  383. package/inkos/packages/core/src/llm/providers/verify.ts +104 -0
  384. package/inkos/packages/core/src/llm/secrets.ts +77 -0
  385. package/inkos/packages/core/src/llm/service-presets.ts +215 -0
  386. package/inkos/packages/core/src/llm/service-resolver.ts +91 -0
  387. package/inkos/packages/core/src/models/book-rules.ts +126 -0
  388. package/inkos/packages/core/src/models/book.ts +70 -0
  389. package/inkos/packages/core/src/models/chapter.ts +42 -0
  390. package/inkos/packages/core/src/models/detection.ts +25 -0
  391. package/inkos/packages/core/src/models/genre-profile.ts +36 -0
  392. package/inkos/packages/core/src/models/input-governance.ts +99 -0
  393. package/inkos/packages/core/src/models/length-governance.ts +46 -0
  394. package/inkos/packages/core/src/models/project.ts +161 -0
  395. package/inkos/packages/core/src/models/runtime-state.ts +144 -0
  396. package/inkos/packages/core/src/models/state.ts +52 -0
  397. package/inkos/packages/core/src/models/style-profile.ts +15 -0
  398. package/inkos/packages/core/src/notify/dispatcher.ts +96 -0
  399. package/inkos/packages/core/src/notify/feishu.ts +34 -0
  400. package/inkos/packages/core/src/notify/telegram.ts +25 -0
  401. package/inkos/packages/core/src/notify/webhook.ts +58 -0
  402. package/inkos/packages/core/src/notify/wechat-work.ts +22 -0
  403. package/inkos/packages/core/src/pipeline/agent.ts +691 -0
  404. package/inkos/packages/core/src/pipeline/chapter-persistence.ts +79 -0
  405. package/inkos/packages/core/src/pipeline/chapter-review-cycle.ts +324 -0
  406. package/inkos/packages/core/src/pipeline/chapter-state-recovery.ts +236 -0
  407. package/inkos/packages/core/src/pipeline/chapter-truth-validation.ts +145 -0
  408. package/inkos/packages/core/src/pipeline/detection-runner.ts +164 -0
  409. package/inkos/packages/core/src/pipeline/persisted-governed-plan.ts +216 -0
  410. package/inkos/packages/core/src/pipeline/runner.ts +3438 -0
  411. package/inkos/packages/core/src/pipeline/scheduler.ts +411 -0
  412. package/inkos/packages/core/src/pipeline/short-fiction-runner.ts +801 -0
  413. package/inkos/packages/core/src/prompts/index.ts +1 -0
  414. package/inkos/packages/core/src/prompts/short-fiction.ts +273 -0
  415. package/inkos/packages/core/src/state/manager.ts +560 -0
  416. package/inkos/packages/core/src/state/memory-db.ts +359 -0
  417. package/inkos/packages/core/src/state/runtime-state-store.ts +164 -0
  418. package/inkos/packages/core/src/state/state-bootstrap.ts +657 -0
  419. package/inkos/packages/core/src/state/state-projections.ts +255 -0
  420. package/inkos/packages/core/src/state/state-reducer.ts +260 -0
  421. package/inkos/packages/core/src/state/state-validator.ts +117 -0
  422. package/inkos/packages/core/src/utils/analytics.ts +92 -0
  423. package/inkos/packages/core/src/utils/book-id.ts +31 -0
  424. package/inkos/packages/core/src/utils/cadence-policy.ts +46 -0
  425. package/inkos/packages/core/src/utils/chapter-cadence.ts +211 -0
  426. package/inkos/packages/core/src/utils/chapter-memo-parser.ts +157 -0
  427. package/inkos/packages/core/src/utils/chapter-splitter.ts +80 -0
  428. package/inkos/packages/core/src/utils/config-loader.ts +29 -0
  429. package/inkos/packages/core/src/utils/context-assembly.ts +98 -0
  430. package/inkos/packages/core/src/utils/context-filter.ts +190 -0
  431. package/inkos/packages/core/src/utils/effective-llm-config.ts +529 -0
  432. package/inkos/packages/core/src/utils/governed-context.ts +101 -0
  433. package/inkos/packages/core/src/utils/governed-working-set.ts +395 -0
  434. package/inkos/packages/core/src/utils/hook-arbiter.ts +332 -0
  435. package/inkos/packages/core/src/utils/hook-governance.ts +199 -0
  436. package/inkos/packages/core/src/utils/hook-health.ts +189 -0
  437. package/inkos/packages/core/src/utils/hook-ledger-validator.ts +277 -0
  438. package/inkos/packages/core/src/utils/hook-lifecycle.ts +224 -0
  439. package/inkos/packages/core/src/utils/hook-policy.ts +115 -0
  440. package/inkos/packages/core/src/utils/hook-promotion.ts +313 -0
  441. package/inkos/packages/core/src/utils/hook-stale-detection.ts +168 -0
  442. package/inkos/packages/core/src/utils/length-metrics.ts +123 -0
  443. package/inkos/packages/core/src/utils/llm-endpoint-auth.ts +40 -0
  444. package/inkos/packages/core/src/utils/llm-env.ts +74 -0
  445. package/inkos/packages/core/src/utils/logger.ts +123 -0
  446. package/inkos/packages/core/src/utils/long-span-fatigue.ts +545 -0
  447. package/inkos/packages/core/src/utils/memory-retrieval.ts +527 -0
  448. package/inkos/packages/core/src/utils/narrative-control.ts +177 -0
  449. package/inkos/packages/core/src/utils/outline-paths.ts +275 -0
  450. package/inkos/packages/core/src/utils/path-safety.ts +11 -0
  451. package/inkos/packages/core/src/utils/planning-materials.ts +185 -0
  452. package/inkos/packages/core/src/utils/pov-filter.ts +149 -0
  453. package/inkos/packages/core/src/utils/proxy-fetch.ts +44 -0
  454. package/inkos/packages/core/src/utils/runtime-writer.ts +41 -0
  455. package/inkos/packages/core/src/utils/spot-fix-patches.ts +189 -0
  456. package/inkos/packages/core/src/utils/story-markdown.ts +346 -0
  457. package/inkos/packages/core/src/utils/web-search.ts +82 -0
  458. package/inkos/packages/core/src/utils/writing-methodology.ts +164 -0
  459. package/inkos/packages/core/tsconfig.json +8 -0
  460. package/inkos/packages/core/vitest.config.ts +7 -0
  461. package/inkos/packages/studio/components.json +25 -0
  462. package/inkos/packages/studio/index.html +13 -0
  463. package/inkos/packages/studio/package.json +72 -0
  464. package/inkos/packages/studio/postcss.config.js +3 -0
  465. package/inkos/packages/studio/src/App.test.ts +25 -0
  466. package/inkos/packages/studio/src/App.tsx +280 -0
  467. package/inkos/packages/studio/src/api/__tests__/normalize-base-url.test.ts +40 -0
  468. package/inkos/packages/studio/src/api/book-create.test.ts +104 -0
  469. package/inkos/packages/studio/src/api/book-create.ts +94 -0
  470. package/inkos/packages/studio/src/api/errors.ts +17 -0
  471. package/inkos/packages/studio/src/api/index.ts +30 -0
  472. package/inkos/packages/studio/src/api/lib/run-store.ts +177 -0
  473. package/inkos/packages/studio/src/api/lib/sse.ts +50 -0
  474. package/inkos/packages/studio/src/api/phase5-hotfix.test.ts +335 -0
  475. package/inkos/packages/studio/src/api/safety.ts +6 -0
  476. package/inkos/packages/studio/src/api/server.test.ts +3162 -0
  477. package/inkos/packages/studio/src/api/server.ts +3666 -0
  478. package/inkos/packages/studio/src/api/v13-hotfix-round4.test.ts +226 -0
  479. package/inkos/packages/studio/src/app-state.test.ts +8 -0
  480. package/inkos/packages/studio/src/app-state.ts +1 -0
  481. package/inkos/packages/studio/src/components/ConfirmDialog.tsx +95 -0
  482. package/inkos/packages/studio/src/components/ServiceConfigSourceCard.tsx +139 -0
  483. package/inkos/packages/studio/src/components/ServiceQuickLinks.tsx +65 -0
  484. package/inkos/packages/studio/src/components/Sidebar.tsx +652 -0
  485. package/inkos/packages/studio/src/components/ai-elements/code-block.tsx +562 -0
  486. package/inkos/packages/studio/src/components/ai-elements/confirmation.tsx +174 -0
  487. package/inkos/packages/studio/src/components/ai-elements/message.tsx +360 -0
  488. package/inkos/packages/studio/src/components/ai-elements/prompt-input.tsx +1457 -0
  489. package/inkos/packages/studio/src/components/ai-elements/reasoning.tsx +226 -0
  490. package/inkos/packages/studio/src/components/ai-elements/shimmer.tsx +77 -0
  491. package/inkos/packages/studio/src/components/ai-elements/tool.tsx +173 -0
  492. package/inkos/packages/studio/src/components/chat/BookSidebar.tsx +291 -0
  493. package/inkos/packages/studio/src/components/chat/ChatMessage.tsx +39 -0
  494. package/inkos/packages/studio/src/components/chat/QuickActions.tsx +73 -0
  495. package/inkos/packages/studio/src/components/chat/ToolExecutionSteps.tsx +320 -0
  496. package/inkos/packages/studio/src/components/chat/__tests__/ToolExecutionSteps.test.ts +114 -0
  497. package/inkos/packages/studio/src/components/chat-utils.ts +56 -0
  498. package/inkos/packages/studio/src/components/chatbar-state.test.ts +69 -0
  499. package/inkos/packages/studio/src/components/sidebar/ChaptersSection.tsx +66 -0
  500. package/inkos/packages/studio/src/components/sidebar/CharacterSection.tsx +129 -0
  501. package/inkos/packages/studio/src/components/sidebar/FoundationSection.tsx +61 -0
  502. package/inkos/packages/studio/src/components/sidebar/ProgressSection.tsx +124 -0
  503. package/inkos/packages/studio/src/components/sidebar/SidebarCard.tsx +30 -0
  504. package/inkos/packages/studio/src/components/sidebar/SummarySection.tsx +89 -0
  505. package/inkos/packages/studio/src/components/ui/alert.tsx +76 -0
  506. package/inkos/packages/studio/src/components/ui/badge.tsx +52 -0
  507. package/inkos/packages/studio/src/components/ui/button-group.tsx +87 -0
  508. package/inkos/packages/studio/src/components/ui/button.tsx +58 -0
  509. package/inkos/packages/studio/src/components/ui/collapsible.tsx +19 -0
  510. package/inkos/packages/studio/src/components/ui/command.tsx +194 -0
  511. package/inkos/packages/studio/src/components/ui/dialog.tsx +158 -0
  512. package/inkos/packages/studio/src/components/ui/dropdown-menu.tsx +266 -0
  513. package/inkos/packages/studio/src/components/ui/hover-card.tsx +51 -0
  514. package/inkos/packages/studio/src/components/ui/input-group.tsx +158 -0
  515. package/inkos/packages/studio/src/components/ui/input.tsx +20 -0
  516. package/inkos/packages/studio/src/components/ui/select.tsx +199 -0
  517. package/inkos/packages/studio/src/components/ui/separator.tsx +23 -0
  518. package/inkos/packages/studio/src/components/ui/spinner.tsx +10 -0
  519. package/inkos/packages/studio/src/components/ui/textarea.tsx +18 -0
  520. package/inkos/packages/studio/src/components/ui/tooltip.tsx +66 -0
  521. package/inkos/packages/studio/src/constants/service-groups.ts +29 -0
  522. package/inkos/packages/studio/src/hooks/use-api.test.ts +93 -0
  523. package/inkos/packages/studio/src/hooks/use-api.ts +189 -0
  524. package/inkos/packages/studio/src/hooks/use-book-activity.test.ts +129 -0
  525. package/inkos/packages/studio/src/hooks/use-book-activity.ts +180 -0
  526. package/inkos/packages/studio/src/hooks/use-colors.ts +27 -0
  527. package/inkos/packages/studio/src/hooks/use-hash-route.test.ts +101 -0
  528. package/inkos/packages/studio/src/hooks/use-hash-route.ts +89 -0
  529. package/inkos/packages/studio/src/hooks/use-i18n.ts +289 -0
  530. package/inkos/packages/studio/src/hooks/use-session-events.ts +64 -0
  531. package/inkos/packages/studio/src/hooks/use-sse.test.ts +52 -0
  532. package/inkos/packages/studio/src/hooks/use-sse.ts +92 -0
  533. package/inkos/packages/studio/src/hooks/use-theme.test.ts +31 -0
  534. package/inkos/packages/studio/src/hooks/use-theme.ts +75 -0
  535. package/inkos/packages/studio/src/index.css +323 -0
  536. package/inkos/packages/studio/src/lib/error-copy.test.ts +34 -0
  537. package/inkos/packages/studio/src/lib/error-copy.ts +37 -0
  538. package/inkos/packages/studio/src/lib/utils.ts +6 -0
  539. package/inkos/packages/studio/src/main.tsx +10 -0
  540. package/inkos/packages/studio/src/pages/Analytics.tsx +80 -0
  541. package/inkos/packages/studio/src/pages/BookCreate.tsx +895 -0
  542. package/inkos/packages/studio/src/pages/BookDetail.tsx +652 -0
  543. package/inkos/packages/studio/src/pages/ChapterReader.tsx +266 -0
  544. package/inkos/packages/studio/src/pages/ChatPage.tsx +521 -0
  545. package/inkos/packages/studio/src/pages/DaemonControl.tsx +116 -0
  546. package/inkos/packages/studio/src/pages/Dashboard.tsx +379 -0
  547. package/inkos/packages/studio/src/pages/DoctorView.tsx +82 -0
  548. package/inkos/packages/studio/src/pages/GenreManager.tsx +464 -0
  549. package/inkos/packages/studio/src/pages/ImportManager.tsx +216 -0
  550. package/inkos/packages/studio/src/pages/LanguageSelector.tsx +74 -0
  551. package/inkos/packages/studio/src/pages/LogViewer.tsx +82 -0
  552. package/inkos/packages/studio/src/pages/RadarView.tsx +157 -0
  553. package/inkos/packages/studio/src/pages/ServiceDetailPage.tsx +393 -0
  554. package/inkos/packages/studio/src/pages/ServiceListPage.tsx +463 -0
  555. package/inkos/packages/studio/src/pages/StyleManager.tsx +225 -0
  556. package/inkos/packages/studio/src/pages/TruthFiles.tsx +194 -0
  557. package/inkos/packages/studio/src/pages/chat-page-state.test.ts +206 -0
  558. package/inkos/packages/studio/src/pages/chat-page-state.ts +112 -0
  559. package/inkos/packages/studio/src/pages/page-state.test.ts +258 -0
  560. package/inkos/packages/studio/src/pages/service-detail-state.test.ts +294 -0
  561. package/inkos/packages/studio/src/pages/service-detail-state.ts +234 -0
  562. package/inkos/packages/studio/src/pages/style-manager-state.test.ts +22 -0
  563. package/inkos/packages/studio/src/pages/truth-files-state.test.ts +61 -0
  564. package/inkos/packages/studio/src/shared/contracts.ts +143 -0
  565. package/inkos/packages/studio/src/store/chat/__tests__/message-parts.test.ts +172 -0
  566. package/inkos/packages/studio/src/store/chat/index.ts +3 -0
  567. package/inkos/packages/studio/src/store/chat/initialState.ts +8 -0
  568. package/inkos/packages/studio/src/store/chat/message-policy.test.ts +16 -0
  569. package/inkos/packages/studio/src/store/chat/message-policy.ts +5 -0
  570. package/inkos/packages/studio/src/store/chat/parts-builder.ts +187 -0
  571. package/inkos/packages/studio/src/store/chat/selectors.ts +13 -0
  572. package/inkos/packages/studio/src/store/chat/slices/create/action.ts +10 -0
  573. package/inkos/packages/studio/src/store/chat/slices/create/initialState.ts +9 -0
  574. package/inkos/packages/studio/src/store/chat/slices/message/action.ts +417 -0
  575. package/inkos/packages/studio/src/store/chat/slices/message/initialState.ts +10 -0
  576. package/inkos/packages/studio/src/store/chat/slices/message/runtime.test.ts +21 -0
  577. package/inkos/packages/studio/src/store/chat/slices/message/runtime.ts +233 -0
  578. package/inkos/packages/studio/src/store/chat/slices/message/stream-events.ts +272 -0
  579. package/inkos/packages/studio/src/store/chat/store.ts +11 -0
  580. package/inkos/packages/studio/src/store/chat/types.ts +169 -0
  581. package/inkos/packages/studio/src/store/service/index.ts +2 -0
  582. package/inkos/packages/studio/src/store/service/store.ts +123 -0
  583. package/inkos/packages/studio/src/store/service/types.ts +50 -0
  584. package/inkos/packages/studio/tsconfig.json +24 -0
  585. package/inkos/packages/studio/tsconfig.server.json +11 -0
  586. package/inkos/packages/studio/vite.config.ts +34 -0
  587. package/inkos/packages/studio/vitest.config.ts +14 -0
  588. package/inkos/pnpm-lock.yaml +9569 -0
  589. package/inkos/pnpm-workspace.yaml +2 -0
  590. package/inkos/scripts/prepare-package-for-publish.mjs +135 -0
  591. package/inkos/scripts/restore-package-json.mjs +31 -0
  592. package/inkos/scripts/set-package-versions.mjs +74 -0
  593. package/inkos/scripts/verify-no-workspace-protocol.mjs +140 -0
  594. package/inkos/skills/SKILL.md +654 -0
  595. package/inkos/tsconfig.json +19 -0
  596. package/package.json +4 -3
  597. /package/.next/static/{F2hMZMf1IyCVAWpkbtRz7 → -3vIrBZXdQ0rp7Wa3Kz40}/_buildManifest.js +0 -0
  598. /package/.next/static/{F2hMZMf1IyCVAWpkbtRz7 → -3vIrBZXdQ0rp7Wa3Kz40}/_ssgManifest.js +0 -0
@@ -0,0 +1,654 @@
1
+ ---
2
+ name: inkos
3
+ description: Autonomous novel writing CLI agent with web workbench (InkOS Studio) - use for creative fiction writing, standalone short-fiction packages, cover generation, novel generation, style imitation, chapter continuation/import, EPUB export, AIGC detection, and fan fiction. Native English support with 10 built-in English genre profiles (LitRPG, Progression Fantasy, Isekai, Cultivation, System Apocalypse, Dungeon Core, Romantasy, Sci-Fi, Tower Climber, Cozy Fantasy). Also supports Chinese web novel genres (xuanhuan, xianxia, urban, horror, other). Multi-agent pipeline, two-phase writer (creative + settlement), stronger long-form chapter craft rules, hook-ledger payoff checks, 33-dimension auditing, token usage analytics, creative brief input, structured logging (JSON Lines), multi-model routing, custom OpenAI-compatible provider support, and InkOS Studio web UI for visual book management, short-fiction runs, cover generation, chapter review, real-time writing progress, market radar, and analytics.
4
+ version: 2.3.4
5
+ metadata: { "openclaw": { "emoji": "📖", "requires": { "bins": ["inkos", "node"], "env": ["OPENAI_API_KEY"] }, "primaryEnv": "OPENAI_API_KEY", "homepage": "https://github.com/Narcooo/inkos", "install": [{ "id": "npm", "kind": "node", "package": "@actalk/inkos", "label": "Install InkOS (npm)" }] } }
6
+ ---
7
+
8
+ # InkOS - Autonomous Novel Writing Agent
9
+
10
+ InkOS is a CLI tool for autonomous fiction writing powered by LLM agents. It orchestrates a multi-agent pipeline (Radar → Planner → Composer → Architect → Writer → Observer → Reflector → Normalizer → Auditor → Reviser) to generate, audit, and revise novel content with zero human intervention per chapter.
11
+
12
+ The pipeline operates in three phases:
13
+ - **Phase 1 (Creative Writing, temp 0.7)**: Planner generates chapter intent with hook agenda, Composer selects relevant context, Writer produces prose with length governance, first-screen hooks, semantic density, hook-ledger payoff, and mobile paragraph rhythm guidance.
14
+ - **Phase 2 (State Settlement, temp 0.3)**: Observer over-extracts 9 categories of facts, Reflector outputs a JSON delta (not full markdown), code-layer applies Zod schema validation and immutable state update. Hook operations use upsert/mention/resolve/defer semantics.
15
+ - **Phase 3 (Quality Loop)**: Normalizer adjusts chapter length, Auditor runs 33-dimension check including hook health analysis, Reviser auto-fixes critical issues. Self-correction loop runs until all critical issues clear.
16
+
17
+ Truth files are persisted as schema-validated JSON (`story/state/*.json`) with markdown projections for human readability. SQLite temporal memory database (`story/memory.db`) enables relevance-based retrieval on Node 22+.
18
+
19
+ ## When to Use InkOS
20
+
21
+ - **English novel writing**: Native English support with 10 genre profiles (LitRPG, Progression Fantasy, Isekai, etc.). Set `--lang en`
22
+ - **Chinese web novel writing**: 5 built-in Chinese genres (xuanhuan, xianxia, urban, horror, other)
23
+ - **Fan fiction**: Create fanfic from source material with 4 modes (canon, au, ooc, cp)
24
+ - **Batch chapter generation**: Generate multiple chapters with consistent quality
25
+ - **Import & continue**: Import existing chapters from a text file, reverse-engineer truth files, and continue writing
26
+ - **Style imitation**: Analyze and adopt writing styles from reference texts
27
+ - **Spinoff writing**: Write prequels/sequels/spinoffs while maintaining parent canon
28
+ - **Standalone short fiction**: Generate a complete short-fiction package with outline, draft, review artifacts, synopsis, selling points, and optional cover image
29
+ - **Cover generation**: Generate or regenerate only a cover prompt and cover image from a title, synopsis, or visual direction without rerunning story writing
30
+ - **Quality auditing**: Detect AI-generated content and perform 33-dimension quality checks
31
+ - **Genre exploration**: Explore trends and create custom genre rules
32
+ - **Analytics**: Track word count, audit pass rate, and issue distribution per book
33
+
34
+ ## Initial Setup
35
+
36
+ ### First Time Setup
37
+ ```bash
38
+ # Initialize a project directory (creates config structure)
39
+ inkos init my-writing-project
40
+
41
+ # Configure your LLM provider (OpenAI, Anthropic, or any OpenAI-compatible API)
42
+ # Prefer --api-key-env so the key never appears in shell history:
43
+ export OPENAI_API_KEY=sk-xxx
44
+ inkos config set-global --provider openai --base-url https://api.openai.com/v1 --api-key-env OPENAI_API_KEY --model gpt-4o
45
+ # For compatible/proxy endpoints, use --provider custom and point ONLY to trusted endpoints:
46
+ # inkos config set-global --provider custom --base-url https://your-trusted-proxy.com/v1 --api-key-env OPENAI_API_KEY --model gpt-4o
47
+ ```
48
+
49
+ ### Multi-Model Routing (Optional)
50
+ ```bash
51
+ # Assign different models to different agents — balance quality and cost
52
+ inkos config set-model writer claude-sonnet-4-20250514 --provider anthropic --base-url https://api.anthropic.com --api-key-env ANTHROPIC_API_KEY
53
+ inkos config set-model auditor gpt-4o --provider openai
54
+ inkos config show-models
55
+ ```
56
+ Agents without explicit overrides fall back to the global model.
57
+
58
+ ### Provider setup tip
59
+
60
+ When the user needs an aggregator provider, point them to Studio's service settings. InkOS includes kkaiapi and OpenRouter as optional aggregator choices. For kkaiapi, use:
61
+ - Chinese website: https://kkaiapi.com/
62
+ - English website: https://en.kkaiapi.com/
63
+ - Chinese API docs: https://kkaiapi.com/docs
64
+ - English API docs: https://en.kkaiapi.com/docs
65
+ - Chinese models/pricing: https://kkaiapi.com/models
66
+ - English models/pricing: https://en.kkaiapi.com/models
67
+
68
+ ### View System Status
69
+ ```bash
70
+ # Check installation and configuration
71
+ inkos doctor
72
+
73
+ # View current config
74
+ inkos status
75
+ ```
76
+
77
+ ## Common Workflows
78
+
79
+ ### Workflow 1: Create a New Novel
80
+
81
+ 1. **Initialize and create book**:
82
+ ```bash
83
+ inkos book create --title "My Novel Title" --genre xuanhuan --chapter-words 3000
84
+ # Or with a creative brief (your worldbuilding doc / ideas):
85
+ inkos book create --title "My Novel Title" --genre xuanhuan --chapter-words 3000 --brief my-ideas.md
86
+ ```
87
+ - Genres: `xuanhuan` (cultivation), `xianxia` (immortal), `urban` (city), `horror`, `other`
88
+ - Returns a `book-id` for all subsequent operations
89
+
90
+ 2. **Generate initial chapters** (e.g., 5 chapters):
91
+ ```bash
92
+ inkos write next book-id --count 5 --words 3000 --context "young protagonist discovering powers"
93
+ ```
94
+ - The `write next` command runs the full pipeline: draft → audit → revise
95
+ - `--context` provides guidance to the Architect and Writer agents
96
+ - Returns JSON with chapter details and quality metrics
97
+
98
+ 3. **Review and approve chapters**:
99
+ ```bash
100
+ inkos review list book-id
101
+ inkos review approve-all book-id
102
+ ```
103
+
104
+ 4. **Export the book** (supports txt, md, epub):
105
+ ```bash
106
+ inkos export book-id
107
+ inkos export book-id --format epub
108
+ ```
109
+
110
+ ### Workflow 2: Continue Writing Existing Novel
111
+
112
+ 1. **List your books**:
113
+ ```bash
114
+ inkos book list
115
+ ```
116
+
117
+ 2. **Continue from last chapter**:
118
+ ```bash
119
+ inkos write next book-id --count 3 --words 2500 --context "protagonist faces critical choice"
120
+ ```
121
+ - InkOS maintains 7 truth files (world state, character matrix, emotional arcs, etc.) for consistency
122
+ - If only one book exists, omit `book-id` for auto-detection
123
+
124
+ 3. **Review and approve**:
125
+ ```bash
126
+ inkos review approve-all
127
+ ```
128
+
129
+ ### Workflow 2.5: Shared Natural-Language Control (Recommended For OpenClaw)
130
+
131
+ When InkOS is being driven by OpenClaw or another external agent, prefer the shared interaction executor instead of stitching together many ad-hoc CLI calls:
132
+
133
+ ```bash
134
+ inkos interact --json --message "continue the current book, but keep the pacing tighter"
135
+ inkos interact --json --message "rewrite chapter 3"
136
+ inkos interact --json --book my-book --message "switch to auto mode"
137
+ ```
138
+
139
+ This returns a structured payload containing:
140
+ - the routed request
141
+ - assistant response text
142
+ - updated interaction session
143
+ - execution state
144
+ - pending decision
145
+ - recent interaction events
146
+
147
+ Use this as the primary OpenClaw entry because it shares the same control layer as the project TUI.
148
+
149
+ ### Workflow 2.6: Steering Chapter Focus Before Writing
150
+
151
+ Use this when the user says things like "pull focus back to the mentor conflict", "pause the merchant guild subplot", or "change what the next chapter should prioritize".
152
+
153
+ 1. **Update the book-level control docs when needed**:
154
+ - Use `update_author_intent` to change the long-horizon identity of the book
155
+ - Use `update_current_focus` to change the next 1-3 chapters' focus
156
+
157
+ 2. **Compile the next chapter intent**:
158
+ ```text
159
+ plan_chapter(bookId, guidance?)
160
+ ```
161
+ - Generates `story/runtime/chapter-XXXX.intent.md`
162
+ - Use this to verify what the system thinks the next chapter should do
163
+
164
+ 3. **Compose the actual runtime input package**:
165
+ ```text
166
+ compose_chapter(bookId, guidance?)
167
+ ```
168
+ - Generates `story/runtime/chapter-XXXX.context.json`
169
+ - Generates `story/runtime/chapter-XXXX.rule-stack.yaml`
170
+ - Generates `story/runtime/chapter-XXXX.trace.json`
171
+
172
+ 4. **Only then write**:
173
+ - `write_draft` if the user wants intermediate review
174
+ - `write_full_pipeline` if they want the usual write → audit → revise flow
175
+
176
+ Recommended orchestration:
177
+ - user asks to redirect focus
178
+ - `update_current_focus`
179
+ - `plan_chapter`
180
+ - `compose_chapter`
181
+ - inspect the resulting intent/paths
182
+ - `write_draft` or `write_full_pipeline`
183
+
184
+ ### Workflow 3: Import Existing Chapters & Continue
185
+
186
+ Use this when you have an existing novel (or partial novel) and want InkOS to pick up where it left off.
187
+
188
+ 1. **Import from a single text file** (auto-splits by chapter headings):
189
+ ```bash
190
+ inkos import chapters book-id --from novel.txt
191
+ ```
192
+ - Automatically splits by `第X章` pattern
193
+ - Custom split pattern: `--split "Chapter\\s+\\d+"`
194
+
195
+ 2. **Import from a directory** of separate chapter files:
196
+ ```bash
197
+ inkos import chapters book-id --from ./chapters/
198
+ ```
199
+ - Reads `.md` and `.txt` files in sorted order
200
+
201
+ 3. **Resume interrupted import**:
202
+ ```bash
203
+ inkos import chapters book-id --from novel.txt --resume-from 15
204
+ ```
205
+
206
+ 4. **Continue writing** from the imported chapters:
207
+ ```bash
208
+ inkos write next book-id --count 3
209
+ ```
210
+ - InkOS reverse-engineers all 7 truth files from the imported chapters
211
+ - Generates a style guide from the existing text
212
+ - New chapters maintain consistency with imported content
213
+
214
+ ### Workflow 4: Style Imitation
215
+
216
+ 1. **Analyze reference text**:
217
+ ```bash
218
+ inkos style analyze reference_text.txt
219
+ ```
220
+ - Examines vocabulary, sentence structure, tone, pacing
221
+
222
+ 2. **Import style to your book**:
223
+ ```bash
224
+ inkos style import reference_text.txt book-id --name "Author Name"
225
+ ```
226
+ - All future chapters adopt this style profile
227
+ - Style rules become part of the Reviser's audit criteria
228
+
229
+ ### Workflow 5: Spinoff/Prequel Writing
230
+
231
+ 1. **Import parent canon**:
232
+ ```bash
233
+ inkos import canon spinoff-book-id --from parent-book-id
234
+ ```
235
+ - Creates links to parent book's world state, characters, and events
236
+ - Reviser enforces canon consistency
237
+
238
+ 2. **Continue spinoff**:
239
+ ```bash
240
+ inkos write next spinoff-book-id --count 3 --context "alternate timeline after Chapter 20"
241
+ ```
242
+
243
+ ### Workflow 6: Fine-Grained Control (Draft → Audit → Revise)
244
+
245
+ If you need separate control over each pipeline stage:
246
+
247
+ 1. **Generate draft only**:
248
+ ```bash
249
+ inkos draft book-id --words 3000 --context "protagonist escapes" --json
250
+ ```
251
+
252
+ 2. **Audit the chapter** (33-dimension quality check):
253
+ ```bash
254
+ inkos audit book-id chapter-1 --json
255
+ ```
256
+ - Returns metrics across 33 dimensions including pacing, dialogue, world-building, outline adherence, and more
257
+
258
+ 3. **Revise with specific mode**:
259
+ ```bash
260
+ inkos revise book-id chapter-1 --mode polish --json
261
+ ```
262
+ - Modes: `polish` (minor), `spot-fix` (targeted), `rewrite` (major), `rework` (structure), `anti-detect` (reduce AI traces)
263
+
264
+ ### Workflow 7: Monitor Platform Trends
265
+
266
+ ```bash
267
+ inkos radar scan
268
+ ```
269
+ - Analyzes trending genres, tropes, and reader preferences
270
+ - Informs Architect recommendations for new books
271
+
272
+ ### Workflow 8: Detect AI-Generated Content
273
+
274
+ ```bash
275
+ # Detect AIGC in a specific chapter
276
+ inkos detect book-id
277
+
278
+ # Deep scan all chapters
279
+ inkos detect book-id --all
280
+ ```
281
+ - Uses 11 deterministic rules (zero LLM cost) + optional LLM validation
282
+ - Returns detection confidence and problematic passages
283
+
284
+ ### Workflow 9: View Analytics
285
+
286
+ ```bash
287
+ inkos analytics book-id --json
288
+ # Shorthand alias
289
+ inkos stats book-id --json
290
+ ```
291
+ - Total chapters, word count, average words per chapter
292
+ - Audit pass rate and top issue categories
293
+ - Chapters with most issues, status distribution
294
+ - **Token usage stats**: total prompt/completion tokens, avg tokens per chapter, recent trend
295
+
296
+ ### Workflow 10: Write an English Novel
297
+
298
+ ```bash
299
+ # Create an English LitRPG novel (language auto-detected from genre)
300
+ inkos book create --title "The Last Delver" --genre litrpg --chapter-words 3000
301
+
302
+ # Or set language explicitly
303
+ inkos book create --title "My Novel" --genre other --lang en
304
+
305
+ # Set English as default for all projects
306
+ inkos config set-global --lang en
307
+ ```
308
+ - 10 English genres: litrpg, progression, isekai, cultivation, system-apocalypse, dungeon-core, romantasy, sci-fi, tower-climber, cozy
309
+ - Each genre has dedicated pacing rules, fatigue word lists (e.g., "delve", "tapestry", "testament"), and audit dimensions
310
+ - Use `inkos genre list` to see all available genres
311
+
312
+ ### Workflow 11: Fan Fiction
313
+
314
+ ```bash
315
+ # Create a fanfic from source material
316
+ inkos fanfic init --title "My Fanfic" --from source-novel.txt --mode canon
317
+
318
+ # Modes: canon (faithful), au (alternate universe), ooc (out of character), cp (ship-focused)
319
+ inkos fanfic init --title "What If" --from source.txt --mode au --genre other
320
+ ```
321
+ - Imports and analyzes source material automatically
322
+ - Fanfic-specific audit dimensions and information boundary controls
323
+ - Ensures new content stays consistent with source canon (or deliberately diverges in au/ooc modes)
324
+
325
+ ### Workflow 12: Rename Characters or Entities Across Entire Book
326
+
327
+ ```bash
328
+ # Via interact
329
+ inkos interact --json --message "把林烬改成张三"
330
+ inkos interact --json --message "rename Lin Jin to Zhang San"
331
+
332
+ # Via slash command
333
+ inkos interact --json --message "/rename 林烬 => 张三"
334
+ ```
335
+ - Scans all chapters + all truth files (story_bible, current_state, character_matrix, etc.)
336
+ - Replaces every occurrence in one pass
337
+ - Returns count of files touched
338
+
339
+ ### Workflow 13: Patch Specific Text in a Chapter
340
+
341
+ ```bash
342
+ inkos interact --json --message "/replace 5 旧文本 => 新文本"
343
+ ```
344
+ - Precisely replaces text in chapter 5 only
345
+ - Marks chapter for review after patching
346
+
347
+ ### Workflow 14: Interactive TUI Dashboard
348
+
349
+ ```bash
350
+ inkos
351
+ ```
352
+ - Launches a full-screen Ink + React dashboard with conversational creation
353
+ - Slash command autocomplete (Tab), input history (arrow keys)
354
+ - Themed activity animations per operation (writing, auditing, revising, planning)
355
+ - Bilingual i18n (Chinese / English)
356
+ - Shares the same interaction kernel as `inkos interact` and Studio
357
+
358
+ ### Workflow 15: Standalone Short Fiction Package
359
+
360
+ Use this when the user wants a complete short story or short-fiction deliverable that is separate from the active long-form book.
361
+
362
+ ```bash
363
+ inkos short run \
364
+ --direction "modern short fiction marriage reversal evidence-driven heroine" \
365
+ --chapters 12 \
366
+ --chars 1000
367
+ ```
368
+
369
+ Outputs are written under `shorts/<story-name>/final/`:
370
+ - `full.md` — complete short-fiction manuscript
371
+ - `sales-package.md` — synopsis and selling points
372
+ - `cover-prompt.md` — cover prompt
373
+ - `cover.png` — cover image when a cover provider is configured
374
+
375
+ For OpenClaw/Studio/agent orchestration, call the `short_fiction_run` tool when the user asks for a new complete short-fiction package. Do not use it for the next chapter of an existing long-form book.
376
+
377
+ ### Workflow 16: Standalone Cover Tool
378
+
379
+ Use this when the user only wants a cover for an existing title, synopsis, or visual direction. Do not rerun the short-fiction pipeline.
380
+
381
+ In Studio or agent mode, ask naturally:
382
+
383
+ ```text
384
+ Generate a short-fiction cover for "The Divorce Papers He Regretted", modern city, high-drama reversal.
385
+ ```
386
+
387
+ For tool-using agents, call `generate_cover` with:
388
+ - `title` — required
389
+ - `intro` or `sellingPoints` — optional story context
390
+ - `coverPrompt` — optional visual direction
391
+ - `outputDir` — optional; defaults to `covers/<title>/`
392
+
393
+ The standalone cover tool writes:
394
+ - `covers/<title>/cover-prompt.md`
395
+ - `covers/<title>/cover.png`
396
+
397
+ If cover image generation fails, report the provider/configuration error plainly. Do not rewrite the story, do not rerun `short_fiction_run`, and do not suggest unrelated external tools unless the user asks.
398
+
399
+ ## InkOS Studio (Web Workbench)
400
+
401
+ `inkos studio` launches a local web UI (default port 4567) that provides a visual interface for all InkOS operations:
402
+
403
+ - **Book management** — create, delete, export (TXT/MD/EPUB), configure per-book settings
404
+ - **Short fiction & cover tools** — generate independent short-fiction packages, synopsis/selling points, cover prompts, and standalone covers
405
+ - **Chapter review & editing** — approve/reject drafts, edit content inline, multi-mode revision (polish/spot-fix/rewrite/anti-detect)
406
+ - **Real-time writing progress** — SSE-based live updates during chapter generation
407
+ - **Market radar** — AI-powered trend analysis with platform/genre recommendations
408
+ - **Analytics** — word count, audit pass rate, chapter ranking, token usage
409
+ - **AI detection** — scan chapters for AI-generated content
410
+ - **Style analysis** — analyze reference texts and import writing styles
411
+ - **Genre management** — create/customize genre profiles with fatigue words, pacing rules, audit dimensions
412
+ - **Daemon control** — start/stop background writing with event log
413
+ - **Truth file editor** — view and edit canonical knowledge base per book
414
+ - **Config editor** — LLM provider, model routing, notifications
415
+
416
+ ```bash
417
+ inkos studio # Start on default port 4567
418
+ inkos studio -p 8080 # Start on custom port
419
+ ```
420
+
421
+ The right-side **AI Assistant panel** in Studio shares the same interaction kernel as TUI and `inkos interact`. You can type natural language commands (rename entities, write chapters, audit, export) directly in the assistant panel.
422
+
423
+ ## Advanced: Natural Language Agent Mode
424
+
425
+ For flexible, conversational requests:
426
+
427
+ ```bash
428
+ inkos agent "写一部都市题材的小说,主角是一个年轻律师,第一章三千字"
429
+ ```
430
+ - Agent interprets natural language and invokes appropriate commands
431
+ - Useful for complex multi-step requests
432
+
433
+ ## Input Governance Tools
434
+
435
+ These tools are the preferred control surface for chapter steering:
436
+
437
+ - `plan_chapter(bookId, guidance?)`
438
+ - Generates chapter intent for the next chapter
439
+ - Use before writing when the user wants to change focus
440
+
441
+ - `compose_chapter(bookId, guidance?)`
442
+ - Generates runtime context/rule-stack/trace artifacts
443
+ - Use after planning and before writing
444
+
445
+ - `update_author_intent(bookId, content)`
446
+ - Rewrites `story/author_intent.md`
447
+ - Use for long-horizon changes to the book's identity
448
+
449
+ - `update_current_focus(bookId, content)`
450
+ - Rewrites `story/current_focus.md`
451
+ - Use for local steering over the next 1-3 chapters
452
+
453
+ ## Short Fiction and Cover Agent Tools
454
+
455
+ These are the preferred tools when InkOS is driven by OpenClaw, Studio chat, or `inkos agent`:
456
+
457
+ - `short_fiction_run`
458
+ - Creates an independent short-fiction package from a direction
459
+ - Runs outline → outline review/revision → full draft → draft review/revision → synopsis/selling points/cover prompt → optional cover image
460
+ - Writes to `shorts/<story-name>/`
461
+ - Use only when the user asks for a separate complete short story / short-fiction deliverable
462
+
463
+ - `generate_cover`
464
+ - Generates only a cover prompt and cover image
465
+ - Writes to `covers/<title>/` by default
466
+ - Use when the user asks to create or regenerate a cover for an existing title, synopsis, or completed short
467
+ - Also use when the user changes the cover prompt through chat; pass the revised visual direction as `coverPrompt` and reuse the existing `outputDir` when available
468
+ - Do not rerun story generation unless the user explicitly asks for a new story
469
+
470
+ `write_truth_file` remains available for broad file edits, but prefer the dedicated control tools above for input-governance changes.
471
+
472
+ ## Key Concepts
473
+
474
+ ### Book ID Auto-Detection
475
+ If your project contains only one book, most commands accept `book-id` as optional. You can omit it for brevity:
476
+ ```bash
477
+ # Explicit
478
+ inkos write next book-123 --count 1
479
+
480
+ # Auto-detected (if only one book exists)
481
+ inkos write next --count 1
482
+ ```
483
+
484
+ ### --json Flag
485
+ All content-generating commands support `--json` for structured output. Essential for programmatic use:
486
+ ```bash
487
+ inkos draft book-id --words 3000 --context "guidance" --json
488
+ ```
489
+
490
+ ### Truth Files (Long-Term Memory)
491
+ InkOS maintains 7 files per book for coherence:
492
+ - **World State**: Maps, locations, technology levels, magic systems
493
+ - **Character Matrix**: Names, relationships, arcs, motivations
494
+ - **Resource Ledger**: In-world items, money, power levels
495
+ - **Chapter Summaries**: Events, progression, foreshadowing
496
+ - **Subplot Board**: Active and dormant subplots, hooks
497
+ - **Emotional Arcs**: Character emotional progression
498
+ - **Pending Hooks**: Unresolved cliffhangers and promises to reader
499
+
500
+ All agents reference these to maintain long-term consistency. Since 0.6.0, truth files are backed by schema-validated JSON in `story/state/` with automatic bootstrap from markdown for legacy books. During `import chapters`, these files are reverse-engineered from existing content via the ChapterAnalyzerAgent.
501
+
502
+ ### Multi-Phase Writer Architecture
503
+ The Writer operates across multiple phases with specialized agents:
504
+ - **Planner**: Generates chapter intent with structured hook agenda (mustAdvance, eligibleResolve, staleDebt) based on memory retrieval.
505
+ - **Composer**: Selects relevant context from truth files by relevance scoring, compiles rule stack and runtime artifacts.
506
+ - **Phase 1 (Creative, temp 0.7)**: Generates prose with length governance, English variance brief (anti-repetition), and dialogue-driven guidance.
507
+ - **Phase 2a (Observer, temp 0.5)**: Over-extracts 9 categories of facts from the chapter text.
508
+ - **Phase 2b (Reflector, temp 0.3)**: Outputs a JSON delta with hookOps (upsert/mention/resolve/defer), currentStatePatch, and chapterSummary. Code-layer validates via Zod schema and applies immutably.
509
+ - **Normalizer**: Single-pass compress/expand to bring chapter length into the target band. Safety net rejects destructive normalization (>75% content loss).
510
+ - **Auditor**: 33-dimension check including hook health analysis (stale debt, burst detection, no-advance warnings).
511
+ - **Reviser**: Auto-fixes critical issues, self-correction loop until clean.
512
+
513
+ Truth files use structured JSON (`story/state/*.json`) as the authoritative source, with markdown projections for human readability. Hook admission control prevents duplicate/family hooks from inflating the hook table.
514
+
515
+ ### Context Guidance
516
+ The `--context` parameter provides directional hints to the Writer and Architect:
517
+ ```bash
518
+ inkos write next book-id --count 2 --context "protagonist discovers betrayal, must decide whether to trust mentor"
519
+ ```
520
+ - Context is optional but highly recommended for narrative coherence
521
+ - Supports both English and Chinese
522
+
523
+ ## Genre Management
524
+
525
+ ### View Built-In Genres
526
+ ```bash
527
+ inkos genre list
528
+ inkos genre show xuanhuan
529
+ ```
530
+
531
+ ### Create Custom Genre
532
+ ```bash
533
+ inkos genre create my-genre --name "My Genre"
534
+ # Options: --numerical, --power, --era
535
+ inkos genre create dark-xuanhuan --name "Dark Xuanhuan" --numerical --power
536
+ ```
537
+
538
+ ### Copy Built-in Genre for Customization
539
+ ```bash
540
+ inkos genre copy xuanhuan
541
+ # Copies to project genres/ directory for editing
542
+ ```
543
+
544
+ ## Command Reference Summary
545
+
546
+ | Command | Purpose | Notes |
547
+ |---------|---------|-------|
548
+ | `inkos init [name]` | Initialize project | One-time setup |
549
+ | `inkos book create` | Create new book | Returns book-id. `--brief <file>`, `--lang en/zh`, `--genre litrpg/progression/...` |
550
+ | `inkos book list` | List all books | Shows IDs, statuses |
551
+ | `inkos write next` | Full pipeline (draft→audit→revise) | Primary workflow command |
552
+ | `inkos draft` | Generate draft only | No auditing/revision |
553
+ | `inkos audit` | 33-dimension quality check | Standalone evaluation |
554
+ | `inkos revise` | Revise chapter | Modes: polish/spot-fix/rewrite/rework/anti-detect |
555
+ | `inkos agent` | Natural language interface | Flexible requests |
556
+ | `inkos style analyze` | Analyze reference text | Extracts style profile |
557
+ | `inkos style import` | Apply style to book | Makes style permanent |
558
+ | `inkos import canon` | Link spinoff to parent | For prequels/sequels |
559
+ | `inkos import chapters` | Import existing chapters | Reverse-engineers truth files for continuation |
560
+ | `inkos detect` | AIGC detection | Flags AI-generated passages |
561
+ | `inkos export` | Export finished book | Formats: txt, md, epub |
562
+ | `inkos analytics` / `inkos stats` | View book statistics | Word count, audit rates, token usage |
563
+ | `inkos radar scan` | Platform trend analysis | Informs new book ideas |
564
+ | `inkos short run` | Generate standalone short fiction | Outputs manuscript, sales package, cover prompt, optional cover |
565
+ | `inkos config set-global` | Configure LLM provider | OpenAI/Anthropic/custom (any OpenAI-compatible) |
566
+ | `inkos config set-model <agent> <model>` | Set model override for a specific agent | `--provider`, `--base-url`, `--api-key-env` for multi-provider routing |
567
+ | `inkos config show-models` | Show current model routing | View per-agent model assignments |
568
+ | `inkos doctor` | Diagnose issues | Check installation |
569
+ | `inkos update` | Update to latest version | Self-update |
570
+ | `inkos up/down` | Daemon mode | Background processing. Logs to `inkos.log` (JSON Lines). `-q` for quiet mode |
571
+ | `inkos review list/approve-all` | Manage chapter approvals | Quality gate |
572
+ | `inkos fanfic init` | Create fanfic from source material | `--from <file>`, `--mode canon/au/ooc/cp` |
573
+ | `inkos genre list` | List all available genres | Shows English and Chinese genres with default language |
574
+ | `inkos genre create <id>` | Create custom genre profile | `--name`, `--numerical`, `--power`, `--era` |
575
+ | `inkos genre copy <id>` | Copy built-in genre to project | For customization |
576
+ | `inkos write rewrite <book> <ch>` | Rewrite a specific chapter | Deletes chapter and later, rewrites from that point |
577
+ | `inkos book update [book-id]` | Update book settings | `--chapter-words`, `--target-chapters`, `--status`, `--lang` |
578
+ | `inkos book delete <book-id>` | Delete book and all chapters | `--force` to skip confirmation |
579
+ | `inkos plan chapter [book-id]` | Generate chapter intent | Preview what next chapter will do before writing |
580
+ | `inkos compose chapter [book-id]` | Generate runtime artifacts | Context, rule-stack, trace for next chapter |
581
+ | `inkos consolidate [book-id]` | Consolidate chapter summaries | Reduces context for long books (volume-level summaries) |
582
+ | `inkos eval [book-id]` | Quality evaluation report | `--json`, `--chapters <range>`. Composite quality score |
583
+ | `inkos studio` | Start web workbench | `-p` for port. Local web UI for book management |
584
+ | `inkos fanfic show [book-id]` | Display parsed fanfic canon | Shows imported source material analysis |
585
+ | `inkos fanfic refresh [book-id]` | Re-import and regenerate fanfic canon | `--from <file>` for updated source material |
586
+ | `inkos interact` | Shared interaction endpoint | `--json`, `--message`, `--book`. Primary entry for OpenClaw |
587
+ | `inkos` (no args) | Launch TUI dashboard | Full-screen Ink + React interactive dashboard |
588
+
589
+ ## Error Handling
590
+
591
+ ### Common Issues
592
+
593
+ **"book-id not found"**
594
+ - Verify the ID with `inkos book list`
595
+ - Ensure you're in the correct project directory
596
+
597
+ **"Provider not configured"**
598
+ - Run `inkos config set-global` with valid credentials
599
+ - Check API key and base URL with `inkos doctor`
600
+
601
+ **"Context invalid"**
602
+ - Ensure `--context` is a string (wrap in quotes if multi-word)
603
+ - Context can be in English or Chinese
604
+
605
+ **"Audit failed"**
606
+ - Check chapter for encoding issues
607
+ - Ensure chapter-words matches actual word count
608
+ - Try `inkos revise` with `--mode rewrite`
609
+
610
+ **"Book already has chapters" (import)**
611
+ - Use `--resume-from <n>` to append to existing chapters
612
+ - Or delete existing chapters first
613
+
614
+ ### Running Daemon Mode
615
+
616
+ For long-running operations:
617
+ ```bash
618
+ # Start background daemon
619
+ inkos up
620
+
621
+ # Stop daemon
622
+ inkos down
623
+
624
+ # Daemon auto-processes queued chapters
625
+ ```
626
+
627
+ ## Tips for Best Results
628
+
629
+ 1. **Provide rich context**: The more guidance in `--context`, the more coherent the narrative
630
+ 2. **Start with style**: If imitating an author, run `inkos style import` before generation
631
+ 3. **Import first**: For existing novels, use `inkos import chapters` to bootstrap truth files before continuing
632
+ 4. **Review regularly**: Use `inkos review` to catch issues early
633
+ 5. **Monitor audits**: Check `inkos audit` metrics to understand quality bottlenecks
634
+ 6. **Use spinoffs strategically**: Import canon before writing prequels/sequels
635
+ 7. **Batch generation**: Generate multiple chapters together (better continuity)
636
+ 8. **Check analytics**: Use `inkos analytics` to track quality trends over time
637
+ 9. **Export frequently**: Keep backups with `inkos export`
638
+
639
+ ## Security & Trust
640
+
641
+ - **License**: the ClawHub skill descriptor is MIT-0 per platform policy, but the underlying `@actalk/inkos`, `@actalk/inkos-core`, and `@actalk/inkos-studio` npm packages are **AGPL-3.0-only**. Running InkOS and distributing modified versions are governed by AGPL. Full source on GitHub for auditability.
642
+ - **No install hooks**: npm package has no `preinstall`/`postinstall`/`install` scripts. Install is inert.
643
+ - **Local-only file I/O**: all read/write stays inside the project directory (`books/*`, `inkos.json`, `inkos.log`). No writes outside the working directory.
644
+ - **No telemetry**: InkOS does not phone home, collect usage stats, or ship any data to InkOS-controlled servers. The only outbound traffic is to the LLM provider endpoint you explicitly configure.
645
+ - **Credential handling**: always prefer `--api-key-env <VAR_NAME>` over `--api-key <literal>` so keys never hit shell history. Keys are stored in `inkos.json` under your project directory — treat it like a secret and add it to `.gitignore` if you commit the project.
646
+ - **Custom provider base-URL**: `--provider custom` forwards your API key to whatever URL you specify. Only point it at endpoints you trust (your own proxy or an audited reverse-proxy). Never paste an untrusted `--base-url`.
647
+ - **No elevated privileges**: InkOS requires no sudo, no global state mutation, no network listening port (Studio binds `localhost:4567` only).
648
+
649
+ ## Support & Resources
650
+
651
+ - **Homepage**: https://github.com/Narcooo/inkos
652
+ - **Configuration**: Stored in project root after `inkos init`
653
+ - **Truth files**: Located in `books/<id>/story/` per book, with structured JSON in `story/state/`
654
+ - **Logs**: Check output of `inkos doctor` for troubleshooting
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "lib": ["ES2022"],
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "resolveJsonModule": true,
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true,
15
+ "outDir": "dist",
16
+ "rootDir": "src"
17
+ },
18
+ "exclude": ["node_modules", "dist"]
19
+ }