@yahaha-studio/kichi-forwarder 0.1.1-beta.5 → 0.1.1-beta.6
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/README.md +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/runtime-manager.ts +0 -109
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Kichi Forwarder brings your OpenClaw companion into Kichi.
|
|
|
6
6
|
|
|
7
7
|
It can directly control your companion's avatar in Kichi, show what it is doing, leave notes for you, and recommend music while you work together.
|
|
8
8
|
|
|
9
|
-
>
|
|
9
|
+
> [Kichi on Steam](https://store.steampowered.com/app/4427550/Kichi_Focus_Together) — Wishlist now!
|
|
10
10
|
|
|
11
11
|
## Highlights
|
|
12
12
|
|
package/openclaw.plugin.json
CHANGED
|
@@ -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.
|
|
5
|
+
"version": "0.1.1-beta.6",
|
|
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.
|
|
3
|
+
"version": "0.1.1-beta.6",
|
|
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",
|
package/src/runtime-manager.ts
CHANGED
|
@@ -7,10 +7,6 @@ import { KichiForwarderService } from "./service.js";
|
|
|
7
7
|
const OPENCLAW_HOME_DIR = path.join(os.homedir(), ".openclaw");
|
|
8
8
|
const KICHI_WORLD_ROOT_DIR = path.join(OPENCLAW_HOME_DIR, "kichi-world");
|
|
9
9
|
const CANONICAL_AGENT_ROOT_DIR = path.join(KICHI_WORLD_ROOT_DIR, "agents");
|
|
10
|
-
const PREVIOUS_AGENT_ROOT_DIR = path.join(OPENCLAW_HOME_DIR, "kichi-forwarder", "agents");
|
|
11
|
-
const LEGACY_GLOBAL_STATE_PATH = path.join(KICHI_WORLD_ROOT_DIR, "state.json");
|
|
12
|
-
const LEGACY_GLOBAL_HOSTS_DIR = path.join(KICHI_WORLD_ROOT_DIR, "hosts");
|
|
13
|
-
const LEGACY_MIGRATION_AGENT_ID = "main";
|
|
14
10
|
|
|
15
11
|
type AgentLocator = {
|
|
16
12
|
agentId?: string;
|
|
@@ -51,8 +47,6 @@ export class KichiRuntimeManager {
|
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
initializeStartupRuntimes(): void {
|
|
54
|
-
this.migrateRuntimeStorage();
|
|
55
|
-
|
|
56
50
|
const rootDir = CANONICAL_AGENT_ROOT_DIR;
|
|
57
51
|
if (!fs.existsSync(rootDir)) {
|
|
58
52
|
return;
|
|
@@ -117,109 +111,6 @@ export class KichiRuntimeManager {
|
|
|
117
111
|
return this.normalizeAgentId(match[1]);
|
|
118
112
|
}
|
|
119
113
|
|
|
120
|
-
private migrateRuntimeStorage(): void {
|
|
121
|
-
// Temporary startup migration for this release. Remove after users have
|
|
122
|
-
// moved off the legacy/global layout and the temporary kichi-forwarder path.
|
|
123
|
-
this.runMigrationStep("previous-agent-root", () => {
|
|
124
|
-
this.migratePreviousAgentRoot();
|
|
125
|
-
});
|
|
126
|
-
this.runMigrationStep("legacy-global-root", () => {
|
|
127
|
-
this.migrateLegacyGlobalRoot();
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private migratePreviousAgentRoot(): void {
|
|
132
|
-
if (!fs.existsSync(PREVIOUS_AGENT_ROOT_DIR)) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!fs.existsSync(CANONICAL_AGENT_ROOT_DIR)) {
|
|
137
|
-
fs.mkdirSync(path.dirname(CANONICAL_AGENT_ROOT_DIR), { recursive: true, mode: 0o700 });
|
|
138
|
-
fs.renameSync(PREVIOUS_AGENT_ROOT_DIR, CANONICAL_AGENT_ROOT_DIR);
|
|
139
|
-
this.logger.info(`[kichi:migration] moved ${PREVIOUS_AGENT_ROOT_DIR} to ${CANONICAL_AGENT_ROOT_DIR}`);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
for (const entry of fs.readdirSync(PREVIOUS_AGENT_ROOT_DIR, { withFileTypes: true })) {
|
|
144
|
-
const sourcePath = path.join(PREVIOUS_AGENT_ROOT_DIR, entry.name);
|
|
145
|
-
const targetPath = path.join(CANONICAL_AGENT_ROOT_DIR, entry.name);
|
|
146
|
-
this.movePathIntoTarget(sourcePath, targetPath);
|
|
147
|
-
}
|
|
148
|
-
this.removeDirectoryIfEmpty(PREVIOUS_AGENT_ROOT_DIR);
|
|
149
|
-
this.removeDirectoryIfEmpty(path.dirname(PREVIOUS_AGENT_ROOT_DIR));
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
private migrateLegacyGlobalRoot(): void {
|
|
153
|
-
const hasLegacyState = fs.existsSync(LEGACY_GLOBAL_STATE_PATH);
|
|
154
|
-
const hasLegacyHosts = fs.existsSync(LEGACY_GLOBAL_HOSTS_DIR);
|
|
155
|
-
if (!hasLegacyState && !hasLegacyHosts) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const targetRuntimeDir = this.getRuntimeDir(LEGACY_MIGRATION_AGENT_ID);
|
|
160
|
-
fs.mkdirSync(targetRuntimeDir, { recursive: true, mode: 0o700 });
|
|
161
|
-
|
|
162
|
-
if (hasLegacyState) {
|
|
163
|
-
const targetStatePath = path.join(targetRuntimeDir, "state.json");
|
|
164
|
-
this.movePathIntoTarget(LEGACY_GLOBAL_STATE_PATH, targetStatePath);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (hasLegacyHosts) {
|
|
168
|
-
const targetHostsDir = path.join(targetRuntimeDir, "hosts");
|
|
169
|
-
this.movePathIntoTarget(LEGACY_GLOBAL_HOSTS_DIR, targetHostsDir);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
private movePathIntoTarget(sourcePath: string, targetPath: string): void {
|
|
174
|
-
if (!fs.existsSync(sourcePath)) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (!fs.existsSync(targetPath)) {
|
|
179
|
-
fs.mkdirSync(path.dirname(targetPath), { recursive: true, mode: 0o700 });
|
|
180
|
-
fs.renameSync(sourcePath, targetPath);
|
|
181
|
-
this.logger.info(`[kichi:migration] moved ${sourcePath} to ${targetPath}`);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const sourceStat = fs.lstatSync(sourcePath);
|
|
186
|
-
const targetStat = fs.lstatSync(targetPath);
|
|
187
|
-
|
|
188
|
-
if (sourceStat.isDirectory() && targetStat.isDirectory()) {
|
|
189
|
-
for (const entry of fs.readdirSync(sourcePath, { withFileTypes: true })) {
|
|
190
|
-
const nextSourcePath = path.join(sourcePath, entry.name);
|
|
191
|
-
const nextTargetPath = path.join(targetPath, entry.name);
|
|
192
|
-
this.movePathIntoTarget(nextSourcePath, nextTargetPath);
|
|
193
|
-
}
|
|
194
|
-
this.removeDirectoryIfEmpty(sourcePath);
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
fs.rmSync(sourcePath, { recursive: sourceStat.isDirectory(), force: true });
|
|
199
|
-
this.logger.warn(`[kichi:migration] dropped ${sourcePath} because target already exists at ${targetPath}`);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
private removeDirectoryIfEmpty(dirPath: string): void {
|
|
203
|
-
if (!fs.existsSync(dirPath)) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (!fs.lstatSync(dirPath).isDirectory()) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (fs.readdirSync(dirPath).length > 0) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
fs.rmdirSync(dirPath);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
private runMigrationStep(label: string, fn: () => void): void {
|
|
216
|
-
try {
|
|
217
|
-
fn();
|
|
218
|
-
} catch (error) {
|
|
219
|
-
this.logger.warn(`[kichi:migration] skipped ${label} due to error: ${String(error)}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
114
|
private createRuntime(agentId: string): KichiForwarderService {
|
|
224
115
|
const runtimeDir = this.getRuntimeDir(agentId);
|
|
225
116
|
fs.mkdirSync(runtimeDir, { recursive: true, mode: 0o700 });
|