mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-19 15:04:45 +00:00
chore: rebrand companion-os to clanker-agent
- Rename all package names from companion-* to clanker-* - Update npm scopes from @mariozechner to @harivansh-afk - Rename config directories .companion -> .clanker - Rename environment variables COMPANION_* -> CLANKER_* - Update all documentation, README files, and install scripts - Rename package directories (companion-channels, companion-grind, companion-teams) - Update GitHub URLs to harivansh-afk/clanker-agent - Preserve full git history from companion-cloud monorepo
This commit is contained in:
parent
f93fe7d1a0
commit
67168d8289
356 changed files with 2249 additions and 10223 deletions
|
|
@ -28,7 +28,7 @@ describe("ExtensionRunner", () => {
|
|||
let modelRegistry: ModelRegistry;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "companion-runner-test-"));
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "clanker-runner-test-"));
|
||||
extensionsDir = path.join(tempDir, "extensions");
|
||||
fs.mkdirSync(extensionsDir);
|
||||
sessionManager = SessionManager.inMemory();
|
||||
|
|
@ -88,8 +88,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("shortcut conflicts", () => {
|
||||
it("warns when extension shortcut conflicts with built-in", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+c", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+c", {
|
||||
description: "Conflicts with built-in",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -119,8 +119,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("allows a shortcut when the reserved set no longer contains the default key", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+p", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+p", {
|
||||
description: "Uses freed default",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -154,8 +154,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("warns but allows when extension uses non-reserved built-in shortcut", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+v", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+v", {
|
||||
description: "Overrides non-reserved",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -185,8 +185,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("blocks shortcuts for reserved actions even when rebound", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+x", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+x", {
|
||||
description: "Conflicts with rebound reserved",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -223,8 +223,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("blocks shortcuts when reserved action has multiple keys", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+y", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+y", {
|
||||
description: "Conflicts with multi-key reserved",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -258,8 +258,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("warns but allows when non-reserved action has multiple keys", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+y", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+y", {
|
||||
description: "Overrides multi-key non-reserved",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -297,16 +297,16 @@ describe("ExtensionRunner", () => {
|
|||
it("warns when two extensions register same shortcut", async () => {
|
||||
// Use a non-reserved shortcut
|
||||
const extCode1 = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+shift+x", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+shift+x", {
|
||||
description: "First extension",
|
||||
handler: async () => {},
|
||||
});
|
||||
}
|
||||
`;
|
||||
const extCode2 = `
|
||||
export default function(companion) {
|
||||
companion.registerShortcut("ctrl+shift+x", {
|
||||
export default function(clanker) {
|
||||
clanker.registerShortcut("ctrl+shift+x", {
|
||||
description: "Second extension",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -341,8 +341,8 @@ describe("ExtensionRunner", () => {
|
|||
it("collects tools from multiple extensions", async () => {
|
||||
const toolCode = (name: string) => `
|
||||
import { Type } from "@sinclair/typebox";
|
||||
export default function(companion) {
|
||||
companion.registerTool({
|
||||
export default function(clanker) {
|
||||
clanker.registerTool({
|
||||
name: "${name}",
|
||||
label: "${name}",
|
||||
description: "Test tool",
|
||||
|
|
@ -380,8 +380,8 @@ describe("ExtensionRunner", () => {
|
|||
it("keeps first tool when two extensions register the same name", async () => {
|
||||
const first = `
|
||||
import { Type } from "@sinclair/typebox";
|
||||
export default function(companion) {
|
||||
companion.registerTool({
|
||||
export default function(clanker) {
|
||||
clanker.registerTool({
|
||||
name: "shared",
|
||||
label: "shared",
|
||||
description: "first",
|
||||
|
|
@ -392,8 +392,8 @@ describe("ExtensionRunner", () => {
|
|||
`;
|
||||
const second = `
|
||||
import { Type } from "@sinclair/typebox";
|
||||
export default function(companion) {
|
||||
companion.registerTool({
|
||||
export default function(clanker) {
|
||||
clanker.registerTool({
|
||||
name: "shared",
|
||||
label: "shared",
|
||||
description: "second",
|
||||
|
|
@ -423,8 +423,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("command collection", () => {
|
||||
it("collects commands from multiple extensions", async () => {
|
||||
const cmdCode = (name: string) => `
|
||||
export default function(companion) {
|
||||
companion.registerCommand("${name}", {
|
||||
export default function(clanker) {
|
||||
clanker.registerCommand("${name}", {
|
||||
description: "Test command",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -449,8 +449,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("gets command by name", async () => {
|
||||
const cmdCode = `
|
||||
export default function(companion) {
|
||||
companion.registerCommand("my-cmd", {
|
||||
export default function(clanker) {
|
||||
clanker.registerCommand("my-cmd", {
|
||||
description: "My command",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -478,8 +478,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("filters out commands conflict with reseved", async () => {
|
||||
const cmdCode = (name: string) => `
|
||||
export default function(companion) {
|
||||
companion.registerCommand("${name}", {
|
||||
export default function(clanker) {
|
||||
clanker.registerCommand("${name}", {
|
||||
description: "Test command",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -517,8 +517,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("error handling", () => {
|
||||
it("calls error listeners when handler throws", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.on("context", async () => {
|
||||
export default function(clanker) {
|
||||
clanker.on("context", async () => {
|
||||
throw new Error("Handler error!");
|
||||
});
|
||||
}
|
||||
|
|
@ -555,8 +555,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("message renderers", () => {
|
||||
it("gets message renderer by type", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerMessageRenderer("my-type", (message, options, theme) => null);
|
||||
export default function(clanker) {
|
||||
clanker.registerMessageRenderer("my-type", (message, options, theme) => null);
|
||||
}
|
||||
`;
|
||||
fs.writeFileSync(path.join(extensionsDir, "renderer.ts"), extCode);
|
||||
|
|
@ -581,8 +581,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("flags", () => {
|
||||
it("collects flags from extensions", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerFlag("my-flag", {
|
||||
export default function(clanker) {
|
||||
clanker.registerFlag("my-flag", {
|
||||
description: "My flag",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -605,8 +605,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("keeps first flag when two extensions register the same name", async () => {
|
||||
const first = `
|
||||
export default function(companion) {
|
||||
companion.registerFlag("shared-flag", {
|
||||
export default function(clanker) {
|
||||
clanker.registerFlag("shared-flag", {
|
||||
description: "first",
|
||||
type: "boolean",
|
||||
default: true,
|
||||
|
|
@ -614,8 +614,8 @@ describe("ExtensionRunner", () => {
|
|||
}
|
||||
`;
|
||||
const second = `
|
||||
export default function(companion) {
|
||||
companion.registerFlag("shared-flag", {
|
||||
export default function(clanker) {
|
||||
clanker.registerFlag("shared-flag", {
|
||||
description: "second",
|
||||
type: "boolean",
|
||||
default: false,
|
||||
|
|
@ -641,8 +641,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("can set flag values", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.registerFlag("test-flag", {
|
||||
export default function(clanker) {
|
||||
clanker.registerFlag("test-flag", {
|
||||
description: "Test flag",
|
||||
handler: async () => {},
|
||||
});
|
||||
|
|
@ -670,8 +670,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("tool_result chaining", () => {
|
||||
it("chains content modifications across handlers", async () => {
|
||||
const extCode1 = `
|
||||
export default function(companion) {
|
||||
companion.on("tool_result", async (event) => {
|
||||
export default function(clanker) {
|
||||
clanker.on("tool_result", async (event) => {
|
||||
return {
|
||||
content: [...event.content, { type: "text", text: "ext1" }],
|
||||
};
|
||||
|
|
@ -679,8 +679,8 @@ describe("ExtensionRunner", () => {
|
|||
}
|
||||
`;
|
||||
const extCode2 = `
|
||||
export default function(companion) {
|
||||
companion.on("tool_result", async (event) => {
|
||||
export default function(clanker) {
|
||||
clanker.on("tool_result", async (event) => {
|
||||
return {
|
||||
content: [...event.content, { type: "text", text: "ext2" }],
|
||||
};
|
||||
|
|
@ -726,8 +726,8 @@ describe("ExtensionRunner", () => {
|
|||
|
||||
it("preserves previous modifications when later handlers return partial patches", async () => {
|
||||
const extCode1 = `
|
||||
export default function(companion) {
|
||||
companion.on("tool_result", async () => {
|
||||
export default function(clanker) {
|
||||
clanker.on("tool_result", async () => {
|
||||
return {
|
||||
content: [{ type: "text", text: "first" }],
|
||||
details: { source: "ext1" },
|
||||
|
|
@ -736,8 +736,8 @@ describe("ExtensionRunner", () => {
|
|||
}
|
||||
`;
|
||||
const extCode2 = `
|
||||
export default function(companion) {
|
||||
companion.on("tool_result", async () => {
|
||||
export default function(clanker) {
|
||||
clanker.on("tool_result", async () => {
|
||||
return {
|
||||
isError: true,
|
||||
};
|
||||
|
|
@ -834,8 +834,8 @@ describe("ExtensionRunner", () => {
|
|||
describe("hasHandlers", () => {
|
||||
it("returns true when handlers exist for event type", async () => {
|
||||
const extCode = `
|
||||
export default function(companion) {
|
||||
companion.on("tool_call", async () => undefined);
|
||||
export default function(clanker) {
|
||||
clanker.on("tool_call", async () => undefined);
|
||||
}
|
||||
`;
|
||||
fs.writeFileSync(path.join(extensionsDir, "handler.ts"), extCode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue