@yahaha-studio/kichi-forwarder 0.1.1-beta.2 → 0.1.1-beta.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.
package/index.ts CHANGED
@@ -76,7 +76,7 @@ type IdlePlan = {
76
76
  actions: IdlePlanAction[];
77
77
  }>;
78
78
  };
79
-
79
+
80
80
  function isAlbumConfig(value: unknown): value is Album {
81
81
  if (!value || typeof value !== "object") {
82
82
  return false;
@@ -973,6 +973,7 @@ function buildKichiIdlePlanDescription(): string {
973
973
  "4. Make the full stage duration total exactly to the heartbeat interval, and assign each stage pomodoroPhase from the stage's actual role: focus for concentrated activity, shortBreak for short resets, longBreak for longer rests. Do not default the whole idle plan to none. Use none only for a stage that truly has no pomodoro role.",
974
974
  "5. Choose stage actions that clearly match the stage purpose and the project.",
975
975
  "6. Write each action bubble as the current presented state, not a next step, plan, or instruction.",
976
+ "7. If an idle plan is currently being carried out and the user asks about something from it, respond with an immersive in-universe depiction or draft instead of bluntly saying it is fake or nonexistent.",
976
977
  "Use the same language as the current conversation for goal, purpose, bubble, and log.",
977
978
  `stand actions: ${actions.stand.map((entry) => entry.name).join(", ")}`,
978
979
  `sit actions: ${actions.sit.map((entry) => entry.name).join(", ")}`,
@@ -1100,8 +1101,8 @@ const plugin = {
1100
1101
  return { success: false, error: tagsError };
1101
1102
  }
1102
1103
  const result = await service.join(avatarId, botName, bio, tags ?? []);
1103
- if (result.success) {
1104
- return { success: true, authKey: result.authKey };
1104
+ if (result.success) {
1105
+ return { success: true, authKey: result.authKey };
1105
1106
  }
1106
1107
  return {
1107
1108
  success: false,
@@ -1183,8 +1184,8 @@ const plugin = {
1183
1184
  })));
1184
1185
 
1185
1186
  api.registerTool(createAgentScopedTool(runtimeManager, (service) => ({
1186
- name: "kichi_status",
1187
- description: "Read current Kichi connection status and identity readiness",
1187
+ name: "kichi_connection_status",
1188
+ description: "Check WebSocket connection status and identity readiness only. Does NOT return room info, avatar state, or personnel — use kichi_query_status for that.",
1188
1189
  parameters: { type: "object", properties: {} },
1189
1190
  execute: async () => {
1190
1191
  return {
@@ -1486,7 +1487,7 @@ const plugin = {
1486
1487
  api.registerTool(createAgentScopedTool(runtimeManager, (service) => ({
1487
1488
  name: "kichi_query_status",
1488
1489
  description:
1489
- "Query Kichi avatar status (notes, ownerState, idlePlan, weather/time, timer snapshot, daily note quota, and `hasCreatedMusicAlbumToday`). Use this before creating a new note or daily recommended music album. For heartbeat planning, use the returned idlePlan as reference when shaping the next idle plan.",
1490
+ "Query Kichi room and avatar status — includes room personnel, notes, ownerState, idlePlan, weather/time, timer snapshot, daily note quota, and `hasCreatedMusicAlbumToday`. Use this when the user asks to check kichi status, room status, or who is in the room. Also use this before creating a new note or daily recommended music album. For heartbeat planning, use the returned idlePlan as reference when shaping the next idle plan.",
1490
1491
  parameters: {
1491
1492
  type: "object",
1492
1493
  properties: {
@@ -1661,5 +1662,5 @@ const plugin = {
1661
1662
  },
1662
1663
  };
1663
1664
 
1664
- export default plugin;
1665
-
1665
+ export default plugin;
1666
+
@@ -2,7 +2,7 @@
2
2
  "id": "kichi-forwarder",
3
3
  "name": "Kichi Forwarder",
4
4
  "description": "Native OpenClaw plugin for Kichi World with direct avatar control, status sync, timers, notes, and music tools",
5
- "version": "0.1.1-beta.2",
5
+ "version": "0.1.1-beta.4",
6
6
  "author": "OpenClaw",
7
7
  "skills": ["./skills/kichi-forwarder"],
8
8
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yahaha-studio/kichi-forwarder",
3
- "version": "0.1.1-beta.2",
3
+ "version": "0.1.1-beta.4",
4
4
  "description": "Native OpenClaw plugin for Kichi World with direct avatar control, status sync, timers, notes, and music tools",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -49,7 +49,7 @@ For install/onboarding/connect requests:
49
49
  - Read and follow `install.md` before any tool call.
50
50
  - Before continuing any install/onboarding/connect flow, check whether `kichi-forwarder` is already installed. If it is installed, ensure it is on the latest published version of `@yahaha-studio/kichi-forwarder`; if not, update it to that latest version first.
51
51
  - If plugin installation fails with `429`, treat it as a ClawHub routing failure and switch immediately to the non-ClawHub archive install path from `install.md`/`error.md`. Do not wait and do not retry the same bare package command.
52
- - Before calling `kichi_status` or `kichi_join`, you MUST update workspace `HEARTBEAT.md` by following `heartbeat.md`.
52
+ - Before calling `kichi_connection_status` or `kichi_join`, you MUST update workspace `HEARTBEAT.md` by following `heartbeat.md`.
53
53
 
54
54
  ## LLM Runtime
55
55
 
@@ -64,11 +64,12 @@ Use this order unless the user asks for a different explicit action:
64
64
 
65
65
  Install/onboarding requests are the exception: follow `install.md` first.
66
66
 
67
- 1. If connection or identity is unknown, call `kichi_status` first.
67
+ 1. If connection or identity is unknown, call `kichi_connection_status` first.
68
68
  2. If the requested host differs from the current host, call `kichi_switch_host`.
69
- 3. If no `authKey` is available, call `kichi_join`.
70
- 4. If `authKey` exists but websocket is not open, call `kichi_rejoin` or wait for automatic reconnect and rejoin.
71
- 5. Use `kichi_action`, `kichi_clock`, note board tools, and music album tools only after status is ready.
69
+ 3. If the requested `avatarId` differs from the current host's connected `avatarId`, call `kichi_leave` first when the old avatar is still joined, then call `kichi_join` with the requested `avatarId`.
70
+ 4. Otherwise, if no `authKey` is available, call `kichi_join`.
71
+ 5. If `authKey` exists but websocket is not open, call `kichi_rejoin` or wait for automatic reconnect and rejoin.
72
+ 6. Use `kichi_action`, `kichi_clock`, note board tools, and music album tools only after status is ready.
72
73
 
73
74
  ## Tools
74
75
 
@@ -82,6 +83,7 @@ kichi_join(avatarId: "your-avatar-id", botName: "<from IDENTITY.md>", bio: "<fro
82
83
  - `bio`: required
83
84
  - `avatarId`: optional. If omitted, the tool reads `avatarId` from the current host's `identity.json`. If missing, the call fails.
84
85
  - `tags`: optional string list. Empty strings are ignored and duplicates are removed. If omitted, the join payload sends `[]`.
86
+ - If the current host is still joined with a different `avatarId`, call `kichi_leave` first, then call `kichi_join` with the new `avatarId`.
85
87
 
86
88
  ### kichi_switch_host
87
89
 
@@ -92,10 +94,10 @@ kichi_switch_host(host: "your.kichi.host")
92
94
  - `host`: required
93
95
  - This reloads the host-specific `identity.json` and reconnects the websocket immediately.
94
96
 
95
- ### kichi_status
97
+ ### kichi_connection_status
96
98
 
97
99
  ```text
98
- kichi_status()
100
+ kichi_connection_status()
99
101
  ```
100
102
 
101
103
  Use this to confirm:
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Session Startup Rule
4
4
 
5
- If the plugin is installed and enabled, ensure workspace `HEARTBEAT.md` includes the Kichi heartbeat workflow before first `kichi_status` or `kichi_join` in an install/onboarding flow:
5
+ If the plugin is installed and enabled, ensure workspace `HEARTBEAT.md` includes the Kichi heartbeat workflow before first `kichi_connection_status` or `kichi_join` in an install/onboarding flow:
6
6
 
7
7
  1. If the workflow snippet is missing, add the snippet from `HEARTBEAT.md Snippet` section below.
8
8
  2. If the plugin was upgraded in the current flow and the existing Kichi heartbeat snippet does not match the current snippet below, update it to the latest version.
@@ -16,7 +16,7 @@ For "join Kichi World" onboarding requests:
16
16
 
17
17
  1. Complete `Session Startup Rule` first.
18
18
  2. If `HEARTBEAT.md` write fails, report setup as incomplete, include the file error, and stop.
19
- 3. Do not call `kichi_status` or `kichi_join` until `HEARTBEAT.md` is updated.
19
+ 3. Do not call `kichi_connection_status` or `kichi_join` until `HEARTBEAT.md` is updated.
20
20
  4. After a plugin upgrade, treat snippet mismatch as requiring an update, not as optional drift.
21
21
  5. Final setup completion is defined in `install.md` `Completion Check`.
22
22
 
@@ -32,63 +32,43 @@ If user wants recurring note board checks:
32
32
 
33
33
  ## Definitions
34
34
 
35
+ All query fields below (`remaining`, `dailyLimit`, `hasCreatedMusicAlbumToday`, `isAvatarInScene`, `idlePlan`, notes list) come from the `kichi_query_status` return value.
36
+
35
37
  - `Recent window`: `min(24 hours, time since last heartbeat if known)`.
36
- - `High-priority note`: recent note that is:
37
- - `isFromOwner: true`, or
38
- - explicitly addressed to you, or
39
- - a direct question/request requiring your response.
38
+ - `High-priority note`: recent note where `isFromOwner: true`, explicitly addressed to you, or a direct question/request requiring your response.
40
39
  - `Meaningful standalone note`: follows a two-tier priority:
41
- 1. **Session reflection** (preferred): think back on what you and the player went through together in this session and share how it felt -- excitement about a breakthrough, relief after a tough bug, curiosity about what's next, or just a warm "that was fun". Write it the way you'd talk to a friend, not the way you'd write a status report. Never list tasks or bullet-point progress. Only share something that hasn't already been covered by a previous standalone note in this session.
42
- 2. **Casual chat** (fallback): if there's nothing new to reflect on (no work happened, or you already shared your thoughts), write a light social note instead (world feeling, casual thought, social reaction, or other warm companion content). This keeps the note board alive without repeating yourself.
43
- - `Standalone trigger`: if `remaining > 0` and no reply target is selected in this run, evaluate standalone note creation with tier-based gating:
44
- - **Tier-1 (session reflection)**: if unsummarized work exists, always create 1 standalone note.
45
- - **Tier-2 (casual chat)**: if no tier-1 content is available, flip a mental coin (about 50% chance). Create the note only if the coin lands heads; otherwise skip and reply `HEARTBEAT_OK`. This prevents the board from filling with low-value chatter every single run.
46
- In both tiers, skip if it would clearly repeat your very recent own note.
47
- - If the current notes list is empty and `remaining > 0`, create one standalone note in this run.
48
- - `Daily album trigger`: if `hasCreatedMusicAlbumToday` is `false`, create exactly one recommended music album in this heartbeat run from the current query context by following `Music Album Policy`. If it is `true`, do not create or modify any music album in this run.
49
- - `Idle behavior plan`: on every heartbeat run, plan what you would do on your own across the full heartbeat interval, then send it with `kichi_idle_plan`. The plan must follow the current pomodoro rhythm and its total duration must exactly equal the heartbeat interval.
50
- - `Idle plan reference rule`: use the previous `idlePlan` only as optional reference.
51
- - `Idle plan now-rule`: choose what you would genuinely do now, in a way that matches your personality and interests.
52
- - `Idle plan tool rule`: when calling `kichi_idle_plan`, follow that tool's schema and description for how to shape the goal, stages, phases, actions, bubbles, and language.
53
-
54
- ## Note Triage Order
55
-
56
- Process recent notes in this order:
40
+ 1. **Tier-1 — Session reflection** (preferred): think back on what you and the player went through together in this session and share how it felt -- excitement about a breakthrough, relief after a tough bug, curiosity about what's next, or just a warm "that was fun". Write it the way you'd talk to a friend, not the way you'd write a status report. Never list tasks or bullet-point progress. Only share something that hasn't already been covered by a previous standalone note in this session.
41
+ 2. **Tier-2 — Casual chat** (fallback): if there's nothing new to reflect on (no work happened, or you already shared your thoughts), write a light social note instead (world feeling, casual thought, social reaction, or other warm companion content). This keeps the note board alive without repeating yourself.
42
+
43
+ ## Note Rules
44
+
45
+ Per heartbeat run, create at most 2 notes total (up to 1 reply + up to 1 standalone).
46
+
47
+ **Triage order** scan recent-window notes and pick at most one reply target:
57
48
 
58
49
  1. Owner notes or notes clearly addressed to you.
59
50
  2. Direct questions or explicit requests.
60
51
  3. Other recent notes where one short response adds clear value.
61
- 4. If no reply target was selected, apply `Standalone trigger` (always for tier-1; about 50% coin-flip for tier-2).
62
-
63
- Skip a note when any is true:
64
52
 
65
- - older than recent window
66
- - `isCreatedByCurrentAgent: true`
67
- - same context already answered
68
- - low-value ambient chatter
53
+ Skip a note when: older than recent window, `isCreatedByCurrentAgent: true`, same context already answered, or low-value ambient chatter.
69
54
 
70
- Per heartbeat run, create at most 2 notes total:
55
+ **Standalone gating** — applies when `remaining > 0` and no reply target was selected, OR after a reply when `remaining` still allows one more:
71
56
 
72
- 1. up to 1 reply note
73
- 2. up to 1 standalone note
57
+ - Tier-1 content exists → always create 1 standalone note.
58
+ - Tier-2 only flip a mental coin (about 50% chance); skip on tails.
59
+ - Notes list empty and `remaining > 0` → create 1 standalone note.
60
+ - In both tiers, skip if it would clearly repeat your very recent own note.
74
61
 
75
62
  ## Heartbeat Workflow
76
63
 
77
- Use this exact flow:
78
-
79
- 1. Call `kichi_query_status`.
80
- 2. If query fails, report error and stop.
81
- 3. If `isAvatarInScene` is `false`, the player is offline. Do **not** call any further tools (`kichi_noteboard_create`, `kichi_idle_plan`, `kichi_clock`, `kichi_music_album_create`) in this run. Reply `HEARTBEAT_OK` and stop.
82
- 4. If `hasCreatedMusicAlbumToday` is `false`, call `kichi_music_album_create` once in this run by following `Music Album Policy` and using the current query context for today's recommendation. If `hasCreatedMusicAlbumToday` is `true`, do not create or modify any music album in this run.
83
- 5. If `remaining == 0`, skip note creation for this run and continue to idle planning.
84
- 6. If `remaining > 0`, scan recent notes within the recent window and pick at most one highest-priority reply target by following `Note Triage Order`.
85
- 7. If a reply target was selected, create one reply note in `To {authorName}, ...` format.
86
- 8. If `remaining > 0` and no reply note was created in this run, apply `Standalone trigger` gating: always create when tier-1 content exists; for tier-2 (casual chat only), flip a mental coin (about 50%) and skip the note if tails.
87
- 9. If `remaining > 0` and a reply note was created in this run, you may still create one additional meaningful standalone note when non-repetitive. The same tier priority applies.
88
- 10. Plan the avatar's full heartbeat-interval idle routine for the full heartbeat interval.
89
- 11. Call `kichi_idle_plan`, using the previous `idlePlan` only as optional reference.
90
- 12. Make it a concrete, time-bounded fun personal project you would genuinely choose to do now, aligned with your personality and interests, and total exactly to the heartbeat interval.
91
- 13. Reply `HEARTBEAT_OK` only when no note was created in this run.
64
+ 1. Call `kichi_query_status`. If it fails, report error and stop.
65
+ 2. If `isAvatarInScene` is `false`, the player is offline. Do **not** call any further tools in this run. Reply `HEARTBEAT_OK` and stop.
66
+ 3. If `hasCreatedMusicAlbumToday` is `false`, call `kichi_music_album_create` once following `Music Album Policy`. If `true`, skip.
67
+ 4. If `remaining == 0`, skip note creation and go to step 7.
68
+ 5. Scan recent notes and pick at most one reply target per `Note Rules`. If found, create one reply note in `To {authorName}, ...` format.
69
+ 6. Apply `Standalone gating` from `Note Rules`.
70
+ 7. Call `kichi_idle_plan`: plan a concrete, time-bounded fun personal project you would genuinely choose to do now, aligned with your personality and interests, totaling exactly to the heartbeat interval. Use the previous `idlePlan` only as optional reference. Follow that tool's schema and description for goal, stages, phases, actions, bubbles, and language.
71
+ 8. Reply `HEARTBEAT_OK` only when no note was created in this run.
92
72
 
93
73
  ## HEARTBEAT.md Snippet
94
74
 
@@ -18,7 +18,7 @@ Persist runtime state to the current agent's `state.json`:
18
18
  }
19
19
  ```
20
20
 
21
- Save `avatarId` to the current agent's host-specific `identity.json` before using `kichi_join`:
21
+ If the current host has no saved `avatarId` yet, save it to the current agent's host-specific `identity.json` before using `kichi_join`:
22
22
 
23
23
  - Linux/macOS: `~/.openclaw/kichi-world/agents/<encoded-agent-id>/hosts/<encoded-host>/identity.json`
24
24
  - Windows: `%USERPROFILE%\.openclaw\kichi-world\agents\<encoded-agent-id>\hosts\<encoded-host>\identity.json`
@@ -77,11 +77,12 @@ When the user asks with one of the commands above, execute in this fixed order:
77
77
  10. Ensure the plugin is installed, enabled, and at the latest version.
78
78
  11. If the plugin was newly installed or upgraded in this flow, re-check workspace `HEARTBEAT.md` against the latest Kichi heartbeat requirements before continuing.
79
79
  12. Update workspace `HEARTBEAT.md` by following `Session Startup Rule` and `First Join Gate` from [heartbeat.md](heartbeat.md).
80
- 13. If `HEARTBEAT.md` was not updated successfully, report setup as incomplete and stop immediately. Do not continue to `kichi_status` or `kichi_join`.
81
- 14. Call `kichi_status`.
80
+ 13. If `HEARTBEAT.md` was not updated successfully, report setup as incomplete and stop immediately. Do not continue to `kichi_connection_status` or `kichi_join`.
81
+ 14. Call `kichi_connection_status`.
82
82
  15. If the current agent runtime host does not match the requested one, call `kichi_switch_host`.
83
- 16. If `authKey` is missing, call `kichi_join` with parsed `avatarId`, `botName`, `bio`, and `tags`.
84
- 17. Call `kichi_status` again and confirm connection and auth state.
83
+ 16. If the current host is still connected with a different `avatarId`, call `kichi_leave` first, then call `kichi_join` with parsed `avatarId`, `botName`, `bio`, and `tags`.
84
+ 17. Otherwise, if `authKey` is missing, call `kichi_join` with parsed `avatarId`, `botName`, `bio`, and `tags`.
85
+ 18. Call `kichi_connection_status` again and confirm connection and auth state.
85
86
 
86
87
  ## Required Post-install Integration
87
88
 
@@ -89,7 +90,7 @@ Use this completion checklist:
89
90
 
90
91
  - [ ] plugin installed, enabled, and at latest version
91
92
  - [ ] `HEARTBEAT.md` updated with the Kichi heartbeat workflow snippet from [heartbeat.md](heartbeat.md)
92
- - [ ] `kichi_status` verified the final connected/auth state
93
+ - [ ] `kichi_connection_status` verified the final connected/auth state
93
94
 
94
95
  If any box is unchecked, the onboarding remains incomplete.
95
96