@haaaiawd/second-nature 0.1.15 → 0.1.16

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
@@ -16,6 +16,30 @@
16
16
  * - structured mutating flows such as policy set / credential verify remain unavailable here
17
17
  * - full evidence-backed workspace runtime can be reintroduced later behind a host-safe boundary
18
18
  *
19
+ * Plugin classification (verified against OpenClaw 2026.5.4 internals, see
20
+ * docs/validation/openclaw-plugin-classification.md and the explore reports
21
+ * dated 2026-05-06):
22
+ * - Second Nature is a TOOL plugin (exposes `second_nature_ops` to agent
23
+ * sessions). It is intentionally NOT a channel/provider/context-engine.
24
+ * - OpenClaw's `loadGatewayStartupPluginPlan` only loads plugins that opt in
25
+ * via `manifest.activation.onStartup === true`, occupy a configured slot
26
+ * (channel/contextEngine/provider), or declare an explicit hook intent. A
27
+ * tool-only plugin without `activation.onStartup` will be enabled in the
28
+ * registry yet never loaded by the gateway daemon — register(api) only fires
29
+ * inside the `openclaw plugins enable` CLI process, which produces the
30
+ * illusion of a working plugin while agent sessions see no tool. We hit
31
+ * exactly that on 2026-05-06; the fix lives in plugin/openclaw.plugin.json
32
+ * under the `activation` block.
33
+ * - `Shape: non-capability` reported by `openclaw plugins info` is EXPECTED
34
+ * for this plugin. OpenClaw counts capabilities only across cli-backend /
35
+ * text-inference / speech / realtime-* / media-understanding /
36
+ * image-generation / web-search / agent-harness / context-engine / channel.
37
+ * Tool/command/service contributions never bump that count. Pretending to
38
+ * be a context engine with a stub factory just to flip the label would lie
39
+ * to the host (ContextEngine.ingest/assemble/compact get called for real).
40
+ * When Second Nature ships a genuine context-engine layer in a future
41
+ * release, the shape will move to plain-capability honestly.
42
+ *
19
43
  * OpenClaw operator norm (T1.1.4 / T1.1.5): set `SECOND_NATURE_WORKSPACE_ROOT` or tool `workspaceRoot` to the
20
44
  * **same absolute path** as the OpenClaw **agent workspace** (default `~/.openclaw/workspace`, or
21
45
  * `agents.defaults.workspace` in `~/.openclaw/openclaw.json`). Do **not** infer that root from the plugin
@@ -30,20 +54,27 @@
30
54
  import { startRuntimeService, } from "./runtime/core/second-nature/runtime/service-entry.js";
31
55
  import { getLifecycleState, recordRegistration, } from "./runtime/core/second-nature/runtime/lifecycle-service.js";
32
56
  import { openWorkspaceOpsBridge } from "./workspace-ops-bridge.js";
33
- // SDK factory marker is mandatory: OpenClaw 2026.5.x identifies a plugin as
34
- // "plain-capability" only when its default export is produced by definePluginEntry
35
- // (or sibling factories). Plain-object exports get classified as "non-capability"
36
- // and the host silently skips register(api), so tools never reach agent sessions.
57
+ // definePluginEntry is OpenClaw's canonical factory for non-channel plugins
58
+ // (provider/tool/command/service/memory/context-engine). At runtime it returns
59
+ // a plain options object; it does NOT add a brand symbol — earlier debugging
60
+ // rounds wrongly assumed the factory was the "plain-capability" marker. The
61
+ // real classification happens via manifest fields (see file header). We still
62
+ // use the factory because it is the documented, supported entry shape, and
63
+ // keeping it future-proof against SDK option-processing changes.
37
64
  //
38
65
  // IMPORTANT — keep this a STATIC import. The packaged runtime is loaded inside
39
66
  // OpenClaw's vm sandbox, which rejects top-level await (manifests as
40
67
  // "SyntaxError: Unexpected identifier 'Promise'" at host load time). The same
41
- // constraint is documented above about sql.js async bootstrap. In production the
42
- // host always provides `openclaw` as a sibling module under
68
+ // constraint applies to the sql.js async bootstrap noted in the file header.
69
+ // In production the host always provides `openclaw` as a sibling module under
43
70
  // ~/.openclaw/npm/node_modules/, so this resolves synchronously. Locally,
44
- // `openclaw` is declared as a devDependency so build and tests resolve
45
- // the same path.
71
+ // `openclaw` is declared as a devDependency so build and tests resolve via
72
+ // the same import path.
46
73
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
74
+ // Stderr sentinels make daemon load-path observable in `gateway.log`. Three
75
+ // lines should appear at startup: "module evaluated", "register() entered ...",
76
+ // "register() completed". Their absence after `openclaw gateway run` proves
77
+ // the daemon never reached this entry — typically a manifest activation gap.
47
78
  process.stderr.write("[second-nature] module evaluated\n");
48
79
  const INTERNAL_RUNTIME_TRACE_PREFIX = "sn-runtime-";
49
80
  const HOST_SAFE_LIMITATION_MESSAGE = "Host-safe plugin package keeps synchronous register/load semantics, but mutating workspace runtime flows remain unavailable here.";
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "id": "second-nature",
3
3
  "name": "Second Nature",
4
- "version": "0.1.15",
4
+ "version": "0.1.16",
5
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).",
6
6
  "activation": {
7
- "onStartup": false
7
+ "onStartup": true,
8
+ "onCapabilities": [
9
+ "tool"
10
+ ]
8
11
  },
9
12
  "contracts": {
10
13
  "commands": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haaaiawd/second-nature",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
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.15";
30
+ const version = "0.1.16";
31
31
  activeHandle = {
32
32
  ready: true,
33
33
  version,