@vectorize-io/self-driving-agents 0.0.17 → 0.0.18

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/dist/cli.js CHANGED
@@ -125,6 +125,33 @@ function enableKnowledgeTools() {
125
125
  pc.enableKnowledgeTools = true;
126
126
  writeFileSync(OPENCLAW_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
127
127
  }
128
+ // SDA agents are isolated per-agent only — no channel/user. The plugin's default
129
+ // (["agent","channel","user"]) produces banks like "marketing-seo::unknown::anonymous"
130
+ // for local sessions where channel/sender aren't populated.
131
+ async function ensureOpenClawAgentGranularity() {
132
+ const config = readOpenClawConfig();
133
+ if (!config)
134
+ return;
135
+ const pc = config.plugins?.entries?.["hindsight-openclaw"]?.config;
136
+ if (!pc)
137
+ return;
138
+ const current = pc.dynamicBankGranularity;
139
+ const desired = ["agent"];
140
+ const matches = Array.isArray(current) && current.length === 1 && current[0] === "agent";
141
+ if (matches)
142
+ return;
143
+ if (current && current.length > 0) {
144
+ const ok = await p.confirm({
145
+ message: `Plugin has dynamicBankGranularity=${color.yellow(JSON.stringify(current))}. SDA agents need ${color.cyan('["agent"]')}. Override?`,
146
+ initialValue: true,
147
+ });
148
+ if (p.isCancel(ok) || !ok)
149
+ return;
150
+ }
151
+ pc.dynamicBankGranularity = desired;
152
+ writeFileSync(OPENCLAW_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
153
+ p.log.success("Set dynamicBankGranularity = [\"agent\"] for per-agent bank isolation");
154
+ }
128
155
  const MIN_PLUGIN_VERSION = "0.7.2";
129
156
  function getInstalledPluginVersion() {
130
157
  try {
@@ -178,7 +205,7 @@ function resolveFromPlugin(agentId) {
178
205
  bankId = pc.bankId;
179
206
  }
180
207
  else {
181
- const granularity = pc.dynamicBankGranularity || ["agent", "channel", "user"];
208
+ const granularity = pc.dynamicBankGranularity || ["agent"];
182
209
  const fieldMap = {
183
210
  agent: agentId,
184
211
  channel: "unknown",
@@ -724,10 +751,12 @@ async function main() {
724
751
  if (harness === "openclaw") {
725
752
  await ensurePlugin();
726
753
  enableKnowledgeTools();
754
+ await ensureOpenClawAgentGranularity();
727
755
  ({ apiUrl, bankId, apiToken } = resolveFromPlugin(agentId));
728
756
  }
729
757
  else if (harness === "nemoclaw") {
730
758
  await ensureNemoClawPlugin(sandbox, agentId);
759
+ await ensureOpenClawAgentGranularity();
731
760
  ({ apiUrl, bankId, apiToken } = resolveFromPlugin(agentId));
732
761
  }
733
762
  else if (harness === "hermes") {
@@ -622,6 +622,30 @@ describe("claude-code allowed-tools merge", () => {
622
622
  expect(merged).toHaveLength(HINDSIGHT_TOOLS.length);
623
623
  });
624
624
  });
625
+ describe("openclaw dynamicBankGranularity enforcement", () => {
626
+ function decide(current) {
627
+ if (Array.isArray(current) && current.length === 1 && current[0] === "agent") {
628
+ return "noop";
629
+ }
630
+ if (Array.isArray(current) && current.length > 0) {
631
+ return "ask-confirm";
632
+ }
633
+ return "set-fresh";
634
+ }
635
+ it("sets [agent] when not configured (fresh install)", () => {
636
+ expect(decide(undefined)).toBe("set-fresh");
637
+ expect(decide(null)).toBe("set-fresh");
638
+ expect(decide([])).toBe("set-fresh");
639
+ });
640
+ it("noop when already [agent]", () => {
641
+ expect(decide(["agent"])).toBe("noop");
642
+ });
643
+ it("asks confirmation when set to a different value", () => {
644
+ expect(decide(["agent", "channel", "user"])).toBe("ask-confirm");
645
+ expect(decide(["channel"])).toBe("ask-confirm");
646
+ expect(decide(["agent", "project"])).toBe("ask-confirm");
647
+ });
648
+ });
625
649
  describe("claude-code Hindsight config persistence", () => {
626
650
  // Mirrors the config-write logic: if existing config has a connection
627
651
  // (hindsightApiUrl or llmProvider), don't prompt; otherwise prompt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorize-io/self-driving-agents",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Install self-driving agents with portable memory on any harness",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",