@vectorize-io/self-driving-agents 0.0.11 → 0.0.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.
- package/dist/cli.js +35 -15
- package/dist/tests/cli.test.js +5 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -819,7 +819,7 @@ async function main() {
|
|
|
819
819
|
}
|
|
820
820
|
// Step 2: Ensure marketplace + plugin installed
|
|
821
821
|
const MARKETPLACE_REPO = "vectorize-io/hindsight";
|
|
822
|
-
const MARKETPLACE_NAME = "
|
|
822
|
+
const MARKETPLACE_NAME = "hindsight";
|
|
823
823
|
const PLUGIN_NAME = "hindsight-memory";
|
|
824
824
|
let hasMarketplace = false;
|
|
825
825
|
try {
|
|
@@ -888,16 +888,35 @@ async function main() {
|
|
|
888
888
|
const claudeConfig = await promptClaudeConfig(agentId);
|
|
889
889
|
ccConfig.hindsightApiUrl = claudeConfig.apiUrl;
|
|
890
890
|
ccConfig.hindsightApiToken = claudeConfig.apiToken;
|
|
891
|
-
ccConfig.enableKnowledgeTools = true;
|
|
892
|
-
mkdirSync(ccConfigDir, { recursive: true });
|
|
893
|
-
writeFileSync(ccConfigPath, JSON.stringify(ccConfig, null, 2) + "\n");
|
|
894
|
-
p.log.success(`Hindsight connection saved to ${color.dim(ccConfigPath)}`);
|
|
895
891
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
892
|
+
// Verify/set bank granularity. SDA agents need per-project isolation —
|
|
893
|
+
// bank derived as agentName::projectBasename. If the user has a conflicting
|
|
894
|
+
// config (dynamicBankId: false with a static bankId), bail with instructions.
|
|
895
|
+
if (ccConfig.dynamicBankId === false && ccConfig.bankId) {
|
|
896
|
+
p.cancel(`Conflicting plugin config in ${ccConfigPath}:\n` +
|
|
897
|
+
` Found: dynamicBankId=false, bankId="${ccConfig.bankId}"\n` +
|
|
898
|
+
` Self-driving agents need dynamicBankId=true with granularity ["agent", "project"].\n` +
|
|
899
|
+
` Remove "dynamicBankId" and "bankId" from the config, or set them to:\n` +
|
|
900
|
+
` "dynamicBankId": true,\n` +
|
|
901
|
+
` "dynamicBankGranularity": ["agent", "project"]`);
|
|
902
|
+
process.exit(1);
|
|
903
|
+
}
|
|
904
|
+
const expectedGranularity = ["agent", "project"];
|
|
905
|
+
const currentGranularity = ccConfig.dynamicBankGranularity;
|
|
906
|
+
if (currentGranularity &&
|
|
907
|
+
JSON.stringify(currentGranularity) !== JSON.stringify(expectedGranularity)) {
|
|
908
|
+
p.cancel(`Conflicting plugin config in ${ccConfigPath}:\n` +
|
|
909
|
+
` Found: dynamicBankGranularity=${JSON.stringify(currentGranularity)}\n` +
|
|
910
|
+
` Self-driving agents require: ${JSON.stringify(expectedGranularity)}\n` +
|
|
911
|
+
` Update the config to match, or remove the field to let the installer set it.`);
|
|
912
|
+
process.exit(1);
|
|
900
913
|
}
|
|
914
|
+
ccConfig.dynamicBankId = true;
|
|
915
|
+
ccConfig.dynamicBankGranularity = expectedGranularity;
|
|
916
|
+
ccConfig.enableKnowledgeTools = true;
|
|
917
|
+
mkdirSync(ccConfigDir, { recursive: true });
|
|
918
|
+
writeFileSync(ccConfigPath, JSON.stringify(ccConfig, null, 2) + "\n");
|
|
919
|
+
p.log.success(`Plugin config: ${color.dim(ccConfigPath)}`);
|
|
901
920
|
// Step 4: Save content locally for the agent
|
|
902
921
|
const contentDir = join(homedir(), ".self-driving-agents", "claude-code", agentId);
|
|
903
922
|
mkdirSync(contentDir, { recursive: true });
|
|
@@ -944,13 +963,14 @@ async function main() {
|
|
|
944
963
|
writeFileSync(userSettingsPath, JSON.stringify(userSettings, null, 2) + "\n");
|
|
945
964
|
p.log.success("Auto-approved hindsight tools in Claude Code");
|
|
946
965
|
}
|
|
947
|
-
const
|
|
948
|
-
const prompt = hasBankTemplate
|
|
949
|
-
? `Use /hindsight-memory:create-agent to create a "${agentId}" agent. Then ingest all files from ${contentDir}/ (skip bank-template.json). Read ${contentDir}/bank-template.json and create the exact mental models (knowledge pages) defined in its "mental_models" array using agent_knowledge_create_page for each one.`
|
|
950
|
-
: `Use /hindsight-memory:create-agent to create a "${agentId}" agent. Then ingest all files from ${contentDir}/ and create 3 knowledge pages that make sense based on the content.`;
|
|
966
|
+
const prompt = `/hindsight-memory:create-agent ${agentId} from ${contentDir}`;
|
|
951
967
|
p.note([
|
|
952
|
-
`${color.
|
|
953
|
-
|
|
968
|
+
`${color.yellow("⚠")} ${color.bold(`Important:`)} the agent's memory is scoped to the directory where you start ${color.cyan("claude")}.`,
|
|
969
|
+
` Always start your Claude Code sessions from the same project directory.`,
|
|
970
|
+
``,
|
|
971
|
+
`${color.dim("1.")} ${color.cyan("cd")} into your project directory`,
|
|
972
|
+
`${color.dim("2.")} Run: ${color.cyan("claude")}`,
|
|
973
|
+
`${color.dim("3.")} Say: ${color.cyan(prompt)}`,
|
|
954
974
|
].join("\n"), "Next steps");
|
|
955
975
|
p.outro(color.green(`'${agentId}' content ready`));
|
|
956
976
|
cleanup?.();
|
package/dist/tests/cli.test.js
CHANGED
|
@@ -544,13 +544,13 @@ describe("claude-code plugin install/update logic", () => {
|
|
|
544
544
|
expect(shouldUpdate(out, "hindsight-memory")).toBe(false);
|
|
545
545
|
});
|
|
546
546
|
it("updates when plugin already present", () => {
|
|
547
|
-
const out = "Installed plugins:\n ❯ hindsight-memory@
|
|
547
|
+
const out = "Installed plugins:\n ❯ hindsight-memory@hindsight\n Version: 0.5.0";
|
|
548
548
|
expect(shouldInstall(out, "hindsight-memory")).toBe(false);
|
|
549
549
|
expect(shouldUpdate(out, "hindsight-memory")).toBe(true);
|
|
550
550
|
});
|
|
551
551
|
it("detects plugin regardless of installed scope", () => {
|
|
552
|
-
const userScope = " ❯ hindsight-memory@
|
|
553
|
-
const localScope = " ❯ hindsight-memory@
|
|
552
|
+
const userScope = " ❯ hindsight-memory@hindsight\n Scope: user";
|
|
553
|
+
const localScope = " ❯ hindsight-memory@hindsight\n Scope: local";
|
|
554
554
|
expect(shouldUpdate(userScope, "hindsight-memory")).toBe(true);
|
|
555
555
|
expect(shouldUpdate(localScope, "hindsight-memory")).toBe(true);
|
|
556
556
|
});
|
|
@@ -561,10 +561,10 @@ describe("claude-code marketplace detection", () => {
|
|
|
561
561
|
function hasMarketplace(out, name, repo) {
|
|
562
562
|
return out.includes(name) || out.includes(repo);
|
|
563
563
|
}
|
|
564
|
-
const MARKETPLACE_NAME = "
|
|
564
|
+
const MARKETPLACE_NAME = "hindsight";
|
|
565
565
|
const MARKETPLACE_REPO = "vectorize-io/hindsight";
|
|
566
566
|
it("detects when marketplace already added by name", () => {
|
|
567
|
-
const out = "Configured marketplaces:\n
|
|
567
|
+
const out = "Configured marketplaces:\n hindsight (github: vectorize-io/hindsight)";
|
|
568
568
|
expect(hasMarketplace(out, MARKETPLACE_NAME, MARKETPLACE_REPO)).toBe(true);
|
|
569
569
|
});
|
|
570
570
|
it("detects when marketplace already added by repo", () => {
|