@haaaiawd/second-nature 0.1.12 → 0.1.14

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 CHANGED
@@ -725,11 +725,23 @@ function createLifecycleService() {
725
725
  },
726
726
  };
727
727
  }
728
- export default {
728
+ process.stderr.write("[second-nature] module evaluated\n");
729
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
730
+ let definePluginEntry;
731
+ try {
732
+ ({ definePluginEntry } = await import("openclaw/plugin-sdk/plugin-entry"));
733
+ process.stderr.write("[second-nature] sdk_loaded openclaw/plugin-sdk/plugin-entry\n");
734
+ }
735
+ catch {
736
+ process.stderr.write("[second-nature] sdk_fallback identity wrapper (host capability brand missing)\n");
737
+ definePluginEntry = (opts) => opts;
738
+ }
739
+ export default definePluginEntry({
729
740
  id: "second-nature",
730
741
  name: "Second Nature",
731
742
  description: "Registers command/tool/service surface with load-reload lifecycle semantics.",
732
743
  register(api) {
744
+ process.stderr.write(`[second-nature] register() entered, api keys=${Object.keys(api).join(",")}\n`);
733
745
  const runtimeService = createRuntimeService();
734
746
  const lifecycleService = createLifecycleService();
735
747
  api.registerService(runtimeService);
@@ -799,5 +811,6 @@ export default {
799
811
  };
800
812
  },
801
813
  });
814
+ process.stderr.write("[second-nature] register() completed\n");
802
815
  },
803
- };
816
+ });
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "id": "second-nature",
3
3
  "name": "Second Nature",
4
- "version": "0.1.12",
5
- "entry": "./index.js",
4
+ "version": "0.1.14",
6
5
  "description": "OpenClaw native plugin with synchronous surface registration and bundled runtime spine. Set SECOND_NATURE_WORKSPACE_ROOT or tool workspaceRoot to the same path as the agent workspace (see README / T1.1.4 ops norm).",
7
- "capabilities": {
6
+ "activation": {
7
+ "onStartup": false
8
+ },
9
+ "contracts": {
8
10
  "commands": [
9
11
  "second-nature"
10
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haaaiawd/second-nature",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "OpenClaw native plugin with synchronous registration, a packaged runtime artifact, and operator-facing status/explain flows.",
5
5
  "keywords": [
6
6
  "openclaw",
@@ -28,7 +28,21 @@
28
28
  "manifest": "./openclaw.plugin.json",
29
29
  "extensions": [
30
30
  "./index.js"
31
- ]
31
+ ],
32
+ "runtimeExtensions": [
33
+ "./index.js"
34
+ ],
35
+ "compat": {
36
+ "pluginApi": ">=2026.5.4"
37
+ }
38
+ },
39
+ "peerDependencies": {
40
+ "openclaw": ">=2026.5.4"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "openclaw": {
44
+ "optional": true
45
+ }
32
46
  },
33
47
  "dependencies": {
34
48
  "drizzle-orm": "^0.44.4",
@@ -27,7 +27,7 @@ export function startRuntimeService(ctx) {
27
27
  // - control-plane-system (heartbeat bridge preparation)
28
28
  const workspaceRoot = ctx?.workspaceRoot ?? process.cwd();
29
29
  /** Keep in sync with `plugin/package.json` when cutting releases. */
30
- const version = "0.1.11";
30
+ const version = "0.1.14";
31
31
  activeHandle = {
32
32
  ready: true,
33
33
  version,
@@ -6,6 +6,8 @@
6
6
  * `process.chdir(workspaceRoot)` during dispatch so `memory/workspace` paths match CLI cwd semantics.
7
7
  *
8
8
  * Boundaries: no static imports from `./runtime/*` (sql.js top-level await stays out of register() graph).
9
+ * VM safety: do not read `import.meta.url` at module scope — some OpenClaw loaders evaluate this file in contexts
10
+ * where top-level `import.meta` breaks before `register()` runs; compute package root only inside `openWorkspaceOpsBridge`.
9
11
  *
10
12
  * Plan B (CH-11-01): if the host VM blocks dynamic import + sql.js, fall back to a subprocess invoking
11
13
  * the workspace `second-nature` CLI — not implemented here; bridge failures surface as explicit errors.
@@ -15,10 +17,10 @@
15
17
  import fs from "node:fs";
16
18
  import path from "node:path";
17
19
  import { fileURLToPath } from "node:url";
18
- const PLUGIN_PACKAGE_ROOT = path.dirname(fileURLToPath(import.meta.url));
19
20
  export async function openWorkspaceOpsBridge(workspaceRoot) {
20
21
  const resolvedRoot = path.resolve(workspaceRoot);
21
22
  try {
23
+ const pluginPackageRoot = path.dirname(fileURLToPath(import.meta.url));
22
24
  // Packaged `plugin/runtime` is emitted JS without sibling `.d.ts` in this repo layout.
23
25
  // @ts-expect-error TS7016 — intentional dynamic import of artifact bundle
24
26
  const cliIndex = (await import("./runtime/cli/index.js"));
@@ -33,7 +35,7 @@ export async function openWorkspaceOpsBridge(workspaceRoot) {
33
35
  const stateDb = storageDb.createStateDatabase(statePath);
34
36
  const observabilityDb = obsDb.createObservabilityDatabase(obsPath);
35
37
  const deps = cliIndex.createCliRuntimeDeps({ stateDb, observabilityDb });
36
- const runtimeResolved = boundary.resolvePackagedRuntime(PLUGIN_PACKAGE_ROOT);
38
+ const runtimeResolved = boundary.resolvePackagedRuntime(pluginPackageRoot);
37
39
  const opsRouter = cliIndex.createOpsRouter({
38
40
  runtimeAvailable: runtimeResolved.ok,
39
41
  readModels: deps.readModels,