oomi-ai 0.2.49 → 0.3.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 (88) hide show
  1. package/README.md +227 -463
  2. package/agent_instructions.md +244 -234
  3. package/bin/oomi-ai.js +4028 -5797
  4. package/bin/sessionBridgeState.js +78 -78
  5. package/lib/openclawPaths.js +70 -71
  6. package/lib/openclawProfile.js +216 -216
  7. package/lib/personaApiClient.js +133 -303
  8. package/lib/spokenMetadata.js +137 -137
  9. package/openclaw.extension.js +341 -341
  10. package/openclaw.plugin.json +17 -17
  11. package/package.json +59 -59
  12. package/persona-app/README.md +27 -0
  13. package/persona-app/registry/v1.json +63 -0
  14. package/persona-app/schema/persona-app.v1.schema.json +90 -0
  15. package/skills/oomi/SKILL.md +165 -182
  16. package/skills/oomi/agent_instructions.md +99 -80
  17. package/lib/channelPluginClient.js +0 -119
  18. package/lib/openclawDevGateway.js +0 -384
  19. package/lib/personaJobExecutor.js +0 -139
  20. package/lib/personaJobPoller.js +0 -112
  21. package/lib/personaPortAllocator.js +0 -36
  22. package/lib/personaRuntimeManager.js +0 -496
  23. package/lib/personaRuntimeProcess.js +0 -924
  24. package/lib/personaRuntimeRegistry.js +0 -67
  25. package/lib/personaRuntimeSupervisor.js +0 -330
  26. package/lib/scaffold.js +0 -108
  27. package/lib/template.js +0 -45
  28. package/skills/oomi/config.json +0 -3
  29. package/skills/oomi/scripts/get_avatar_capabilities.py +0 -40
  30. package/skills/oomi/scripts/get_data.py +0 -49
  31. package/skills/oomi/scripts/install_agent_instructions.py +0 -78
  32. package/skills/oomi/scripts/send_goal.py +0 -53
  33. package/skills/oomi/scripts/sync.py +0 -46
  34. package/skills/oomi/setup.py +0 -41
  35. package/templates/persona-app/.env.example +0 -8
  36. package/templates/persona-app/README.md +0 -47
  37. package/templates/persona-app/eslint.config.js +0 -28
  38. package/templates/persona-app/index.html +0 -18
  39. package/templates/persona-app/oomi.runtime.json +0 -13
  40. package/templates/persona-app/package.json +0 -44
  41. package/templates/persona-app/persona/brief.md +0 -14
  42. package/templates/persona-app/persona.json +0 -14
  43. package/templates/persona-app/public/manifest.webmanifest +0 -8
  44. package/templates/persona-app/public/oomi.health.json +0 -6
  45. package/templates/persona-app/src/App.css +0 -379
  46. package/templates/persona-app/src/App.tsx +0 -17
  47. package/templates/persona-app/src/index.css +0 -53
  48. package/templates/persona-app/src/main.tsx +0 -23
  49. package/templates/persona-app/src/pages/HomePage.tsx +0 -127
  50. package/templates/persona-app/src/pages/ScenePage.tsx +0 -158
  51. package/templates/persona-app/src/persona/config.ts +0 -6
  52. package/templates/persona-app/src/persona/notes.ts +0 -9
  53. package/templates/persona-app/src/spatial.ts +0 -82
  54. package/templates/persona-app/src/vite-env.d.ts +0 -3
  55. package/templates/persona-app/template.json +0 -13
  56. package/templates/persona-app/tsconfig.app.json +0 -23
  57. package/templates/persona-app/tsconfig.json +0 -7
  58. package/templates/persona-app/tsconfig.node.json +0 -21
  59. package/templates/persona-app/vendor/webspatial/FORK.md +0 -6
  60. package/templates/persona-app/vendor/webspatial/core-sdk/LICENSE +0 -21
  61. package/templates/persona-app/vendor/webspatial/core-sdk/dist/iife/index.d.ts +0 -906
  62. package/templates/persona-app/vendor/webspatial/core-sdk/dist/iife/index.global.js +0 -75
  63. package/templates/persona-app/vendor/webspatial/core-sdk/dist/iife/index.global.js.map +0 -1
  64. package/templates/persona-app/vendor/webspatial/core-sdk/dist/index.d.ts +0 -906
  65. package/templates/persona-app/vendor/webspatial/core-sdk/dist/index.js +0 -3131
  66. package/templates/persona-app/vendor/webspatial/core-sdk/dist/index.js.map +0 -1
  67. package/templates/persona-app/vendor/webspatial/core-sdk/package.json +0 -45
  68. package/templates/persona-app/vendor/webspatial/react-sdk/LICENSE +0 -21
  69. package/templates/persona-app/vendor/webspatial/react-sdk/dist/default/index.d.ts +0 -365
  70. package/templates/persona-app/vendor/webspatial/react-sdk/dist/default/index.js +0 -4167
  71. package/templates/persona-app/vendor/webspatial/react-sdk/dist/default/index.js.map +0 -1
  72. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.d.ts +0 -82
  73. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.js +0 -66
  74. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.js.map +0 -1
  75. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.web.d.ts +0 -2
  76. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.web.js +0 -18
  77. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-dev-runtime.web.js.map +0 -1
  78. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.d.ts +0 -5
  79. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.js +0 -66
  80. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.js.map +0 -1
  81. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.web.d.ts +0 -1
  82. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.web.js +0 -18
  83. package/templates/persona-app/vendor/webspatial/react-sdk/dist/jsx/jsx-runtime.web.js.map +0 -1
  84. package/templates/persona-app/vendor/webspatial/react-sdk/dist/web/index.d.ts +0 -365
  85. package/templates/persona-app/vendor/webspatial/react-sdk/dist/web/index.js +0 -4207
  86. package/templates/persona-app/vendor/webspatial/react-sdk/dist/web/index.js.map +0 -1
  87. package/templates/persona-app/vendor/webspatial/react-sdk/package.json +0 -94
  88. package/templates/persona-app/vite.config.ts +0 -31
