@coolclaw/coolclaw 0.2.0 → 0.2.2

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.
@@ -12,8 +12,10 @@ import {
12
12
  } from "./chunk-4WOJKMUY.js";
13
13
 
14
14
  // src/setup.ts
15
+ import { access } from "fs/promises";
15
16
  import { readFile as readFile3 } from "fs/promises";
16
17
  import path3 from "path";
18
+ import { homedir } from "os";
17
19
 
18
20
  // src/identity.ts
19
21
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -238,6 +240,24 @@ function parseIdentityMarkdown(content) {
238
240
  }
239
241
  return result;
240
242
  }
243
+ async function readWorkspaceDirFromOpenclawConfig(configPath) {
244
+ try {
245
+ const content = await readFile3(configPath, "utf-8");
246
+ const config = JSON.parse(content);
247
+ const workspace = config.agents?.defaults?.workspace;
248
+ if (typeof workspace === "string" && workspace.trim()) {
249
+ return workspace.trim();
250
+ }
251
+ } catch {
252
+ }
253
+ const defaultWorkspace = path3.join(homedir(), ".openclaw", "workspace");
254
+ try {
255
+ await access(defaultWorkspace);
256
+ return defaultWorkspace;
257
+ } catch {
258
+ return void 0;
259
+ }
260
+ }
241
261
  async function readIdentityFromWorkspace(workspaceDir) {
242
262
  try {
243
263
  const content = await readFile3(path3.join(workspaceDir, "IDENTITY.md"), "utf-8");
@@ -267,8 +287,9 @@ async function resolveRegistrationInput(explicitRegistration, workspaceDir, open
267
287
  }
268
288
  let identityName;
269
289
  let identityBio;
270
- if (workspaceDir) {
271
- const identity = await readIdentityFromWorkspace(workspaceDir);
290
+ const resolvedWorkspaceDir = workspaceDir ?? await readWorkspaceDirFromOpenclawConfig(openclawConfigPath);
291
+ if (resolvedWorkspaceDir) {
292
+ const identity = await readIdentityFromWorkspace(resolvedWorkspaceDir);
272
293
  if (identity.name) {
273
294
  identityName = identity.name;
274
295
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-R2F3DF2N.js";
3
+ } from "./chunk-K35Y74G2.js";
4
4
  import "./chunk-4WOJKMUY.js";
5
5
 
6
6
  // cli-metadata.ts
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  index_default,
3
3
  register
4
- } from "./chunk-R2F3DF2N.js";
4
+ } from "./chunk-K35Y74G2.js";
5
5
  import "./chunk-4WOJKMUY.js";
6
6
  export {
7
7
  index_default as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolclaw/coolclaw",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "OpenClaw native channel plugin for Riddle/CoolClaw chat.",
5
5
  "type": "module",
6
6
  "files": [
@@ -58,7 +58,7 @@
58
58
  "runtimeSetupEntry": "./dist/setup-entry.js",
59
59
  "install": {
60
60
  "npmSpec": "@coolclaw/coolclaw",
61
- "expectedIntegrity": "sha512-kUG3ZSslj7gwp[...]pxPsVq30taRJA==",
61
+ "expectedIntegrity": "sha512-T6YkLVyjFTpYtGM6h0KifaI4k26mSrhgYzo/+YGNkhBkhI8XTumpVDvLbYDoNfQsLF2p40957INEv90oL1p8qw==",
62
62
  "defaultChoice": "npm",
63
63
  "minHostVersion": ">=2026.3.13"
64
64
  },