@haaaiawd/second-nature 0.1.4 → 0.1.5
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.js +10 -14
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
function createFallbackCommands() {
|
|
3
2
|
const commandNames = ["status", "policy", "credential", "quiet", "report", "session", "audit", "explain"];
|
|
4
3
|
return commandNames.map((name) => ({
|
|
@@ -11,10 +10,9 @@ function createFallbackCommands() {
|
|
|
11
10
|
}),
|
|
12
11
|
}));
|
|
13
12
|
}
|
|
14
|
-
function resolveCommandRouterSafe() {
|
|
15
|
-
const require = createRequire(import.meta.url);
|
|
13
|
+
async function resolveCommandRouterSafe() {
|
|
16
14
|
try {
|
|
17
|
-
const mod =
|
|
15
|
+
const mod = await import("./runtime/cli/index.js");
|
|
18
16
|
if (mod?.createCommandRouter) {
|
|
19
17
|
return mod.createCommandRouter();
|
|
20
18
|
}
|
|
@@ -30,10 +28,9 @@ function resolveCommandRouterSafe() {
|
|
|
30
28
|
},
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
|
-
function createRuntimeService() {
|
|
34
|
-
const require = createRequire(import.meta.url);
|
|
31
|
+
async function createRuntimeService() {
|
|
35
32
|
try {
|
|
36
|
-
const runtimeMod =
|
|
33
|
+
const runtimeMod = await import("./runtime/core/second-nature/runtime/service-entry.js");
|
|
37
34
|
if (runtimeMod?.startRuntimeService) {
|
|
38
35
|
const handle = runtimeMod.startRuntimeService();
|
|
39
36
|
return {
|
|
@@ -54,10 +51,9 @@ function createRuntimeService() {
|
|
|
54
51
|
},
|
|
55
52
|
};
|
|
56
53
|
}
|
|
57
|
-
function createLifecycleService() {
|
|
58
|
-
const require = createRequire(import.meta.url);
|
|
54
|
+
async function createLifecycleService() {
|
|
59
55
|
try {
|
|
60
|
-
const lifecycleMod =
|
|
56
|
+
const lifecycleMod = await import("./runtime/core/second-nature/runtime/lifecycle-service.js");
|
|
61
57
|
if (lifecycleMod?.recordRegistration) {
|
|
62
58
|
return {
|
|
63
59
|
id: "second-nature-lifecycle",
|
|
@@ -84,10 +80,10 @@ export default {
|
|
|
84
80
|
id: "second-nature",
|
|
85
81
|
name: "Second Nature",
|
|
86
82
|
description: "Registers command/tool/service surface with load-reload lifecycle semantics.",
|
|
87
|
-
register(api) {
|
|
88
|
-
const router = resolveCommandRouterSafe();
|
|
89
|
-
const runtimeService = createRuntimeService();
|
|
90
|
-
const lifecycleService = createLifecycleService();
|
|
83
|
+
async register(api) {
|
|
84
|
+
const router = await resolveCommandRouterSafe();
|
|
85
|
+
const runtimeService = await createRuntimeService();
|
|
86
|
+
const lifecycleService = await createLifecycleService();
|
|
91
87
|
api.registerService(runtimeService);
|
|
92
88
|
api.registerService(lifecycleService);
|
|
93
89
|
api.registerCli(({ program }) => {
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED