@haaaiawd/second-nature 0.1.11 → 0.1.13

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "second-nature",
3
3
  "name": "Second Nature",
4
- "version": "0.1.11",
4
+ "version": "0.1.13",
5
5
  "entry": "./index.js",
6
6
  "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
7
  "capabilities": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haaaiawd/second-nature",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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",
@@ -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.13";
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,