hokkoro 0.0.0-stage → 0.1.0

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 (91) hide show
  1. package/README.md +54 -2
  2. package/bin/hokkoro.js +16 -0
  3. package/dist/assets/browser-C5uuMlgA.js +1 -0
  4. package/dist/assets/index-BYiDVHau.js +4523 -0
  5. package/dist/assets/index-Bd-W7RaG.js +7 -0
  6. package/dist/index.html +559 -0
  7. package/dist/models.json +194 -0
  8. package/dist/ui/icons/alert.png +0 -0
  9. package/dist/ui/icons/done.png +0 -0
  10. package/dist/ui/icons/energy.png +0 -0
  11. package/dist/ui/icons/heart.png +0 -0
  12. package/dist/ui/icons/inn.png +0 -0
  13. package/dist/ui/icons/letter.png +0 -0
  14. package/dist/ui/icons/mail.png +0 -0
  15. package/dist/ui/icons/maker.png +0 -0
  16. package/dist/ui/icons/painted/alert.png +0 -0
  17. package/dist/ui/icons/painted/bookshelf.png +0 -0
  18. package/dist/ui/icons/painted/close.png +0 -0
  19. package/dist/ui/icons/painted/demo.png +0 -0
  20. package/dist/ui/icons/painted/done.png +0 -0
  21. package/dist/ui/icons/painted/energy.png +0 -0
  22. package/dist/ui/icons/painted/eye.png +0 -0
  23. package/dist/ui/icons/painted/hammer.png +0 -0
  24. package/dist/ui/icons/painted/heart.png +0 -0
  25. package/dist/ui/icons/painted/inn.png +0 -0
  26. package/dist/ui/icons/painted/keyboard.png +0 -0
  27. package/dist/ui/icons/painted/lantern.png +0 -0
  28. package/dist/ui/icons/painted/letter.png +0 -0
  29. package/dist/ui/icons/painted/lofi.png +0 -0
  30. package/dist/ui/icons/painted/mail.png +0 -0
  31. package/dist/ui/icons/painted/maker.png +0 -0
  32. package/dist/ui/icons/painted/maptable.png +0 -0
  33. package/dist/ui/icons/painted/microphone.png +0 -0
  34. package/dist/ui/icons/painted/notes.png +0 -0
  35. package/dist/ui/icons/painted/photo.png +0 -0
  36. package/dist/ui/icons/painted/pin.png +0 -0
  37. package/dist/ui/icons/painted/quest.png +0 -0
  38. package/dist/ui/icons/painted/question.png +0 -0
  39. package/dist/ui/icons/painted/research.png +0 -0
  40. package/dist/ui/icons/painted/seal.png +0 -0
  41. package/dist/ui/icons/painted/send.png +0 -0
  42. package/dist/ui/icons/painted/settings.png +0 -0
  43. package/dist/ui/icons/painted/sleep.png +0 -0
  44. package/dist/ui/icons/painted/star.png +0 -0
  45. package/dist/ui/icons/painted/switcher.png +0 -0
  46. package/dist/ui/icons/painted/thinking.png +0 -0
  47. package/dist/ui/icons/painted/time.png +0 -0
  48. package/dist/ui/icons/painted/workbench.png +0 -0
  49. package/dist/ui/icons/photo.png +0 -0
  50. package/dist/ui/icons/quest.png +0 -0
  51. package/dist/ui/icons/question.png +0 -0
  52. package/dist/ui/icons/settings.png +0 -0
  53. package/dist/ui/icons/sleep.png +0 -0
  54. package/dist/ui/icons/star.png +0 -0
  55. package/dist/ui/icons/thinking.png +0 -0
  56. package/dist/ui/icons/time.png +0 -0
  57. package/dist/ui/src/icon_sheet.png +0 -0
  58. package/dist/ui/src/icon_sheet_alt.png +0 -0
  59. package/dist/ui/worlds/academy.jpg +0 -0
  60. package/dist/ui/worlds/cozy.jpg +0 -0
  61. package/dist/ui/worlds/factory.jpg +0 -0
  62. package/dist/ui/worlds/fantasy.jpg +0 -0
  63. package/dist/ui/worlds/oasis.jpg +0 -0
  64. package/dist/ui/worlds/office.jpg +0 -0
  65. package/dist/ui/worlds/scifi.jpg +0 -0
  66. package/dist/ui/worlds/tower.jpg +0 -0
  67. package/package.json +56 -4
  68. package/scripts/bridge/village-hook.mjs +82 -0
  69. package/server/harness/bridge.js +238 -0
  70. package/server/harness/demo.js +183 -0
  71. package/server/harness/keys.js +55 -0
  72. package/server/harness/npcs.js +89 -0
  73. package/server/harness/providers.js +158 -0
  74. package/server/harness/roles.js +44 -0
  75. package/server/harness/runner.js +184 -0
  76. package/server/harness/sim.js +142 -0
  77. package/server/harness/terminal.js +235 -0
  78. package/server/harness/themes.js +91 -0
  79. package/server/harness/tools.js +313 -0
  80. package/server/harness/village.js +971 -0
  81. package/server/harness/workshop.js +35 -0
  82. package/server/index.js +330 -0
  83. package/server/paths.js +12 -0
  84. package/themes/academy/theme.json +209 -0
  85. package/themes/cozy/theme.json +225 -0
  86. package/themes/factory/theme.json +209 -0
  87. package/themes/fantasy/theme.json +212 -0
  88. package/themes/oasis/theme.json +189 -0
  89. package/themes/office/theme.json +205 -0
  90. package/themes/scifi/theme.json +204 -0
  91. package/themes/tower/theme.json +199 -0