@@ -1,78 +1,78 @@
1
- const WS_CONNECTING = 0;
2
- const WS_OPEN = 1;
3
-
4
- /**
5
- * Ensure session state exists so client frames can be buffered before client.open arrives.
6
- */
7
- export function ensureSessionBridge({ sessions, sessionId, createSocket }) {
8
- const id = String(sessionId || '').trim();
9
- if (!id) return null;
10
-
11
- const existing = sessions.get(id);
12
- if (existing) return existing;
13
-
14
- const socket = createSocket(id);
15
- const next = {
16
- socket,
17
- queue: [],
18
- connectAccepted: false,
19
- waitingForConnect: [],
20
- };
21
- sessions.set(id, next);
22
- return next;
23
- }
24
-
25
- /**
26
- * Forward a frame to the gateway socket or queue it while connecting.
27
- */
28
- export function forwardFrameToSession(sessionBridge, frameText, options = {}) {
29
- if (!sessionBridge || !sessionBridge.socket || typeof frameText !== 'string' || !frameText) {
30
- return 'dropped';
31
- }
32
-
33
- if (options.requiresConnectAccepted === true && sessionBridge.connectAccepted !== true) {
34
- if (!Array.isArray(sessionBridge.waitingForConnect)) {
35
- sessionBridge.waitingForConnect = [];
36
- }
37
- sessionBridge.waitingForConnect.push(frameText);
38
- return 'waiting_for_connect';
39
- }
40
-
41
- const { socket } = sessionBridge;
42
- if (socket.readyState === WS_OPEN) {
43
- socket.send(frameText);
44
- return 'sent';
45
- }
46
-
47
- if (socket.readyState === WS_CONNECTING) {
48
- sessionBridge.queue.push(frameText);
49
- return 'queued';
50
- }
51
-
52
- return 'dropped';
53
- }
54
-
55
- export function flushWaitingForConnect(sessionBridge) {
56
- if (!sessionBridge) return [];
57
-
58
- sessionBridge.connectAccepted = true;
59
- const pending = Array.isArray(sessionBridge.waitingForConnect)
60
- ? sessionBridge.waitingForConnect.splice(0, sessionBridge.waitingForConnect.length)
61
- : [];
62
-
63
- return pending.map((frameText) => ({
64
- frameText,
65
- result: forwardFrameToSession(sessionBridge, frameText),
66
- }));
67
- }
68
-
69
- export function flushSessionQueue(sessionBridge) {
70
- if (!sessionBridge || !sessionBridge.socket) return;
71
- const socket = sessionBridge.socket;
72
- while (sessionBridge.queue.length > 0 && socket.readyState === WS_OPEN) {
73
- const nextFrame = sessionBridge.queue.shift();
74
- if (typeof nextFrame === 'string' && nextFrame) {
75
- socket.send(nextFrame);
76
- }
77
- }
78
- }
1
+ const WS_CONNECTING = 0;
2
+ const WS_OPEN = 1;
3
+
4
+ /**
5
+ * Ensure session state exists so client frames can be buffered before client.open arrives.
6
+ */
7
+ export function ensureSessionBridge({ sessions, sessionId, createSocket }) {
8
+ const id = String(sessionId || '').trim();
9
+ if (!id) return null;
10
+
11
+ const existing = sessions.get(id);
12
+ if (existing) return existing;
13
+
14
+ const socket = createSocket(id);
15
+ const next = {
16
+ socket,
17
+ queue: [],
18
+ connectAccepted: false,
19
+ waitingForConnect: [],
20
+ };
21
+ sessions.set(id, next);
22
+ return next;
23
+ }
24
+
25
+ /**
26
+ * Forward a frame to the gateway socket or queue it while connecting.
27
+ */
28
+ export function forwardFrameToSession(sessionBridge, frameText, options = {}) {
29
+ if (!sessionBridge || !sessionBridge.socket || typeof frameText !== 'string' || !frameText) {
30
+ return 'dropped';
31
+ }
32
+
33
+ if (options.requiresConnectAccepted === true && sessionBridge.connectAccepted !== true) {
34
+ if (!Array.isArray(sessionBridge.waitingForConnect)) {
35
+ sessionBridge.waitingForConnect = [];
36
+ }
37
+ sessionBridge.waitingForConnect.push(frameText);
38
+ return 'waiting_for_connect';
39
+ }
40
+
41
+ const { socket } = sessionBridge;
42
+ if (socket.readyState === WS_OPEN) {
43
+ socket.send(frameText);
44
+ return 'sent';
45
+ }
46
+
47
+ if (socket.readyState === WS_CONNECTING) {
48
+ sessionBridge.queue.push(frameText);
49
+ return 'queued';
50
+ }
51
+
52
+ return 'dropped';
53
+ }
54
+
55
+ export function flushWaitingForConnect(sessionBridge) {
56
+ if (!sessionBridge) return [];
57
+
58
+ sessionBridge.connectAccepted = true;
59
+ const pending = Array.isArray(sessionBridge.waitingForConnect)
60
+ ? sessionBridge.waitingForConnect.splice(0, sessionBridge.waitingForConnect.length)
61
+ : [];
62
+
63
+ return pending.map((frameText) => ({
64
+ frameText,
65
+ result: forwardFrameToSession(sessionBridge, frameText),
66
+ }));
67
+ }
68
+
69
+ export function flushSessionQueue(sessionBridge) {
70
+ if (!sessionBridge || !sessionBridge.socket) return;
71
+ const socket = sessionBridge.socket;
72
+ while (sessionBridge.queue.length > 0 && socket.readyState === WS_OPEN) {
73
+ const nextFrame = sessionBridge.queue.shift();
74
+ if (typeof nextFrame === 'string' && nextFrame) {
75
+ socket.send(nextFrame);
76
+ }
77
+ }
78
+ }
@@ -1,87 +1,86 @@
1
- import fs from 'node:fs';
2
- import os from 'node:os';
3
- import path from 'node:path';
4
-
5
- function trimString(value) {
6
- return typeof value === 'string' ? value.trim() : '';
7
- }
8
-
9
- export function resolveOpenclawHome() {
10
- const explicitHome = trimString(process.env.OPENCLAW_HOME);
11
- if (explicitHome) {
12
- return path.resolve(explicitHome);
13
- }
14
-
15
- return path.join(os.homedir(), '.openclaw');
16
- }
17
-
1
+ import fs from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+
5
+ function trimString(value) {
6
+ return typeof value === 'string' ? value.trim() : '';
7
+ }
8
+
9
+ function isWindowsAbsolutePath(value) {
10
+ return /^[A-Za-z]:[\\/]/.test(value) || /^\\\\[^\\]+\\[^\\]+/.test(value);
11
+ }
12
+
13
+ function resolveConfiguredPath(value) {
14
+ if (process.platform !== 'win32' && isWindowsAbsolutePath(value)) {
15
+ return value;
16
+ }
17
+
18
+ return path.resolve(value);
19
+ }
20
+
21
+ export function resolveOpenclawHome() {
22
+ const explicitHome = trimString(process.env.OPENCLAW_HOME);
23
+ if (explicitHome) {
24
+ return resolveConfiguredPath(explicitHome);
25
+ }
26
+
27
+ return path.join(os.homedir(), '.openclaw');
28
+ }
29
+
18
30
  export function resolveOpenclawWorkspaceRoot() {
19
31
  const explicitWorkspace = trimString(process.env.OPENCLAW_WORKSPACE);
20
32
  if (explicitWorkspace) {
21
- return path.resolve(explicitWorkspace);
33
+ return resolveConfiguredPath(explicitWorkspace);
34
+ }
35
+
36
+ const openclawHome = resolveOpenclawHome();
37
+ const managedWorkspace = path.join(openclawHome, 'workspace');
38
+ if (fs.existsSync(managedWorkspace)) {
39
+ return managedWorkspace;
22
40
  }
23
-
24
- const openclawHome = resolveOpenclawHome();
25
- const managedWorkspace = path.join(openclawHome, 'workspace');
26
- if (fs.existsSync(managedWorkspace)) {
27
- return managedWorkspace;
28
- }
29
-
30
- return openclawHome;
31
- }
32
41
 
