@zentropi/reflexes-openclaw 0.2.0 → 0.3.1
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/README.md +8 -6
- package/dist/index.js +12 -10
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -44,8 +44,9 @@ reflexes:
|
|
|
44
44
|
action: deny
|
|
45
45
|
evaluators:
|
|
46
46
|
default:
|
|
47
|
-
type:
|
|
48
|
-
model: cope-
|
|
47
|
+
type: systemone
|
|
48
|
+
model: cope-b-s1
|
|
49
|
+
endpoint: https://api.zentropi.ai/v1/systemone
|
|
49
50
|
api_key_env: ZENTROPI_API_KEY
|
|
50
51
|
|
|
51
52
|
# --- Operational settings (optional; safe defaults) ---
|
|
@@ -71,10 +72,11 @@ labeler (`zentropi:<labeler_id>[@<version>]`), or a GitHub-hosted file
|
|
|
71
72
|
(`github:<owner>/<repo>/<path>@<tag-or-sha>`). Hosted policies are fetched and
|
|
72
73
|
cached on first use.
|
|
73
74
|
|
|
74
|
-
**Evaluator backends.** `type` can be `
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
**Evaluator backends.** `type` can be `systemone` (the default — a System One
|
|
76
|
+
decision model, Zentropi `cope-b-s1` served over `/v1/systemone`, which
|
|
77
|
+
evaluates **all policies at a decision point in one call**; also TypeSafe
|
|
78
|
+
`jev-latest` or a local one), `zentropi` (CoPE single-label `/v1/label`),
|
|
79
|
+
`openai`, `anthropic`, or `gemini`. The LLM backends are general
|
|
78
80
|
chat models prompted to classify, so they are looser and less calibrated than
|
|
79
81
|
CoPE; for them, set `model`, `api_key_env`, and (if needed) `endpoint`.
|
|
80
82
|
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Registers a `before_tool_call` hook that evaluates each tool call
|
|
5
5
|
* against plain-English Reflexes policies via a policy-steerable
|
|
6
|
-
* evaluator. Supports the Python reference's backends — `
|
|
7
|
-
* default
|
|
8
|
-
*
|
|
6
|
+
* evaluator. Supports the Python reference's backends — `systemone` (the
|
|
7
|
+
* default: a System One decision model, Zentropi `cope-b-s1`, that evaluates
|
|
8
|
+
* all of a decision point's policies in one call), `zentropi` (CoPE single-
|
|
9
|
+
* label `/v1/label`), `openai`,
|
|
9
10
|
* `anthropic`, and `gemini` — selected by `evaluators.default.type`.
|
|
10
11
|
*
|
|
11
12
|
* Deny semantics (verified against openclaw 2026.6.11 source,
|
|
@@ -154,7 +155,7 @@ export function loadConfig(configPath) {
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
const evalCfg = doc?.evaluators?.default ?? {};
|
|
157
|
-
const evalType = (evalCfg.type ?? "
|
|
158
|
+
const evalType = (evalCfg.type ?? "systemone").toLowerCase();
|
|
158
159
|
// Per-type defaults mirror the Python evaluator classes. `apiBase` is the
|
|
159
160
|
// base URL for zentropi (evaluate() appends /v1/label) and the models base
|
|
160
161
|
// for gemini; for openai/anthropic it is the full endpoint URL. `endpoint`
|
|
@@ -165,9 +166,10 @@ export function loadConfig(configPath) {
|
|
|
165
166
|
openai: { apiBase: "https://api.openai.com/v1/chat/completions", keyEnv: "OPENAI_API_KEY" },
|
|
166
167
|
anthropic: { apiBase: "https://api.anthropic.com/v1/messages", keyEnv: "ANTHROPIC_API_KEY" },
|
|
167
168
|
gemini: { apiBase: "https://generativelanguage.googleapis.com/v1beta/models", keyEnv: "GEMINI_API_KEY" },
|
|
168
|
-
// System One decision models (multi-label, one call)
|
|
169
|
-
// full /v1/systemone endpoint; default is
|
|
170
|
-
|
|
169
|
+
// System One decision models (multi-label, one call) — the default.
|
|
170
|
+
// apiBase is the full /v1/systemone endpoint; default is cope-b-s1 on
|
|
171
|
+
// Zentropi (swap model + endpoint for jev-latest on OpenRouter, etc.).
|
|
172
|
+
systemone: { apiBase: "https://api.zentropi.ai/v1/systemone", keyEnv: "ZENTROPI_API_KEY" },
|
|
171
173
|
};
|
|
172
174
|
const d = EVAL_DEFAULTS[evalType] ?? EVAL_DEFAULTS.zentropi;
|
|
173
175
|
return {
|
|
@@ -564,7 +566,7 @@ const sleep = (ms) => ms > 0 ? new Promise((r) => setTimeout(r, ms)) : Promise.r
|
|
|
564
566
|
* endpoints, prompts, and label parsing — so a reflexes.yaml behaves
|
|
565
567
|
* identically whether evaluated by the Python integration or this plugin. */
|
|
566
568
|
export async function evaluate(config, criteria, content, opts = {}) {
|
|
567
|
-
const type = (config.evaluator.type ?? "
|
|
569
|
+
const type = (config.evaluator.type ?? "systemone").toLowerCase();
|
|
568
570
|
if (type === "openai")
|
|
569
571
|
return evaluateOpenAICompatible(config, criteria, content, opts);
|
|
570
572
|
if (type === "anthropic")
|
|
@@ -658,7 +660,7 @@ export async function evaluateManySystemOne(config, criteriaList, content, opts
|
|
|
658
660
|
};
|
|
659
661
|
});
|
|
660
662
|
const body = JSON.stringify({
|
|
661
|
-
model: config.evaluator.model ?? "
|
|
663
|
+
model: config.evaluator.model ?? "cope-b-s1",
|
|
662
664
|
questions,
|
|
663
665
|
state: { content },
|
|
664
666
|
});
|
|
@@ -737,7 +739,7 @@ async function evaluateBindings(config, bindings, content, opts) {
|
|
|
737
739
|
return null;
|
|
738
740
|
}
|
|
739
741
|
}));
|
|
740
|
-
if ((config.evaluator.type ?? "
|
|
742
|
+
if ((config.evaluator.type ?? "systemone").toLowerCase() === "systemone") {
|
|
741
743
|
const out = bindings.map(() => null);
|
|
742
744
|
const live = criteria.map((c, i) => (c !== null ? i : -1)).filter((i) => i >= 0);
|
|
743
745
|
if (live.length === 0)
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zentropi/reflexes-openclaw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "Reflexes for OpenClaw \u2014 an open safety harness for AI agents: inference-time, plain-English policy checks on tool calls and replies.",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/zentropi-ai/reflexes.git",
|
|
12
|
+
"directory": "integrations-ts/openclaw"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/zentropi-ai/reflexes/tree/main/integrations-ts/openclaw#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/zentropi-ai/reflexes/issues"
|
|
17
|
+
},
|
|
9
18
|
"type": "module",
|
|
10
19
|
"main": "dist/index.js",
|
|
11
20
|
"types": "dist/index.d.ts",
|