package/README.md CHANGED
@@ -1,3 +1,55 @@
1
- # Temporary Holding Version
1
+ # Hokkoro
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A cozy painted village where your AI agents are the villagers. You walk around (or work from desk mode), give
4
+ villagers jobs, approve what they want to do, and read what they deliver as letters. Build a workshop on a plot and a
5
+ new villager moves in. Early access.
6
+
7
+ ## Play
8
+
9
+ You need Node 20.11 or newer. In a terminal:
10
+
11
+ ```bash
12
+ npx hokkoro
13
+ ```
14
+
15
+ Your village opens in the browser. Keep the terminal open while you play. Without a key the villagers act it out (demo
16
+ mode); to make them work for real, open Connect in the village and paste an Anthropic API key. Your village (keys,
17
+ residents, workshops, the library, downloaded models) stays on your computer in `~/.hokkoro`. Another port:
18
+ `PORT=8788 npx hokkoro`.
19
+
20
+ ## Develop
21
+
22
+ ```bash
23
+ cp .env.example .env # then put an ANTHROPIC_API_KEY in it
24
+ npm install
25
+ npm run dev # server on :8787, client on :5173
26
+ ```
27
+
28
+ Open http://localhost:5173. WASD or arrows to move, click to walk, E to interact, Esc to close a panel.
29
+
30
+ Release for players: bump `version` in package.json, then `npm run release` (builds, uploads new models to the R2
31
+ bucket hokkoro-assets under their content hash, publishes the app without models to npm as `hokkoro`).
32
+
33
+ ## What is where
34
+
35
+ - `server/harness/npcs.js` the villagers: persona, look, home, workshop. Add one here and it appears in the world.
36
+ - `server/harness/tools.js` what villagers can do: say, notebook, ask the player, deliver, message another villager, and
37
+ for the ranger fetch_url (needs the player's approval each time) and dns_lookup.
38
+ - `server/harness/runner.js` one villager turn: a manual tool-use loop on the Anthropic SDK, adaptive thinking, effort
39
+ from `VILLAGE_EFFORT`, prompt caching on the system block.
40
+ - `server/harness/village.js` the state and the orchestration: the Mayor assigns a quest, assignees run in parallel,
41
+ villagers can ask each other (two hops max), talks keep a short memory per villager, every change is an event.
42
+ - `server/index.js` Express + WebSocket. In production it also serves `dist/`.
43
+ - `client/src/world.js` the village meshes. `npc.js` a villager (placeholder body from `look`, swapped for
44
+ `public/models/<id>.glb` when present), name tag, speech bubble, walking. `ui.js` the panels. `main.js` scene,
45
+ camera, player, input.
46
+
47
+ ## Models for the villagers
48
+
49
+ Export a GLB per villager (Tripo or anything else) to `client/public/models/<id>.glb` with id one of `mayor`, `scribe`,
50
+ `ranger`, `tinker`, `bard`. It is scaled to 1.7 units tall and placed on the ground. Reload the page.
51
+
52
+ ## Cost
53
+
54
+ Every quest is a few model calls (the Mayor, each assignee, any relay). The status line at the top left shows calls and
55
+ tokens for the session. `VILLAGE_MODEL=claude-haiku-5-5` is the cheap setting while iterating on the world.
package/bin/hokkoro.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ // `npx hokkoro`: start your village on this computer and open it in the browser. Your village (keys, residents,
3
+ // workshops, the library, the downloaded models) lives in ~/.hokkoro, or HOKKORO_HOME; PORT picks another port.
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+
7
+ const [major, minor] = process.versions.node.split('.').map(Number);
8
+ if (major < 20 || (major === 20 && minor < 11)) {
9
+ console.error(`Hokkoro needs Node 20.11 or newer (this is ${process.versions.node}). Get it at https://nodejs.org`);
10
+ process.exit(1);
11
+ }
12
+
13
+ process.env.NODE_ENV = 'production';
14
+ process.env.VILLAGE_DATA ||= process.env.HOKKORO_HOME || path.join(os.homedir(), '.hokkoro');
15
+ process.env.VILLAGE_OPEN ??= '1';
16
+ await import('../server/index.js');
@@ -0,0 +1 @@
1
+ import{g as c}from"./index-Bd-W7RaG.js";function f(t,i){for(var o=0;o<i.length;o++){const e=i[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(e,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var n,a;function b(){return a||(a=1,n=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),n}var u=b();const w=c(u),p=f({__proto__:null,default:w},[u]);export{p as b};