33
- export function resolveOpenclawLegacyPersonasDir() {
34
- return resolveOpenclawPath('personas');
42
+ return openclawHome;
35
43
  }
36
44
 
37
45
  export function resolveOpenclawPath(...parts) {
38
46
  return path.join(resolveOpenclawHome(), ...parts);
39
47
  }
40
-
41
- export function resolveOpenclawConfigCandidates() {
42
- return [
43
- resolveOpenclawPath('clawdbot.json'),
44
- resolveOpenclawPath('openclaw.json'),
45
- ];
46
- }
47
-
48
+
49
+ export function resolveOpenclawConfigCandidates() {
50
+ return [
51
+ resolveOpenclawPath('openclaw.json'),
52
+ resolveOpenclawPath('clawdbot.json'),
53
+ ];
54
+ }
55
+
48
56
  export function resolveOpenclawSkillsDir() {
49
57
  return resolveOpenclawPath('skills');
50
58
  }
51
59
 
52
- export function resolveOpenclawPersonasDir() {
53
- const explicitPersonas = trimString(process.env.OPENCLAW_PERSONAS_DIR);
54
- if (explicitPersonas) {
55
- return path.resolve(explicitPersonas);
56
- }
60
+ export function resolveOpenclawIdentityPath() {
61
+ return resolveOpenclawPath('identity', 'device.json');
62
+ }
63
+
64
+ export function resolveOpenclawUpdateStatePath() {
65
+ return resolveOpenclawPath('oomi-ai-update-check.json');
66
+ }
67
+
68
+ export function resolveOpenclawBridgeStatePath() {
69
+ return resolveOpenclawPath('oomi-bridge.json');
70
+ }
71
+
72
+ export function resolveOpenclawBridgeStatusPath() {
73
+ return resolveOpenclawPath('oomi-bridge-status.json');
74
+ }
75
+
76
+ export function resolveOpenclawBridgeLockPath() {
77
+ return resolveOpenclawPath('oomi-bridge.lock');
78
+ }
79
+
80
+ export function resolveOpenclawBridgeLiveLogPath() {
81
+ return resolveOpenclawPath('logs', 'oomi-bridge-live.log');
82
+ }
57
83
 
58
- return path.join(resolveOpenclawWorkspaceRoot(), 'personas');
84
+ export function resolveOpenclawProfilePath(fileName = 'oomi-openclaw-profile.json') {
85
+ return resolveOpenclawPath(fileName);
59
86
  }
60
-
61
- export function resolveOpenclawIdentityPath() {
62
- return resolveOpenclawPath('identity', 'device.json');
63
- }
64
-
65
- export function resolveOpenclawUpdateStatePath() {
66
- return resolveOpenclawPath('oomi-ai-update-check.json');
67
- }
68
-
69
- export function resolveOpenclawBridgeStatePath() {
70
- return resolveOpenclawPath('oomi-bridge.json');
71
- }
72
-
73
- export function resolveOpenclawBridgeStatusPath() {
74
- return resolveOpenclawPath('oomi-bridge-status.json');
75
- }
76
-
77
- export function resolveOpenclawBridgeLockPath() {
78
- return resolveOpenclawPath('oomi-bridge.lock');
79
- }
80
-
81
- export function resolveOpenclawBridgeLiveLogPath() {
82
- return resolveOpenclawPath('logs', 'oomi-bridge-live.log');
83
- }
84
-
85
- export function resolveOpenclawProfilePath(fileName = 'oomi-openclaw-profile.json') {
86
- return resolveOpenclawPath(fileName);
87
- }