openclaw-zero-agency 0.2.1 → 0.2.3

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 (2) hide show
  1. package/dist/index.js +11 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -69,7 +69,8 @@ export default definePluginEntry({
69
69
  name: "Zero Agency",
70
70
  description: "Capability routing with a receipt gate. Packs inform judgement; they never confer authority.",
71
71
  register(api) {
72
- const cfg = api.config ?? api.pluginConfig ?? {};
72
+ // api.config is the GLOBAL gateway config; plugin-scoped config lives on api.pluginConfig.
73
+ const cfg = api.pluginConfig ?? {};
73
74
  const registryPath = cfg.registryPath ?? "";
74
75
  const telemetryPath = cfg.telemetryPath;
75
76
  const gateMode = cfg.gateMode ?? "advisory";
@@ -106,9 +107,14 @@ export default definePluginEntry({
106
107
  }
107
108
  let receipt = null;
108
109
  if (candidates.length) {
109
- const runId = ctx?.runId ?? ctx?.sessionId ?? "unknown-run";
110
- receipt = createHash("sha256").update(`${runId}:${candidates[0].id}:${Date.now()}:${randomUUID()}`).digest("hex").slice(0, 16);
111
- store().set(runId, { id: receipt, pack: candidates[0].pack, at: Date.now(), expires: Date.now() + ttl });
110
+ const runId = ctx?.runId ?? ctx?.sessionId ?? null;
111
+ receipt = createHash("sha256").update(`${runId ?? "global"}:${candidates[0].id}:${Date.now()}:${randomUUID()}`).digest("hex").slice(0, 16);
112
+ const rec = { id: receipt, pack: candidates[0].pack, at: Date.now(), expires: Date.now() + ttl };
113
+ // Tool context does not always carry runId; always publish a global
114
+ // receipt so the gate can match when the tool cannot see the run.
115
+ if (runId)
116
+ store().set(runId, rec);
117
+ store().set("global", rec);
112
118
  prune();
113
119
  }
114
120
  await telemetry(telemetryPath, { kind: "route", agent: ctx?.agentId ?? null, session: ctx?.sessionKey ?? null, query: params.task.slice(0, 200), selected: candidates[0]?.id ?? null, candidates: candidates.length, receipt });
@@ -136,7 +142,7 @@ export default definePluginEntry({
136
142
  return undefined;
137
143
  const runId = event?.runId ?? ctx?.runId ?? "unknown-run";
138
144
  prune();
139
- const r = store().get(runId);
145
+ const r = (runId && store().get(runId)) || store().get("global");
140
146
  if (r) {
141
147
  await telemetry(telemetryPath, { kind: "gate", decision: "receipt-ok", tool: event?.toolName, runId, receipt: r.id });
142
148
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-zero-agency",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Zero Agency: capability packs, programmatic routing and a receipt gate for OpenClaw. Packs inform judgement; they never confer authority.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",