Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7eec266f50 | ||
|
|
b3d860cce2 | ||
|
|
7b9c6a7d4a |
@@ -186,13 +186,11 @@ Terminal activity contributes to the workspace status bucket **per `workspaceId`
|
||||
|
||||
Single file, validated with `PersistedConfigSchema`.
|
||||
|
||||
`agents.skills.selection` stores the orchestration-skill preference for the daemon host, and a
|
||||
missing value defaults to `{ mode: "all" }`. The daemon does not persist installed state. It
|
||||
derives installed state from `~/.agents/skills`, `~/.claude/skills`, and `~/.gemini/config/skills`,
|
||||
and serializes configuration and filesystem convergence through one owner. Codex and Gemini CLI
|
||||
discover `~/.agents/skills`, while Antigravity discovers `~/.gemini/config/skills`. Updates retire
|
||||
unchanged files from Paseo-managed copies in `~/.codex/skills` and preserve user edits and
|
||||
untracked files.
|
||||
`agents.skills.selection` is the daemon host's orchestration-skill preference. Missing means
|
||||
`{ mode: "all" }`. Installed state is not persisted; the daemon derives it from the shared
|
||||
`~/.agents/skills` and Claude skill directories and keeps config plus filesystem convergence behind
|
||||
one serialized owner. Codex discovers the shared directory. Updates retire unchanged files from
|
||||
Paseo-managed copies in `~/.codex/skills`, preserving user edits and untracked files.
|
||||
|
||||
`paseo reload` reads and validates this file once inside the daemon. That snapshot drives resolution,
|
||||
classification, application, and reload bookkeeping. `DaemonConfigStore` owns applying runtime-safe
|
||||
|
||||
@@ -29,7 +29,12 @@ const ACP_PROVIDER = {
|
||||
|
||||
interface ProviderCatalogDaemonClient {
|
||||
getLastServerInfoMessage(): {
|
||||
features?: { fxProvider?: boolean; hopliteProvider?: boolean; plugins?: boolean };
|
||||
features?: {
|
||||
gooseProvider?: boolean;
|
||||
fxProvider?: boolean;
|
||||
hopliteProvider?: boolean;
|
||||
plugins?: boolean;
|
||||
};
|
||||
} | null;
|
||||
connect(): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
@@ -204,3 +209,47 @@ test("model selector excludes Hoplite before opt-in", async ({ page }, testInfo)
|
||||
await client.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("adds bundled goose from the catalog", async ({ page }) => {
|
||||
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
|
||||
clientIdPrefix: "goose-catalog-e2e",
|
||||
});
|
||||
try {
|
||||
expect(client.getLastServerInfoMessage()?.features?.gooseProvider).toBe(true);
|
||||
await client.patchDaemonConfig({ removeProviders: ["goose"] });
|
||||
await gotoAppShell(page);
|
||||
await addGooseFromSettings(page, getServerId());
|
||||
expect((await client.getDaemonConfig()).config.providers?.goose).toEqual({ enabled: true });
|
||||
} finally {
|
||||
await client.patchDaemonConfig({ removeProviders: ["goose"] });
|
||||
await client.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("adds goose through ACP on an older host", async ({ page, outdatedDaemon }) => {
|
||||
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
|
||||
clientIdPrefix: "goose-catalog-old-host",
|
||||
port: Number(new URL(`http://${outdatedDaemon.endpoint}`).port),
|
||||
});
|
||||
try {
|
||||
expect(client.getLastServerInfoMessage()?.features?.gooseProvider).toBe(false);
|
||||
await seedSavedSettingsHosts(page, [outdatedDaemon]);
|
||||
await page.reload();
|
||||
await addGooseFromSettings(page, outdatedDaemon.serverId);
|
||||
expect((await client.getDaemonConfig()).config.providers?.goose).toMatchObject({
|
||||
extends: "acp",
|
||||
command: ["goose", "acp"],
|
||||
});
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
});
|
||||
|
||||
async function addGooseFromSettings(page: import("@playwright/test").Page, serverId: string) {
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, serverId);
|
||||
await openSettingsHostSection(page, serverId, "providers");
|
||||
await openAddProvider(page);
|
||||
await installAcpCatalogProvider(page, "goose");
|
||||
await expectProviderInstalledInSettings(page, "goose");
|
||||
}
|
||||
|
||||
@@ -233,8 +233,8 @@ test.describe("usage modal", () => {
|
||||
],
|
||||
});
|
||||
await gotoAppShell(page);
|
||||
// Three windows leave no room for labels in the summary, so it reads percents.
|
||||
await expectPinnedUsage(page, ["31%", "20%", "12%"]);
|
||||
// Three Weekly labels overflow the summary, so it falls back to compact shorthands.
|
||||
await expectPinnedUsage(page, ["31% wk", "20% wk", "12% wk"]);
|
||||
await openUsageFromItem(page);
|
||||
await expectUsageCardOrder(page, ["alpha:a", "beta:home", "beta:work"]);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
usageModal,
|
||||
installTallUsageSource,
|
||||
} from "../support/helpers/usage-sidebar-item";
|
||||
import { seedDockedSidebarWidth } from "../support/helpers/sidebar-footer-overflow";
|
||||
import { seedSidebarFooterPreferences } from "../support/helpers/sidebar-nav-settings";
|
||||
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
|
||||
import { createTempGitRepo } from "../support/helpers/workspace";
|
||||
@@ -577,3 +578,97 @@ test("visible usage summary requests reports on load", async ({ page }) => {
|
||||
await expectPinnedUsage(page, ["31% 5h", "54% wk", "7% 5h", "12% wk"]);
|
||||
expect(usage.listRequests()).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("sidebar usage falls back to period shorthands before dropping all labels", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(120_000);
|
||||
const [claude, codex] = claudeAndCodexReports();
|
||||
const fetchedAt = new Date().toISOString();
|
||||
await installUsageReportsFixture(page, {
|
||||
lists: [
|
||||
() => [
|
||||
{
|
||||
...codex!,
|
||||
report: {
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "weekly", label: "Weekly", shortLabel: "wk", summary: true, usedPct: 97 },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
...claude!,
|
||||
report: {
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "five_hour", label: "Session", shortLabel: "5h", summary: true, usedPct: 100 },
|
||||
{ id: "weekly", label: "Weekly", shortLabel: "wk", summary: true, usedPct: 14 },
|
||||
{
|
||||
id: "weekly_model_opus",
|
||||
label: "Weekly · Opus",
|
||||
shortLabel: "wk Opus",
|
||||
summary: true,
|
||||
usedPct: 22,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "antigravity:default",
|
||||
account: {},
|
||||
fetchedAt,
|
||||
sourceId: "antigravity",
|
||||
sourceLabel: "Antigravity",
|
||||
report: {
|
||||
status: "available",
|
||||
windows: [
|
||||
{
|
||||
id: "gemini-weekly",
|
||||
label: "Gemini Models · Weekly",
|
||||
shortLabel: "Gemini wk",
|
||||
summary: true,
|
||||
usedPct: 6,
|
||||
},
|
||||
{
|
||||
id: "gemini-5h",
|
||||
label: "Gemini Models · 5h",
|
||||
shortLabel: "Gemini 5h",
|
||||
summary: true,
|
||||
usedPct: 20,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
});
|
||||
await seedSidebarFooterPreferences(page, [{ key: "usage", visible: true }]);
|
||||
await seedDockedSidebarWidth(page, 432);
|
||||
await page.setViewportSize(WIDE);
|
||||
await gotoAppShell(page);
|
||||
|
||||
await expectPinnedUsage(page, ["6% wk", "20% 5h", "100% 5h", "14% wk", "22% wk", "97% wk"]);
|
||||
|
||||
const handle = page.getByTestId("left-sidebar-resize-handle");
|
||||
const dragSidebarTo = async (targetX: number) => {
|
||||
const box = (await handle.boundingBox())!;
|
||||
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(targetX, box.y + box.height / 2, { steps: 10 });
|
||||
await page.mouse.up();
|
||||
};
|
||||
|
||||
await dragSidebarTo(600);
|
||||
await expectPinnedUsage(page, [
|
||||
"6% Gemini wk",
|
||||
"20% Gemini 5h",
|
||||
"100% 5h",
|
||||
"14% wk",
|
||||
"22% wk Opus",
|
||||
"97% wk",
|
||||
]);
|
||||
|
||||
await dragSidebarTo(300);
|
||||
await expectPinnedUsage(page, ["6%", "20%", "100%", "14%", "22%", "97%"]);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ type AgentSkillsClient = Pick<
|
||||
"close" | "connect" | "getAgentSkillsStatus" | "saveAgentSkillsSelection"
|
||||
>;
|
||||
|
||||
export type SkillTargetName = "agents" | "claude" | "antigravity";
|
||||
export type SkillTargetName = "agents" | "claude";
|
||||
|
||||
export interface AgentSkillsSandbox {
|
||||
available: string[];
|
||||
@@ -64,7 +64,6 @@ export async function startAgentSkillsSandbox(): Promise<AgentSkillsSandbox> {
|
||||
const targets = {
|
||||
agents: path.join(home, ".agents", "skills"),
|
||||
claude: path.join(home, ".claude", "skills"),
|
||||
antigravity: path.join(home, ".gemini", "config", "skills"),
|
||||
};
|
||||
const codexSkillsDir = path.join(home, ".codex", "skills");
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ export interface SetupHost {
|
||||
/**
|
||||
* An isolated host whose only agent history is the Claude sessions given here, so suggestions
|
||||
* never depend on the machine running the test. Its HOME is a scratch folder, so the skills setup
|
||||
* installs never land in the real ~/.agents, ~/.claude, ~/.codex, or ~/.gemini/config. `withBrokenProvider` adds a
|
||||
* installs never land in the real ~/.agents, ~/.claude or ~/.codex. `withBrokenProvider` adds a
|
||||
* provider that cannot start.
|
||||
*/
|
||||
export async function startSetupHost(
|
||||
|
||||
@@ -224,6 +224,7 @@ const CATALOG_DATA = [
|
||||
},
|
||||
{
|
||||
id: "goose",
|
||||
bundledProvider: { hostFeature: "gooseProvider" },
|
||||
title: "goose",
|
||||
description: "A local, extensible, open source AI agent that automates engineering tasks",
|
||||
version: "1.33.1",
|
||||
|
||||
@@ -150,3 +150,21 @@ describe("ACP provider catalog", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("adds bundled goose on capable hosts and uses the ACP config on older hosts", () => {
|
||||
const goose = findProvider("goose");
|
||||
expect(buildAcpProviderConfigPatch(goose, (feature) => feature === "gooseProvider")).toEqual({
|
||||
providers: { goose: { enabled: true } },
|
||||
});
|
||||
expect(buildAcpProviderConfigPatch(goose)).toEqual({
|
||||
providers: {
|
||||
goose: {
|
||||
extends: "acp",
|
||||
label: "goose",
|
||||
description: goose.description,
|
||||
command: ["goose", "acp"],
|
||||
env: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,12 +19,16 @@ export function buildAcpProviderConfigPatch(
|
||||
hostSupports: (feature: HostFeatureName) => boolean = () => false,
|
||||
): MutableDaemonConfigPatch {
|
||||
if (entry.bundledProvider) {
|
||||
const feature = entry.bundledProvider.hostFeature;
|
||||
if (hostSupports(feature)) {
|
||||
return { providers: { [entry.id]: { enabled: true } } };
|
||||
}
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once host floor includes the bundled adapter.
|
||||
// COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
|
||||
// COMPAT(fxProvider): added after v0.15.3, remove after 2027-05-09 once host floor includes the bundled adapter.
|
||||
if (!hostSupports(entry.bundledProvider.hostFeature)) {
|
||||
if (feature !== "gooseProvider") {
|
||||
throw new Error(`Update the host to add ${entry.title}.`);
|
||||
}
|
||||
return { providers: { [entry.id]: { enabled: true } } };
|
||||
}
|
||||
return {
|
||||
providers: {
|
||||
|
||||
@@ -2892,8 +2892,7 @@ export const ar: TranslationResources = {
|
||||
updateAvailable: "التحديث متاح",
|
||||
updateTitle: "تحديث مهارات Paseo ؟",
|
||||
uninstallTitle: "إلغاء تثبيت مهارات Paseo ؟",
|
||||
uninstallMessage:
|
||||
"يزيل جميع مهارات تنسيق Paseo من ~/.agents و~/.claude و~/.codex و~/.gemini/config.",
|
||||
uninstallMessage: "يزيل جميع مهارات تنسيق Paseo من ~/.agents ، ~/.claude ، ~/.codex.",
|
||||
choose: "اختيار المهارات",
|
||||
chooseAll: "كل المهارات",
|
||||
chooseAllHint: "أبقِ جميع المهارات المرفقة مثبتة، بما فيها ما يُضاف لاحقًا.",
|
||||
@@ -2901,7 +2900,7 @@ export const ar: TranslationResources = {
|
||||
chooseEmpty: "لا تتضمن هذه النسخة أي مهارات.",
|
||||
removeTitle: "إزالة المهارات غير المحددة؟",
|
||||
removeMessage:
|
||||
"سيتم حذف {{skills}} من ~/.agents و~/.claude و~/.codex و~/.gemini/config. كما يُحذف كل ما أضفته داخل مجلدات المهارات تلك.",
|
||||
"سيتم حذف {{skills}} من ~/.agents و~/.claude و~/.codex. كما يُحذف كل ما أضفته داخل مجلدات المهارات تلك.",
|
||||
saveFailed: "تعذر حفظ اختيار المهارات.",
|
||||
statusFailed: "غير قادر على التحقق من حالة مهارات التنسيق.",
|
||||
updateFailed: "غير قادر على تحديث مهارات التنسيق.",
|
||||
|
||||
@@ -2994,7 +2994,7 @@ export const en = {
|
||||
updateTitle: "Update Paseo skills?",
|
||||
uninstallTitle: "Uninstall Paseo skills?",
|
||||
uninstallMessage:
|
||||
"Removes all Paseo orchestration skills from ~/.agents, ~/.claude, ~/.codex, and ~/.gemini/config on this host.",
|
||||
"Removes all Paseo orchestration skills from ~/.agents, ~/.claude, ~/.codex on this host.",
|
||||
choose: "Choose skills",
|
||||
chooseAll: "All skills",
|
||||
chooseAllHint: "Keep every bundled skill installed, including ones added later.",
|
||||
@@ -3002,7 +3002,7 @@ export const en = {
|
||||
chooseEmpty: "This host bundles no skills.",
|
||||
removeTitle: "Remove deselected skills?",
|
||||
removeMessage:
|
||||
"{{skills}} will be deleted from ~/.agents, ~/.claude, ~/.codex, and ~/.gemini/config on this host. Anything you added inside those skill folders is deleted too.",
|
||||
"{{skills}} will be deleted from ~/.agents, ~/.claude, and ~/.codex on this host. Anything you added inside those skill folders is deleted too.",
|
||||
saveFailed: "Could not save your skill selection.",
|
||||
actions: {
|
||||
update: "Update",
|
||||
|
||||
@@ -2916,7 +2916,7 @@ export const es: TranslationResources = {
|
||||
updateTitle: "¿Actualizar las habilidades dePaseo?",
|
||||
uninstallTitle: "¿Desinstalar las habilidadesPaseo?",
|
||||
uninstallMessage:
|
||||
"Elimina todas las habilidades de orquestación Paseo de ~/.agents, ~/.claude, ~/.codex y ~/.gemini/config.",
|
||||
"Elimina todas las habilidades de orquestaciónPaseode ~/.agents, ~/.claude, ~/.codex.",
|
||||
choose: "Elegir habilidades",
|
||||
chooseAll: "Todas las habilidades",
|
||||
chooseAllHint:
|
||||
@@ -2925,7 +2925,7 @@ export const es: TranslationResources = {
|
||||
chooseEmpty: "Esta versión no incluye habilidades.",
|
||||
removeTitle: "¿Eliminar las habilidades deseleccionadas?",
|
||||
removeMessage:
|
||||
"{{skills}} se eliminarán de ~/.agents, ~/.claude, ~/.codex y ~/.gemini/config. También se elimina todo lo que hayas añadido dentro de esas carpetas de habilidades.",
|
||||
"{{skills}} se eliminarán de ~/.agents, ~/.claude y ~/.codex. También se elimina todo lo que hayas añadido dentro de esas carpetas de habilidades.",
|
||||
saveFailed: "No se pudo guardar tu selección de habilidades.",
|
||||
statusFailed: "No se puede comprobar el estado de las habilidades de orquestación.",
|
||||
updateFailed: "No se pueden actualizar las habilidades de orquestación.",
|
||||
|
||||
@@ -2919,7 +2919,7 @@ export const fr: TranslationResources = {
|
||||
updateTitle: "Mettre à jour les skills Paseo ?",
|
||||
uninstallTitle: "Désinstaller les skills Paseo ?",
|
||||
uninstallMessage:
|
||||
"Supprime tous les skills d’orchestration Paseo de ~/.agents, ~/.claude, ~/.codex et ~/.gemini/config sur cet hôte.",
|
||||
"Supprime tous les skills d’orchestration Paseo de ~/.agents, ~/.claude et ~/.codex sur cet hôte.",
|
||||
choose: "Choisir les skills",
|
||||
chooseAll: "Tous les skills",
|
||||
chooseAllHint:
|
||||
@@ -2928,7 +2928,7 @@ export const fr: TranslationResources = {
|
||||
chooseEmpty: "Cet hôte ne fournit aucun skill.",
|
||||
removeTitle: "Supprimer les skills décochés ?",
|
||||
removeMessage:
|
||||
"{{skills}} seront supprimés de ~/.agents, ~/.claude, ~/.codex et ~/.gemini/config sur cet hôte. Tout ce que vous avez ajouté dans ces dossiers de skills sera également supprimé.",
|
||||
"{{skills}} seront supprimés de ~/.agents, ~/.claude et ~/.codex sur cet hôte. Tout ce que vous avez ajouté dans ces dossiers de skills sera également supprimé.",
|
||||
saveFailed: "Impossible d’enregistrer votre sélection de skills.",
|
||||
statusFailed: "Impossible de vérifier l’état des skills d’orchestration.",
|
||||
updateFailed: "Impossible de mettre à jour les skills d’orchestration.",
|
||||
|
||||
@@ -2884,7 +2884,7 @@ export const ja: TranslationResources = {
|
||||
updateTitle: "Paseoスキルを更新しますか?",
|
||||
uninstallTitle: "Paseoスキルをアンインストールしますか?",
|
||||
uninstallMessage:
|
||||
"~/.agents、~/.claude、~/.codex、~/.gemini/configからすべてのPaseoオーケストレーションスキルを削除します。",
|
||||
"~/.agents、~/.claude、~/.codexからすべてのPaseoオーケストレーションスキルを削除します。",
|
||||
choose: "スキルを選択",
|
||||
chooseAll: "すべてのスキル",
|
||||
chooseAllHint:
|
||||
@@ -2893,7 +2893,7 @@ export const ja: TranslationResources = {
|
||||
chooseEmpty: "このビルドにはスキルが含まれていません。",
|
||||
removeTitle: "選択を外したスキルを削除しますか?",
|
||||
removeMessage:
|
||||
"{{skills}} を ~/.agents、~/.claude、~/.codex、~/.gemini/config から削除します。それらのスキルフォルダー内に追加したものもすべて削除されます。",
|
||||
"{{skills}} を ~/.agents、~/.claude、~/.codex から削除します。それらのスキルフォルダー内に追加したものもすべて削除されます。",
|
||||
saveFailed: "スキルの選択を保存できませんでした。",
|
||||
statusFailed: "オーケストレーションスキルのステータスを確認できません。",
|
||||
updateFailed: "オーケストレーションスキルを更新できません。",
|
||||
|
||||
@@ -2871,7 +2871,7 @@ export const ko: TranslationResources = {
|
||||
updateTitle: "Paseo 스킬을 업데이트할까요?",
|
||||
uninstallTitle: "Paseo 스킬을 제거할까요?",
|
||||
uninstallMessage:
|
||||
"~/.agents, ~/.claude, ~/.codex, ~/.gemini/config에서 모든 Paseo 오케스트레이션 스킬을 제거합니다.",
|
||||
"~/.agents, ~/.claude, ~/.codex에서 모든 Paseo 오케스트레이션 스킬을 제거합니다.",
|
||||
choose: "스킬 선택",
|
||||
chooseAll: "모든 스킬",
|
||||
chooseAllHint: "나중에 추가되는 항목을 포함하여 모든 번들 스킬을 설치된 상태로 유지합니다.",
|
||||
@@ -2879,7 +2879,7 @@ export const ko: TranslationResources = {
|
||||
chooseEmpty: "이 빌드에는 번들 스킬이 없습니다.",
|
||||
removeTitle: "선택 해제한 스킬을 제거할까요?",
|
||||
removeMessage:
|
||||
"{{skills}}는 ~/.agents, ~/.claude, ~/.codex 및 ~/.gemini/config에서 삭제됩니다. 해당 스킬 폴더 안에 추가한 모든 항목도 삭제됩니다.",
|
||||
"{{skills}}는 ~/.agents, ~/.claude 및 ~/.codex에서 삭제됩니다. 해당 스킬 폴더 안에 추가한 모든 항목도 삭제됩니다.",
|
||||
saveFailed: "선택한 스킬을 저장하지 못했습니다.",
|
||||
statusFailed: "오케스트레이션 스킬 상태를 확인할 수 없습니다.",
|
||||
updateFailed: "오케스트레이션 스킬을 업데이트할 수 없습니다.",
|
||||
|
||||
@@ -2897,7 +2897,7 @@ export const ptBR: TranslationResources = {
|
||||
updateTitle: "Atualizar Paseo skills?",
|
||||
uninstallTitle: "Desinstalar Paseo skills?",
|
||||
uninstallMessage:
|
||||
"Remove todas as skills de orquestração do Paseo de ~/.agents, ~/.claude, ~/.codex e ~/.gemini/config.",
|
||||
"Remove todas as skills de orquestração do Paseo de ~/.agents, ~/.claude e ~/.codex.",
|
||||
choose: "Escolher skills",
|
||||
chooseAll: "Todas as skills",
|
||||
chooseAllHint:
|
||||
@@ -2906,7 +2906,7 @@ export const ptBR: TranslationResources = {
|
||||
chooseEmpty: "Esta versão não inclui skills.",
|
||||
removeTitle: "Remover as skills desmarcadas?",
|
||||
removeMessage:
|
||||
"{{skills}} serão excluídas de ~/.agents, ~/.claude, ~/.codex e ~/.gemini/config. Tudo o que você adicionou dentro dessas pastas de skills também é excluído.",
|
||||
"{{skills}} serão excluídas de ~/.agents, ~/.claude e ~/.codex. Tudo o que você adicionou dentro dessas pastas de skills também é excluído.",
|
||||
saveFailed: "Não foi possível salvar sua seleção de skills.",
|
||||
statusFailed: "Não foi possível verificar o status das skills de orquestração.",
|
||||
updateFailed: "Não foi possível atualizar as skills de orquestração.",
|
||||
|
||||
@@ -2909,7 +2909,7 @@ export const ru: TranslationResources = {
|
||||
updateTitle: "Обновить навыки Paseo?",
|
||||
uninstallTitle: "Удалить навыки Paseo?",
|
||||
uninstallMessage:
|
||||
"Удаляет все навыки оркестрации Paseo из ~/.agents, ~/.claude, ~/.codex и ~/.gemini/config на этом хосте.",
|
||||
"Удаляет все навыки оркестрации Paseo из ~/.agents, ~/.claude и ~/.codex на этом хосте.",
|
||||
choose: "Выбрать навыки",
|
||||
chooseAll: "Все навыки",
|
||||
chooseAllHint: "Устанавливать все встроенные навыки, включая добавленные позже.",
|
||||
@@ -2917,7 +2917,7 @@ export const ru: TranslationResources = {
|
||||
chooseEmpty: "На этом хосте нет встроенных навыков.",
|
||||
removeTitle: "Удалить снятые навыки?",
|
||||
removeMessage:
|
||||
"{{skills}} будут удалены из ~/.agents, ~/.claude, ~/.codex и ~/.gemini/config на этом хосте. Всё, что вы добавили в эти папки навыков, тоже будет удалено.",
|
||||
"{{skills}} будут удалены из ~/.agents, ~/.claude и ~/.codex на этом хосте. Всё, что вы добавили в эти папки навыков, тоже будет удалено.",
|
||||
saveFailed: "Не удалось сохранить выбор навыков.",
|
||||
statusFailed: "Не удалось проверить состояние навыков оркестрации.",
|
||||
updateFailed: "Не удалось обновить навыки оркестрации.",
|
||||
|
||||
@@ -2826,8 +2826,7 @@ export const zhCN: TranslationResources = {
|
||||
updateAvailable: "有更新可用",
|
||||
updateTitle: "更新 Paseo skills?",
|
||||
uninstallTitle: "卸载 Paseo skills?",
|
||||
uninstallMessage:
|
||||
"会从 ~/.agents、~/.claude、~/.codex、~/.gemini/config 移除所有 Paseo 编排 skills。",
|
||||
uninstallMessage: "会从 ~/.agents、~/.claude、~/.codex 移除所有 Paseo 编排 skills。",
|
||||
choose: "选择 skills",
|
||||
chooseAll: "全部 skills",
|
||||
chooseAllHint: "保持安装所有内置 skills,包括以后新增的。",
|
||||
@@ -2835,7 +2834,7 @@ export const zhCN: TranslationResources = {
|
||||
chooseEmpty: "此版本未内置 skills。",
|
||||
removeTitle: "移除取消勾选的 skills?",
|
||||
removeMessage:
|
||||
"将从 ~/.agents、~/.claude、~/.codex、~/.gemini/config 中删除 {{skills}}。你在这些 skill 文件夹里添加的内容也会一并删除。",
|
||||
"将从 ~/.agents、~/.claude、~/.codex 中删除 {{skills}}。你在这些 skill 文件夹里添加的内容也会一并删除。",
|
||||
saveFailed: "无法保存你的 skills 选择。",
|
||||
statusFailed: "无法检查编排 skills 状态。",
|
||||
updateFailed: "无法更新编排 skills。",
|
||||
|
||||
@@ -53,7 +53,7 @@ function preferences(
|
||||
}
|
||||
|
||||
describe("choosePinnedUsageLayout", () => {
|
||||
const widths = { labelsWidth: 200, percentsWidth: 120, windowCount: 2 };
|
||||
const widths = { labelsWidth: 200, compactWidth: 200, percentsWidth: 120, windowCount: 2 };
|
||||
|
||||
it("shows meters only when every window's meter fits beside the labels", () => {
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 240 })).toBe("meters");
|
||||
@@ -64,11 +64,27 @@ describe("choosePinnedUsageLayout", () => {
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 199 })).toBe("percents");
|
||||
});
|
||||
|
||||
it("uses compact period shorthands when full labels overflow but compact labels fit", () => {
|
||||
const scoped = { labelsWidth: 485, compactWidth: 388, percentsWidth: 268, windowCount: 6 };
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 485 })).toBe("labels");
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 399 })).toBe("compact");
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 388 })).toBe("compact");
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 387 })).toBe("percents");
|
||||
});
|
||||
|
||||
it("skips compact mode when no window has a compact label", () => {
|
||||
const noPeriod = { labelsWidth: 220, compactWidth: 120, percentsWidth: 120, windowCount: 2 };
|
||||
expect(choosePinnedUsageLayout({ ...noPeriod, available: 180 })).toBe("percents");
|
||||
});
|
||||
|
||||
it("shows labels until the widths are measured", () => {
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: null })).toBe("labels");
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 999, labelsWidth: null })).toBe(
|
||||
"labels",
|
||||
);
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 999, compactWidth: null })).toBe(
|
||||
"labels",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -145,6 +161,7 @@ describe("resolvePinnedUsage", () => {
|
||||
key: "claude:default/five-hour",
|
||||
label: "Claude Session 31% used",
|
||||
shortLabel: "5h",
|
||||
compactLabel: "5h",
|
||||
percent: 31,
|
||||
percentText: "31%",
|
||||
tone: "default",
|
||||
@@ -153,6 +170,7 @@ describe("resolvePinnedUsage", () => {
|
||||
key: "claude:default/weekly",
|
||||
label: "Claude Weekly 80% used",
|
||||
shortLabel: "wk",
|
||||
compactLabel: "wk",
|
||||
percent: 80,
|
||||
percentText: "80%",
|
||||
tone: "warning",
|
||||
@@ -216,6 +234,52 @@ describe("resolvePinnedUsage", () => {
|
||||
const items = windows([opencode], preferences(null));
|
||||
|
||||
expect(items.map((item) => item.shortLabel)).toEqual([""]);
|
||||
expect(items.map((item) => item.compactLabel)).toEqual([""]);
|
||||
});
|
||||
|
||||
it("extracts bare period tokens as compact labels for scoped or verbose short labels", () => {
|
||||
const mixed = report({
|
||||
sourceId: "mixed",
|
||||
sourceLabel: "Mixed",
|
||||
windows: [
|
||||
{ id: "a", label: "Session", shortLabel: "5h", summary: true, usedPct: 10 },
|
||||
{ id: "b", label: "Weekly · Opus", shortLabel: "wk Opus", summary: true, usedPct: 20 },
|
||||
{
|
||||
id: "c",
|
||||
label: "Code review · Weekly",
|
||||
shortLabel: "Code review wk",
|
||||
summary: true,
|
||||
usedPct: 30,
|
||||
},
|
||||
{
|
||||
id: "d",
|
||||
label: "Gemini Models · Weekly",
|
||||
shortLabel: "Gemini Models weekly",
|
||||
summary: true,
|
||||
usedPct: 40,
|
||||
},
|
||||
{
|
||||
id: "e",
|
||||
label: "Gemini Models · 5h",
|
||||
shortLabel: "Gemini Models 5h",
|
||||
summary: true,
|
||||
usedPct: 50,
|
||||
},
|
||||
{ id: "f", label: "Monthly", shortLabel: "Monthly", summary: true, usedPct: 60 },
|
||||
{ id: "g", label: "Premium requests", summary: true, usedPct: 70 },
|
||||
],
|
||||
});
|
||||
const items = windows([mixed], preferences(null));
|
||||
|
||||
expect(items.map((item) => [item.shortLabel, item.compactLabel])).toEqual([
|
||||
["5h", "5h"],
|
||||
["wk Opus", "wk"],
|
||||
["Code review wk", "wk"],
|
||||
["Gemini Models weekly", "wk"],
|
||||
["Gemini Models 5h", "5h"],
|
||||
["Monthly", "mo"],
|
||||
["Premium requests", ""],
|
||||
]);
|
||||
});
|
||||
|
||||
it("formats the share left when the user reads usage as remaining", () => {
|
||||
|
||||
@@ -18,6 +18,8 @@ export interface PinnedUsageWindow {
|
||||
label: string;
|
||||
/** The window's short name ("5h"), empty for none, or its label when the source sends none. */
|
||||
shortLabel: string;
|
||||
/** Bare period token ("5h", "wk", "mo") used when full short labels overflow the sidebar row. */
|
||||
compactLabel: string;
|
||||
/** The share shown, under the user's used/remaining preference. */
|
||||
percent: number;
|
||||
percentText: string;
|
||||
@@ -34,28 +36,66 @@ export interface PinnedUsageSource {
|
||||
}
|
||||
|
||||
/** How much of each window the one-line summary has room for. */
|
||||
export type PinnedUsageLayout = "meters" | "labels" | "percents";
|
||||
export type PinnedUsageLayout = "meters" | "labels" | "compact" | "percents";
|
||||
|
||||
// A meter narrower than this is a sliver that reads as noise rather than a share.
|
||||
export const MIN_METER_WIDTH = 16;
|
||||
/** The space between a meter and its text. */
|
||||
export const METER_GAP = 4;
|
||||
|
||||
const DURATION_TOKEN_PATTERN = /^\d+[smhd]$/i;
|
||||
|
||||
function normalizePeriodToken(token: string): string | null {
|
||||
const lower = token.toLowerCase();
|
||||
if (lower === "wk" || lower === "weekly") return "wk";
|
||||
if (lower === "mo" || lower === "monthly") return "mo";
|
||||
if (DURATION_TOKEN_PATTERN.test(token)) return lower;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a bare period token ("5h", "wk", "mo") from a window's short label so tight sidebar
|
||||
* rows can keep shorthands visible instead of dropping every label when one window is scoped.
|
||||
*/
|
||||
function compactShortLabel(shortLabel: string): string {
|
||||
const trimmed = shortLabel.trim();
|
||||
if (trimmed === "") return "";
|
||||
const exact = normalizePeriodToken(trimmed);
|
||||
if (exact !== null) return exact;
|
||||
const parts = trimmed.split(/\s+/);
|
||||
if (parts.length > 1) {
|
||||
const first = normalizePeriodToken(parts[0]!);
|
||||
if (first !== null) return first;
|
||||
const last = normalizePeriodToken(parts[parts.length - 1]!);
|
||||
if (last !== null) return last;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The richest layout that fits on one line: every window's meter, else its short label, else its
|
||||
* percent alone. Meters are all or none; a line never mixes them. Until the widths are known it
|
||||
* shows labels, which never flashes meters that turn out not to fit.
|
||||
* bare period shorthand, else its percent alone. Meters are all or none; a line never mixes them.
|
||||
* Until the widths are known it shows labels, which never flashes meters that turn out not to fit.
|
||||
*/
|
||||
export function choosePinnedUsageLayout(input: {
|
||||
available: number | null;
|
||||
labelsWidth: number | null;
|
||||
compactWidth: number | null;
|
||||
percentsWidth: number | null;
|
||||
windowCount: number;
|
||||
}): PinnedUsageLayout {
|
||||
const { available, labelsWidth, percentsWidth, windowCount } = input;
|
||||
if (available === null || labelsWidth === null || percentsWidth === null) return "labels";
|
||||
const { available, labelsWidth, compactWidth, percentsWidth, windowCount } = input;
|
||||
if (
|
||||
available === null ||
|
||||
labelsWidth === null ||
|
||||
compactWidth === null ||
|
||||
percentsWidth === null
|
||||
) {
|
||||
return "labels";
|
||||
}
|
||||
if (labelsWidth + windowCount * (MIN_METER_WIDTH + METER_GAP) <= available) return "meters";
|
||||
if (labelsWidth <= available) return "labels";
|
||||
if (compactWidth <= available && compactWidth > percentsWidth) return "compact";
|
||||
return percentsWidth < labelsWidth ? "percents" : "labels";
|
||||
}
|
||||
|
||||
@@ -85,10 +125,13 @@ export function resolvePinnedUsage(
|
||||
.map((window) => {
|
||||
const percent = displayPercent(window, preferences.displayAs) ?? 0;
|
||||
const percentText = formatPct(percent);
|
||||
const shortLabel =
|
||||
window.shortLabel ?? formatProviderUsageLabel(window.id, window.label, t);
|
||||
return {
|
||||
key: `${entry.id}/${window.id}`,
|
||||
label: `${describe(entry, formatProviderUsageLabel(window.id, window.label, t))} ${formatDisplayPct(percent, preferences.displayAs, undefined, t)}`,
|
||||
shortLabel: window.shortLabel ?? formatProviderUsageLabel(window.id, window.label, t),
|
||||
shortLabel,
|
||||
compactLabel: compactShortLabel(shortLabel),
|
||||
percent,
|
||||
percentText,
|
||||
tone: windowTone(window),
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
resolvePinnedUsage,
|
||||
type PinnedUsageLayout,
|
||||
type PinnedUsageSource,
|
||||
type PinnedUsageWindow,
|
||||
} from "./pinned";
|
||||
import { UsageModal } from "./usage-modal";
|
||||
|
||||
@@ -123,8 +124,8 @@ function layoutWidth(event: LayoutChangeEvent): number {
|
||||
|
||||
/**
|
||||
* One line: each account's icon, then per window a meter and "31% 5h". Off-screen copies measure
|
||||
* the line with labels and with percents alone; the richest layout that fits is shown, and what
|
||||
* it leaves out takes no space at all.
|
||||
* the line with full labels, bare period shorthands, and percents alone; the richest layout that
|
||||
* fits is shown, and what it leaves out takes no space at all.
|
||||
*/
|
||||
function PinnedUsageTrigger({
|
||||
label,
|
||||
@@ -139,6 +140,7 @@ function PinnedUsageTrigger({
|
||||
}) {
|
||||
const [available, setAvailable] = useState<number | null>(null);
|
||||
const [labelsWidth, setLabelsWidth] = useState<number | null>(null);
|
||||
const [compactWidth, setCompactWidth] = useState<number | null>(null);
|
||||
const [percentsWidth, setPercentsWidth] = useState<number | null>(null);
|
||||
const handleAvailableLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setAvailable(layoutWidth(event));
|
||||
@@ -146,12 +148,16 @@ function PinnedUsageTrigger({
|
||||
const handleLabelsLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setLabelsWidth(layoutWidth(event));
|
||||
}, []);
|
||||
const handleCompactLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setCompactWidth(layoutWidth(event));
|
||||
}, []);
|
||||
const handlePercentsLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setPercentsWidth(layoutWidth(event));
|
||||
}, []);
|
||||
const layout = choosePinnedUsageLayout({
|
||||
available,
|
||||
labelsWidth,
|
||||
compactWidth,
|
||||
percentsWidth,
|
||||
windowCount: sources.reduce((count, source) => count + source.windows.length, 0),
|
||||
});
|
||||
@@ -177,6 +183,9 @@ function PinnedUsageTrigger({
|
||||
<View style={styles.measured} onLayout={handleLabelsLayout}>
|
||||
<PinnedUsageLine sources={sources} layout="labels" measuring />
|
||||
</View>
|
||||
<View style={styles.measured} onLayout={handleCompactLayout}>
|
||||
<PinnedUsageLine sources={sources} layout="compact" measuring />
|
||||
</View>
|
||||
<View style={styles.measured} onLayout={handlePercentsLayout}>
|
||||
<PinnedUsageLine sources={sources} layout="percents" measuring />
|
||||
</View>
|
||||
@@ -185,6 +194,12 @@ function PinnedUsageTrigger({
|
||||
);
|
||||
}
|
||||
|
||||
function windowSuffix(window: PinnedUsageWindow, layout: PinnedUsageLayout): string {
|
||||
if (layout === "percents") return "";
|
||||
if (layout === "compact") return window.compactLabel;
|
||||
return window.shortLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* The line's items as direct children of one row, so every meter shares the leftover width
|
||||
* equally.
|
||||
@@ -215,6 +230,7 @@ function PinnedUsageLine({
|
||||
</View>
|
||||
{source.windows.map((window, windowIndex) => {
|
||||
const leadStyle = windowIndex === 0 ? styles.iconGap : styles.windowGap;
|
||||
const suffix = windowSuffix(window, layout);
|
||||
return (
|
||||
<Fragment key={window.key}>
|
||||
{layout === "meters" ? (
|
||||
@@ -228,9 +244,7 @@ function PinnedUsageLine({
|
||||
testID={measuring ? undefined : "sidebar-usage-pinned-window"}
|
||||
>
|
||||
{window.percentText}
|
||||
{layout === "percents" || window.shortLabel === "" ? null : (
|
||||
<Text style={styles.windowLabel}>{` ${window.shortLabel}`}</Text>
|
||||
)}
|
||||
{suffix === "" ? null : <Text style={styles.windowLabel}>{` ${suffix}`}</Text>}
|
||||
</Text>
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
@@ -23,6 +23,8 @@ import { z } from "zod";
|
||||
import type {
|
||||
AcpConfigAccess,
|
||||
AcpConfigChange,
|
||||
AcpConfigureContext,
|
||||
AcpRequest,
|
||||
AcpToolCallSnapshot,
|
||||
AcpTransformer,
|
||||
AcpVendorUpdate,
|
||||
@@ -261,10 +263,10 @@ async function discover(
|
||||
});
|
||||
try {
|
||||
let catalog = await runtime.discover(input.cwd);
|
||||
const config = runtime.configAccess();
|
||||
const context = runtime.configContext();
|
||||
for (const transformer of state.options.transformers ?? []) {
|
||||
if (transformer.discover) {
|
||||
catalog = await transformer.discover(catalog, { sessionId: "catalog", config });
|
||||
catalog = await transformer.discover(catalog, context);
|
||||
}
|
||||
}
|
||||
state.emit({ type: "catalog", requestId: input.requestId, catalog });
|
||||
@@ -902,16 +904,13 @@ class AcpRuntime {
|
||||
this.autoAccept = enableAutoAccept;
|
||||
return;
|
||||
}
|
||||
const access = this.configAccess();
|
||||
const context: AcpConfigureContext = {
|
||||
...this.configContext(),
|
||||
catalog: () => toProviderCatalog(this.modes, this.configOptions),
|
||||
apply: (nativeChange) => this.applyNativeConfigChange(nativeChange),
|
||||
};
|
||||
for (const transformer of this.transformers) {
|
||||
if (
|
||||
(await transformer.configure?.(change, {
|
||||
sessionId: this.options.boundarySessionId,
|
||||
config: access,
|
||||
catalog: () => toProviderCatalog(this.modes, this.configOptions),
|
||||
apply: (nativeChange) => this.applyNativeConfigChange(nativeChange),
|
||||
})) === "handled"
|
||||
) {
|
||||
if ((await transformer.configure?.(change, context)) === "handled") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -951,7 +950,20 @@ class AcpRuntime {
|
||||
this.configOptions = response.configOptions;
|
||||
}
|
||||
|
||||
configAccess(): AcpConfigAccess {
|
||||
configContext() {
|
||||
return {
|
||||
sessionId: this.options.boundarySessionId,
|
||||
config: this.configAccess(),
|
||||
request: this.request,
|
||||
};
|
||||
}
|
||||
|
||||
private readonly request: AcpRequest = async (method, params) =>
|
||||
jsonValue(
|
||||
await this.call(this.connection.extMethod(method, params as Record<string, unknown>)),
|
||||
);
|
||||
|
||||
private configAccess(): AcpConfigAccess {
|
||||
return {
|
||||
read: async () => configValues(this.configOptions),
|
||||
set: async (id, value) => {
|
||||
@@ -989,6 +1001,10 @@ class AcpRuntime {
|
||||
modes: [...config.modes, { ...autoAcceptMode.mode, isUnattended: true }],
|
||||
};
|
||||
}
|
||||
const context = { sessionId: this.options.boundarySessionId };
|
||||
for (const transformer of this.transformers) {
|
||||
config = transformer.config?.(config, context) ?? config;
|
||||
}
|
||||
this.emit({
|
||||
type: "session.config",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
|
||||
@@ -2320,3 +2320,135 @@ describe("ACP session history replay", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("sends extension requests from discovery and configure and preserves JSON-RPC errors", async () => {
|
||||
const { connector, instances } = connectorHarness({
|
||||
handleRequest(instance, request) {
|
||||
if (request.method === "_example/catalog") {
|
||||
instance.respond(request, { model: "vendor-model" });
|
||||
return true;
|
||||
}
|
||||
if (request.method === "_example/select") {
|
||||
instance.reject(request, "Vendor rejected the selection");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "extensions",
|
||||
label: "Extensions",
|
||||
connector,
|
||||
transformers: [
|
||||
{
|
||||
async discover(catalog, { request }) {
|
||||
expect(await request("_example/catalog", { scope: "all" })).toEqual({
|
||||
model: "vendor-model",
|
||||
});
|
||||
return { ...catalog, defaultModel: "vendor-model" };
|
||||
},
|
||||
async configure(change, { request }) {
|
||||
await expect(request("_example/select", { model: change.value })).rejects.toMatchObject({
|
||||
code: -32603,
|
||||
message: "Vendor rejected the selection",
|
||||
});
|
||||
return "handled";
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["session.configure"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send({ type: "catalog", requestId: "catalog" });
|
||||
expect(
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) => event.type === "catalog" || event.type === "request.failed",
|
||||
),
|
||||
).toMatchObject({ type: "catalog", catalog: { defaultModel: "vendor-model" } });
|
||||
expect(instances[1].requests).toContainEqual(
|
||||
expect.objectContaining({
|
||||
method: "_example/catalog",
|
||||
params: { scope: "all" },
|
||||
}),
|
||||
);
|
||||
|
||||
const input = openInput();
|
||||
await connection.send({ ...input, config: { ...input.config, model: "vendor-model" } });
|
||||
expect(
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) => event.type === "session.ready" || event.type === "request.failed",
|
||||
),
|
||||
).toMatchObject({ type: "session.ready" });
|
||||
expect(instances[2].requests).toContainEqual(
|
||||
expect.objectContaining({
|
||||
method: "_example/select",
|
||||
params: { model: "vendor-model" },
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("rewrites the session-ready, notification and configure-commit config snapshots", async () => {
|
||||
const modelOption = {
|
||||
id: "model",
|
||||
name: "Model",
|
||||
category: "model",
|
||||
type: "select",
|
||||
currentValue: "first",
|
||||
options: ["first", "second", "third"].map((value) => ({ name: value, value })),
|
||||
};
|
||||
const { connector, instances } = connectorHarness({ configOptions: [modelOption] });
|
||||
const registration = runAcpProvider({
|
||||
id: "config-transformer",
|
||||
label: "Config Transformer",
|
||||
connector,
|
||||
transformers: [
|
||||
{
|
||||
config(state, { sessionId }) {
|
||||
return { ...state, model: `${sessionId}/${state.model}` };
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["session.configure"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
const models = () =>
|
||||
events.flatMap((event) => (event.type === "session.config" ? [event.config.model] : []));
|
||||
try {
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
expect(models()).toEqual(["session-1/first"]);
|
||||
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "config_option_update",
|
||||
configOptions: [{ ...modelOption, currentValue: "second" }],
|
||||
},
|
||||
});
|
||||
await expect.poll(models).toEqual(["session-1/first", "session-1/second"]);
|
||||
|
||||
await connection.send({
|
||||
type: "session.configure",
|
||||
requestId: "configure",
|
||||
sessionId: "session-1",
|
||||
changes: { model: "third" },
|
||||
});
|
||||
await expect.poll(models).toEqual(["session-1/first", "session-1/second", "session-1/third"]);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,12 +70,17 @@ export interface AcpConfigAccess {
|
||||
set(id: string, value: JsonValue): Promise<void>;
|
||||
}
|
||||
|
||||
/** Sends an ACP extension request to the agent. Rejects with the agent's JSON-RPC error. */
|
||||
export type AcpRequest = (method: string, params: JsonValue) => Promise<JsonValue>;
|
||||
|
||||
export interface AcpDiscoveryContext extends AcpContext {
|
||||
config: AcpConfigAccess;
|
||||
request: AcpRequest;
|
||||
}
|
||||
|
||||
export interface AcpConfigureContext extends AcpContext {
|
||||
config: AcpConfigAccess;
|
||||
request: AcpRequest;
|
||||
catalog(): ProviderCatalog;
|
||||
apply(change: AcpConfigChange): Promise<void>;
|
||||
}
|
||||
@@ -117,6 +122,8 @@ export interface AcpTransformer {
|
||||
context: AcpDiscoveryContext,
|
||||
): Promise<ProviderCatalog> | ProviderCatalog;
|
||||
configure?(change: AcpConfigChange, context: AcpConfigureContext): Promise<"handled" | "pass">;
|
||||
/** Rewrites every session config snapshot before Paseo sees it. */
|
||||
config?(state: ProviderConfigState, context: AcpContext): ProviderConfigState;
|
||||
notification?(
|
||||
notification: { method: string; params: JsonValue },
|
||||
context: AcpContext,
|
||||
|
||||
@@ -814,7 +814,7 @@ describe("checkout PR schemas", () => {
|
||||
});
|
||||
|
||||
test.each(
|
||||
["hopliteProvider", "fxProvider"].flatMap((name) =>
|
||||
["hopliteProvider", "fxProvider", "gooseProvider"].flatMap((name) =>
|
||||
[undefined, false, true].map((value) => [name, value] as const),
|
||||
),
|
||||
)("accepts optional bundled provider capability (%s: %s)", (name, value) => {
|
||||
|
||||
@@ -4151,6 +4151,8 @@ export const ServerInfoStatusPayloadSchema = z
|
||||
hopliteProvider: z.boolean().optional(),
|
||||
// COMPAT(fxProvider): added after v0.15.3, remove after 2027-05-09 once host floor includes the bundled adapter.
|
||||
fxProvider: z.boolean().optional(),
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once host floor includes the bundled adapter.
|
||||
gooseProvider: z.boolean().optional(),
|
||||
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
|
||||
importSessionWorkspaceTarget: z.boolean().optional(),
|
||||
// COMPAT(importSessionSearch): added in v0.8.0, remove gate after 2027-03-02.
|
||||
|
||||
@@ -10175,8 +10175,6 @@ test("a sender's start wait follows its prompt across a stale-session retry", as
|
||||
|
||||
test("a sender's start wait follows its prompt when the session is stale before the wait begins", async () => {
|
||||
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-immediate-stale-start-"));
|
||||
const resumeEntered = deferred<void>();
|
||||
const releaseResume = deferred<void>();
|
||||
class StaleStartSession extends TestAgentSession {
|
||||
override async startTurn(): Promise<{ turnId: string }> {
|
||||
throw new StaleProviderSessionError("stale-bridge");
|
||||
@@ -10186,15 +10184,6 @@ test("a sender's start wait follows its prompt when the session is stale before
|
||||
override async createSession(config: AgentSessionConfig): Promise<AgentSession> {
|
||||
return new StaleStartSession(config);
|
||||
}
|
||||
|
||||
override async resumeSession(
|
||||
handle: AgentPersistenceHandle,
|
||||
config?: Partial<AgentSessionConfig>,
|
||||
): Promise<AgentSession> {
|
||||
resumeEntered.resolve();
|
||||
await releaseResume.promise;
|
||||
return await super.resumeSession(handle, config);
|
||||
}
|
||||
}
|
||||
const client = new StaleStartClient();
|
||||
const storage = new AgentStorage(join(workdir, "agents"), logger);
|
||||
@@ -10207,11 +10196,9 @@ test("a sender's start wait follows its prompt when the session is stale before
|
||||
runOptions: { clientMessageId: "immediate-stale-start" },
|
||||
});
|
||||
// The stale start has failed and been cleared before the sender begins waiting.
|
||||
await resumeEntered.promise;
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
expect(manager.hasInFlightRun(agent.id)).toBe(false);
|
||||
const senderWait = dispatchStarted(dispatch);
|
||||
releaseResume.resolve();
|
||||
await expect(senderWait).resolves.toBeUndefined();
|
||||
await expect(dispatchStarted(dispatch)).resolves.toBeUndefined();
|
||||
await client.waitForRetryStart();
|
||||
expect(manager.getTimeline(agent.id).filter((item) => item.type === "user_message")).toEqual([
|
||||
expect.objectContaining({
|
||||
@@ -10220,7 +10207,6 @@ test("a sender's start wait follows its prompt when the session is stale before
|
||||
}),
|
||||
]);
|
||||
} finally {
|
||||
releaseResume.resolve();
|
||||
manager.prepareForShutdown();
|
||||
await Promise.all(manager.listAgents().map((agent) => manager.closeAgent(agent.id)));
|
||||
await manager.flushForShutdown();
|
||||
|
||||
@@ -2788,3 +2788,29 @@ test("plugin provider import launches with runtime MCP servers and returns only
|
||||
await registry.shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
test("resumes a goose session saved by the generic ACP provider", async () => {
|
||||
const logger = createTestLogger();
|
||||
const harness = createProviderHarness();
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([{ ...harness.registration, id: "goose" }]);
|
||||
const registry = buildProviderRegistry(logger, { pluginProviders: plugins.definitions() });
|
||||
const client = registry.goose.createClient(logger);
|
||||
|
||||
try {
|
||||
const session = await client.resumeSession(
|
||||
{
|
||||
provider: "goose",
|
||||
sessionId: "native-goose-session",
|
||||
nativeHandle: "native-goose-session",
|
||||
},
|
||||
{ provider: "goose", cwd: "/tmp" },
|
||||
);
|
||||
expect(harness.inputs.findLast((input) => input.type === "session.open")).toMatchObject({
|
||||
persistence: { version: 1, data: { sessionId: "native-goose-session" } },
|
||||
});
|
||||
await session.close();
|
||||
} finally {
|
||||
await plugins.shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2174,6 +2174,10 @@ function decodePersistence(handle: AgentPersistenceHandle): ProviderPersistence
|
||||
if (fromMetadata !== undefined) {
|
||||
return ProviderPersistenceSchema.parse(fromMetadata);
|
||||
}
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once legacy handles have migrated.
|
||||
if (handle.provider === "goose" && !handle.sessionId.startsWith("plugin:")) {
|
||||
return { version: 1, data: { sessionId: handle.sessionId } };
|
||||
}
|
||||
return decodePersistenceId(handle.sessionId);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
// Local ACP peer shaped like `goose acp`.
|
||||
const readline = require("node:readline");
|
||||
|
||||
const inventory = {
|
||||
openrouter: { name: "OpenRouter", model: "anthropic/claude-sonnet-4.5" },
|
||||
openai: { name: "OpenAI", model: "gpt-4o" },
|
||||
anthropic: { name: "Anthropic", model: "sonnet" },
|
||||
};
|
||||
let provider = "goose";
|
||||
let model = inventory.openrouter.model;
|
||||
|
||||
const select = (id, currentValue, values) => ({
|
||||
id,
|
||||
name: id,
|
||||
...(id === "model" ? { category: "model" } : {}),
|
||||
type: "select",
|
||||
currentValue,
|
||||
options: values.map((value) => ({ value, name: value })),
|
||||
});
|
||||
const configOptions = () => [
|
||||
select("provider", provider, ["goose", ...Object.keys(inventory)]),
|
||||
select("model", model, [inventory[provider === "goose" ? "openrouter" : provider].model]),
|
||||
];
|
||||
const send = (message) =>
|
||||
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...message }) + "\n");
|
||||
|
||||
readline.createInterface({ input: process.stdin }).on("line", (line) => {
|
||||
const { id, method, params } = JSON.parse(line);
|
||||
if (id === undefined) return;
|
||||
let result;
|
||||
switch (method) {
|
||||
case "initialize":
|
||||
result = { protocolVersion: 1, agentCapabilities: { loadSession: true }, authMethods: [] };
|
||||
break;
|
||||
case "session/new":
|
||||
case "session/load":
|
||||
result = { sessionId: "goose-fixture", configOptions: configOptions() };
|
||||
break;
|
||||
case "_goose/unstable/providers/list":
|
||||
result = {
|
||||
entries: Object.entries(inventory).map(([providerId, entry]) => ({
|
||||
providerId,
|
||||
providerName: entry.name,
|
||||
configured: providerId !== "anthropic",
|
||||
models: [{ id: entry.model, name: entry.model }],
|
||||
})),
|
||||
};
|
||||
break;
|
||||
case "_goose/unstable/config/read":
|
||||
result = {
|
||||
value: params.key === "GOOSE_PROVIDER" ? "openrouter" : inventory.openrouter.model,
|
||||
};
|
||||
break;
|
||||
case "session/set_config_option":
|
||||
if (params.configId === "provider") {
|
||||
provider = params.value;
|
||||
model = inventory[provider === "goose" ? "openrouter" : provider].model;
|
||||
} else if (params.configId === "model") {
|
||||
if (params.value !== inventory[provider === "goose" ? "openrouter" : provider].model) {
|
||||
send({ id, error: { code: -32602, message: "Model unavailable for selected provider" } });
|
||||
return;
|
||||
}
|
||||
model = params.value;
|
||||
}
|
||||
result = { configOptions: configOptions() };
|
||||
break;
|
||||
case "session/prompt":
|
||||
send({
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: params.sessionId,
|
||||
update: {
|
||||
sessionUpdate: "agent_message_chunk",
|
||||
content: { type: "text", text: `${provider}/${model}` },
|
||||
},
|
||||
},
|
||||
});
|
||||
result = { stopReason: "end_turn" };
|
||||
break;
|
||||
case "session/close":
|
||||
result = {};
|
||||
break;
|
||||
default:
|
||||
send({ id, error: { code: -32601, message: "Method not found" } });
|
||||
return;
|
||||
}
|
||||
send({ id, result });
|
||||
});
|
||||
@@ -519,3 +519,60 @@ test("a provider update outlives the client that started it and a new client rea
|
||||
await daemon.close();
|
||||
}
|
||||
}, 60000);
|
||||
|
||||
test("bundled goose lists configured providers and switches models across providers", async () => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-goose-models-"));
|
||||
const daemon = await createTestPaseoDaemon({
|
||||
paseoHomeRoot: root,
|
||||
cleanup: false,
|
||||
mcpEnabled: false,
|
||||
builtinPlugins: new BuiltinPluginLoader(undefined, ["goose-provider"]),
|
||||
});
|
||||
const client = new DaemonClient({
|
||||
url: `ws://127.0.0.1:${daemon.port}/ws`,
|
||||
appVersion: "0.16.0",
|
||||
});
|
||||
const openRouterModel = "openrouter/anthropic/claude-sonnet-4.5";
|
||||
const openAiModel = "openai/gpt-4o";
|
||||
try {
|
||||
await client.connect();
|
||||
await client.fetchAgents({ subscribe: {} });
|
||||
expect(client.getLastServerInfoMessage()?.features?.gooseProvider).toBe(true);
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "goose"),
|
||||
).toBe(false);
|
||||
|
||||
await client.patchDaemonConfig({
|
||||
providers: {
|
||||
goose: {
|
||||
enabled: true,
|
||||
command: [process.execPath, path.resolve(import.meta.dirname, "goose-fixture.cjs")],
|
||||
},
|
||||
},
|
||||
});
|
||||
const catalog = await client.listProviderModels("goose", { cwd: root });
|
||||
expect(catalog.error).toBeNull();
|
||||
expect(catalog.models.map((model) => [model.id, model.isDefault === true])).toEqual([
|
||||
[openRouterModel, true],
|
||||
[openAiModel, false],
|
||||
]);
|
||||
|
||||
const agent = await client.createAgent({ provider: "goose", cwd: root, model: openAiModel });
|
||||
await client.sendMessage(agent.id, "Which provider and model are you running?");
|
||||
expect((await client.waitForFinish(agent.id, 10_000)).status).toBe("idle");
|
||||
await client.setAgentModel(agent.id, openRouterModel);
|
||||
await client.sendMessage(agent.id, "Which provider and model are you running now?");
|
||||
expect((await client.waitForFinish(agent.id, 10_000)).status).toBe("idle");
|
||||
expect((await client.fetchAgent(agent.id))?.agent.model).toBe(openRouterModel);
|
||||
const timeline = await client.fetchAgentTimeline(agent.id, { limit: 100 });
|
||||
expect(
|
||||
timeline.entries.flatMap(({ item }) =>
|
||||
item.type === "assistant_message" ? [item.text] : [],
|
||||
),
|
||||
).toEqual([openAiModel, openRouterModel]);
|
||||
} finally {
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
}, 60_000);
|
||||
|
||||
@@ -22,16 +22,9 @@ import type { SkillSelectionStore } from "./selection-store";
|
||||
import { createSkillsController, type SkillsController } from "./controller";
|
||||
import { beginSkillsTransaction } from "./transaction";
|
||||
|
||||
interface TestSkillTargets extends SkillTargets {
|
||||
agentsDir: string;
|
||||
claudeDir: string;
|
||||
antigravityDir: string;
|
||||
installDirs: string[];
|
||||
}
|
||||
|
||||
interface Harness {
|
||||
root: string;
|
||||
targets: TestSkillTargets;
|
||||
targets: SkillTargets;
|
||||
controller: SkillsController;
|
||||
selectionStore: SkillSelectionStore;
|
||||
}
|
||||
@@ -40,17 +33,11 @@ const BUNDLED_SKILLS = ["paseo", "paseo-advisor", "paseo-loop"];
|
||||
|
||||
async function makeHarness(selectionStore?: SkillSelectionStore): Promise<Harness> {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-skills-controller-"));
|
||||
const agentsDir = path.join(root, "home", ".agents", "skills");
|
||||
const claudeDir = path.join(root, "home", ".claude", "skills");
|
||||
const codexDir = path.join(root, "home", ".codex", "skills");
|
||||
const antigravityDir = path.join(root, "home", ".gemini", "config", "skills");
|
||||
const targets: TestSkillTargets = {
|
||||
const targets: SkillTargets = {
|
||||
sourceDir: path.join(root, "bundle"),
|
||||
installDirs: [agentsDir, claudeDir, antigravityDir],
|
||||
agentsDir,
|
||||
claudeDir,
|
||||
codexDir,
|
||||
antigravityDir,
|
||||
agentsDir: path.join(root, "home", ".agents", "skills"),
|
||||
claudeDir: path.join(root, "home", ".claude", "skills"),
|
||||
codexDir: path.join(root, "home", ".codex", "skills"),
|
||||
};
|
||||
for (const name of BUNDLED_SKILLS) {
|
||||
await mkdir(path.join(targets.sourceDir, name), { recursive: true });
|
||||
@@ -159,26 +146,17 @@ async function installedSkills(dir: string): Promise<string[]> {
|
||||
.sort();
|
||||
}
|
||||
|
||||
async function installedEverywhere(targets: TestSkillTargets): Promise<string[][]> {
|
||||
return Promise.all(
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir, targets.antigravityDir].map(
|
||||
installedSkills,
|
||||
),
|
||||
);
|
||||
async function installedEverywhere(targets: SkillTargets): Promise<string[][]> {
|
||||
return Promise.all([targets.agentsDir, targets.claudeDir, targets.codexDir].map(installedSkills));
|
||||
}
|
||||
|
||||
async function writeUserFile(
|
||||
targets: TestSkillTargets,
|
||||
targets: SkillTargets,
|
||||
skill: string,
|
||||
relativePath: string,
|
||||
contents: string,
|
||||
): Promise<void> {
|
||||
for (const dir of [
|
||||
targets.agentsDir,
|
||||
targets.claudeDir,
|
||||
targets.codexDir,
|
||||
targets.antigravityDir,
|
||||
]) {
|
||||
for (const dir of [targets.agentsDir, targets.claudeDir, targets.codexDir]) {
|
||||
const file = path.join(dir, skill, relativePath);
|
||||
await mkdir(path.dirname(file), { recursive: true });
|
||||
await writeFile(file, contents);
|
||||
@@ -186,33 +164,30 @@ async function writeUserFile(
|
||||
}
|
||||
|
||||
async function readUserFile(
|
||||
targets: TestSkillTargets,
|
||||
targets: SkillTargets,
|
||||
skill: string,
|
||||
relativePath: string,
|
||||
): Promise<Array<string | null>> {
|
||||
return Promise.all(
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir, targets.antigravityDir].map((dir) =>
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir].map((dir) =>
|
||||
readFile(path.join(dir, skill, relativePath), "utf8").catch(() => null),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/** Anything the transaction staged and failed to clean up sits beside the skills tree. */
|
||||
async function backupArtifacts(targets: TestSkillTargets): Promise<string[][]> {
|
||||
async function backupArtifacts(targets: SkillTargets): Promise<string[][]> {
|
||||
return Promise.all(
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir, targets.antigravityDir].map(
|
||||
async (dir) => {
|
||||
const parentEntries = await readdir(path.dirname(dir)).catch(() => []);
|
||||
const rootEntries = await readdir(dir).catch(() => []);
|
||||
return [
|
||||
...parentEntries.filter(
|
||||
(entry) =>
|
||||
entry !== path.basename(dir) && !entry.startsWith(".paseo-skills-recovered-"),
|
||||
),
|
||||
...rootEntries.filter((entry) => entry.startsWith(".paseo-skills-transaction-")),
|
||||
].sort();
|
||||
},
|
||||
),
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir].map(async (dir) => {
|
||||
const parentEntries = await readdir(path.dirname(dir)).catch(() => []);
|
||||
const rootEntries = await readdir(dir).catch(() => []);
|
||||
return [
|
||||
...parentEntries.filter(
|
||||
(entry) => entry !== path.basename(dir) && !entry.startsWith(".paseo-skills-recovered-"),
|
||||
),
|
||||
...rootEntries.filter((entry) => entry.startsWith(".paseo-skills-transaction-")),
|
||||
].sort();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -228,14 +203,14 @@ async function waitForTransactionDirectory(parent: string): Promise<void> {
|
||||
}
|
||||
|
||||
/** Puts a regular file where the agents skills tree goes, so convergence fails with ENOTDIR. */
|
||||
async function blockAgentsDir(targets: TestSkillTargets): Promise<void> {
|
||||
async function blockAgentsDir(targets: SkillTargets): Promise<void> {
|
||||
await rm(targets.agentsDir, { recursive: true, force: true });
|
||||
await mkdir(path.dirname(targets.agentsDir), { recursive: true });
|
||||
await writeFile(targets.agentsDir, "not a directory");
|
||||
}
|
||||
|
||||
async function isInstalled(targets: TestSkillTargets, name: string): Promise<boolean> {
|
||||
const dirs = [targets.agentsDir, targets.claudeDir, targets.antigravityDir];
|
||||
async function isInstalled(targets: SkillTargets, name: string): Promise<boolean> {
|
||||
const dirs = [targets.agentsDir, targets.claudeDir];
|
||||
const present = await Promise.all(
|
||||
dirs.map((dir) =>
|
||||
access(path.join(dir, name))
|
||||
@@ -276,7 +251,7 @@ describe("skills controller", () => {
|
||||
selection: { mode: "custom", skills: ["paseo", "paseo-loop"] },
|
||||
},
|
||||
);
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([[], [], []]);
|
||||
});
|
||||
|
||||
let harness: Harness;
|
||||
@@ -324,7 +299,6 @@ describe("skills controller", () => {
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -481,15 +455,13 @@ describe("skills controller", () => {
|
||||
["paseo", "paseo-loop"],
|
||||
["paseo", "paseo-loop"],
|
||||
["paseo-loop"],
|
||||
["paseo", "paseo-loop"],
|
||||
]);
|
||||
expect(await readUserFile(readOnly.targets, "paseo-loop", "notes/mine.md")).toEqual([
|
||||
"hand written",
|
||||
"hand written",
|
||||
"hand written",
|
||||
"hand written",
|
||||
]);
|
||||
expect(await backupArtifacts(readOnly.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(readOnly.targets)).toEqual([[], [], []]);
|
||||
await rm(readOnly.root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
@@ -510,7 +482,6 @@ describe("skills controller", () => {
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
await rm(readOnly.root, { recursive: true, force: true });
|
||||
});
|
||||
@@ -535,7 +506,6 @@ describe("skills controller", () => {
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
await rm(readOnly.root, { recursive: true, force: true });
|
||||
});
|
||||
@@ -564,13 +534,11 @@ describe("skills controller", () => {
|
||||
"restore this",
|
||||
"restore this",
|
||||
"restore this",
|
||||
"restore this",
|
||||
]);
|
||||
expect(await readUserFile(readOnly.targets, "paseo-loop", "notes/concurrent.md")).toEqual([
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
await rm(readOnly.root, { recursive: true, force: true });
|
||||
});
|
||||
@@ -594,7 +562,6 @@ describe("skills controller", () => {
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
expect(await isInstalled(harness.targets, "paseo-loop")).toBe(true);
|
||||
});
|
||||
@@ -613,7 +580,6 @@ describe("skills controller", () => {
|
||||
harness.targets.agentsDir,
|
||||
harness.targets.claudeDir,
|
||||
harness.targets.codexDir,
|
||||
harness.targets.antigravityDir,
|
||||
].map((root) => path.join(root, "paseo-loop"));
|
||||
for (const live of livePaths) await chmod(live, 0o700);
|
||||
const before = await Promise.all(livePaths.map(lstat));
|
||||
@@ -625,7 +591,7 @@ describe("skills controller", () => {
|
||||
|
||||
const after = await Promise.all(livePaths.map(lstat));
|
||||
expect(after.map((entry) => entry.ino)).toEqual(before.map((entry) => entry.ino));
|
||||
expect(after.map((entry) => entry.mode & 0o777)).toEqual([0o700, 0o700, 0o700, 0o700]);
|
||||
expect(after.map((entry) => entry.mode & 0o777)).toEqual([0o700, 0o700, 0o700]);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -656,9 +622,8 @@ describe("skills controller", () => {
|
||||
"paseo-loop-v1",
|
||||
"paseo-loop-v1",
|
||||
null,
|
||||
"paseo-loop-v1",
|
||||
]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
await expect(harness.controller.status()).resolves.toMatchObject({ selection: previous });
|
||||
});
|
||||
|
||||
@@ -691,9 +656,8 @@ describe("skills controller", () => {
|
||||
"keep this",
|
||||
"keep this",
|
||||
null,
|
||||
"keep this",
|
||||
]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
await expect(harness.controller.status()).resolves.toMatchObject({ selection: previous });
|
||||
});
|
||||
|
||||
@@ -729,7 +693,7 @@ describe("skills controller", () => {
|
||||
expect(
|
||||
await readFile(path.join(harness.targets.codexDir, recovered!, "notes", "mine.md"), "utf8"),
|
||||
).toBe("staged notes");
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
await expect(harness.controller.status()).resolves.toMatchObject({ selection: previous });
|
||||
});
|
||||
|
||||
@@ -768,9 +732,8 @@ describe("skills controller", () => {
|
||||
null,
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
await expect(harness.controller.status()).resolves.toMatchObject({ selection: previous });
|
||||
});
|
||||
|
||||
@@ -812,7 +775,7 @@ describe("skills controller", () => {
|
||||
|
||||
expect(await readFile(entry!.livePath, "utf8")).toBe("external replacement");
|
||||
expect(await readFile(path.join(recovered, "notes", "mine.md"), "utf8")).toBe("captured notes");
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
});
|
||||
|
||||
it("preserves a directory that replaces a captured file before recovery", async () => {
|
||||
@@ -843,7 +806,7 @@ describe("skills controller", () => {
|
||||
expect(
|
||||
await readFile(path.join(path.dirname(harness.targets.agentsDir), recovered!), "utf8"),
|
||||
).toBe("captured file");
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
});
|
||||
|
||||
it.skipIf(process.platform !== "linux")(
|
||||
@@ -852,7 +815,6 @@ describe("skills controller", () => {
|
||||
const crossFilesystemRoot = await mkdtemp("/dev/shm/paseo-skills-controller-");
|
||||
try {
|
||||
harness.targets.claudeDir = path.join(crossFilesystemRoot, "skills");
|
||||
harness.targets.installDirs[1] = harness.targets.claudeDir;
|
||||
const previous: SkillSelection = {
|
||||
mode: "custom",
|
||||
skills: ["paseo", "paseo-loop"],
|
||||
@@ -964,7 +926,6 @@ describe("skills controller", () => {
|
||||
readOnly.targets.agentsDir,
|
||||
readOnly.targets.claudeDir,
|
||||
readOnly.targets.codexDir,
|
||||
readOnly.targets.antigravityDir,
|
||||
]) {
|
||||
const notes = path.join(root, "paseo-loop", "notes");
|
||||
await mkdir(notes, { recursive: true });
|
||||
@@ -985,7 +946,6 @@ describe("skills controller", () => {
|
||||
readOnly.targets.agentsDir,
|
||||
readOnly.targets.claudeDir,
|
||||
readOnly.targets.codexDir,
|
||||
readOnly.targets.antigravityDir,
|
||||
]) {
|
||||
const restored = path.join(root, "paseo-loop", "notes", "latest.md");
|
||||
expect((await lstat(restored)).isSymbolicLink()).toBe(true);
|
||||
@@ -1010,7 +970,6 @@ describe("skills controller", () => {
|
||||
readOnly.targets.agentsDir,
|
||||
readOnly.targets.claudeDir,
|
||||
readOnly.targets.codexDir,
|
||||
readOnly.targets.antigravityDir,
|
||||
]) {
|
||||
await chmod(path.join(root, "paseo-loop", "hooks", "run.sh"), 0o751);
|
||||
}
|
||||
@@ -1028,7 +987,6 @@ describe("skills controller", () => {
|
||||
readOnly.targets.agentsDir,
|
||||
readOnly.targets.claudeDir,
|
||||
readOnly.targets.codexDir,
|
||||
readOnly.targets.antigravityDir,
|
||||
]) {
|
||||
const restored = await lstat(path.join(root, "paseo-loop", "hooks", "run.sh"));
|
||||
expect(restored.mode & 0o777).toBe(0o751);
|
||||
@@ -1040,7 +998,7 @@ describe("skills controller", () => {
|
||||
it("leaves no backup artifacts behind after a successful save", async () => {
|
||||
await harness.controller.save({ mode: "custom", skills: ["paseo"] });
|
||||
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
@@ -1067,7 +1025,7 @@ describe("skills controller", () => {
|
||||
expect(outcome.ok).toBe(true);
|
||||
expect(await gated.store.get()).toEqual(next);
|
||||
await blocked.controller.status();
|
||||
expect(await backupArtifacts(blocked.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(blocked.targets)).toEqual([[], [], []]);
|
||||
await rm(blocked.root, { recursive: true, force: true });
|
||||
},
|
||||
);
|
||||
@@ -1103,7 +1061,6 @@ describe("skills controller", () => {
|
||||
harness.targets.agentsDir,
|
||||
harness.targets.claudeDir,
|
||||
harness.targets.codexDir,
|
||||
harness.targets.antigravityDir,
|
||||
]) {
|
||||
await rm(path.join(root, "paseo-loop"), { recursive: true, force: true });
|
||||
}
|
||||
@@ -1114,9 +1071,8 @@ describe("skills controller", () => {
|
||||
"hand written",
|
||||
"hand written",
|
||||
"hand written",
|
||||
"hand written",
|
||||
]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
});
|
||||
|
||||
it("does not roll back an interrupted transaction after the selection committed", async () => {
|
||||
@@ -1136,7 +1092,6 @@ describe("skills controller", () => {
|
||||
harness.targets.agentsDir,
|
||||
harness.targets.claudeDir,
|
||||
harness.targets.codexDir,
|
||||
harness.targets.antigravityDir,
|
||||
]) {
|
||||
await rm(path.join(root, "paseo-loop"), { recursive: true, force: true });
|
||||
}
|
||||
@@ -1146,7 +1101,7 @@ describe("skills controller", () => {
|
||||
|
||||
expect(snapshot.selection).toEqual(next);
|
||||
expect(await isInstalled(harness.targets, "paseo-loop")).toBe(false);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], []]);
|
||||
});
|
||||
|
||||
it("asks for confirmation naming the directories a save would delete", async () => {
|
||||
@@ -1164,7 +1119,6 @@ describe("skills controller", () => {
|
||||
["paseo", "paseo-advisor", "paseo-loop"],
|
||||
["paseo", "paseo-advisor", "paseo-loop"],
|
||||
["paseo-advisor"],
|
||||
["paseo", "paseo-advisor", "paseo-loop"],
|
||||
]);
|
||||
expect(result.selection).toEqual({ mode: "custom", skills: ["paseo", "paseo-loop"] });
|
||||
});
|
||||
@@ -1180,12 +1134,7 @@ describe("skills controller", () => {
|
||||
|
||||
expect(result.confirmationRequired).toBeNull();
|
||||
expect(result.selection).toEqual({ mode: "custom", skills: ["paseo"] });
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([
|
||||
["paseo"],
|
||||
["paseo"],
|
||||
[],
|
||||
["paseo"],
|
||||
]);
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([["paseo"], ["paseo"], []]);
|
||||
});
|
||||
|
||||
it("asks again when another directory appears before the retry", async () => {
|
||||
@@ -1205,7 +1154,6 @@ describe("skills controller", () => {
|
||||
["paseo", "paseo-advisor", "paseo-chat", "paseo-loop"],
|
||||
["paseo", "paseo-advisor", "paseo-chat", "paseo-loop"],
|
||||
["paseo-chat"],
|
||||
["paseo", "paseo-advisor", "paseo-chat", "paseo-loop"],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -1227,7 +1175,6 @@ describe("skills controller", () => {
|
||||
"hand written",
|
||||
"hand written",
|
||||
"hand written",
|
||||
"hand written",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -1235,12 +1182,7 @@ describe("skills controller", () => {
|
||||
const result = await harness.controller.save({ mode: "custom", skills: ["paseo"] });
|
||||
|
||||
expect(result.confirmationRequired).toBeNull();
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([
|
||||
["paseo"],
|
||||
["paseo"],
|
||||
[],
|
||||
["paseo"],
|
||||
]);
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([["paseo"], ["paseo"], []]);
|
||||
});
|
||||
|
||||
it("preserves a regular file at a skill path when save convergence fails", async () => {
|
||||
@@ -1253,131 +1195,6 @@ describe("skills controller", () => {
|
||||
expect(await readFile(collision, "utf8")).toBe("keep this file");
|
||||
});
|
||||
|
||||
it("rolls back earlier targets when writing to Antigravity fails", async () => {
|
||||
await mkdir(harness.targets.antigravityDir, { recursive: true });
|
||||
const collision = path.join(harness.targets.antigravityDir, "paseo");
|
||||
await writeFile(collision, "keep this file");
|
||||
|
||||
await expect(harness.controller.save({ mode: "custom", skills: ["paseo"] })).rejects.toThrow();
|
||||
|
||||
expect(await readFile(collision, "utf8")).toBe("keep this file");
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
});
|
||||
|
||||
it("rolls back cleanly without locking later calls when an Antigravity parent is a file", async () => {
|
||||
const geminiConfig = path.dirname(harness.targets.antigravityDir);
|
||||
await mkdir(path.dirname(geminiConfig), { recursive: true });
|
||||
await writeFile(geminiConfig, "not a directory");
|
||||
|
||||
await expect(harness.controller.save({ mode: "custom", skills: ["paseo"] })).rejects.toThrow();
|
||||
|
||||
expect(await readFile(geminiConfig, "utf8")).toBe("not a directory");
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
await expect(harness.controller.status()).resolves.toMatchObject({
|
||||
state: "not-installed",
|
||||
selection: { mode: "all" },
|
||||
});
|
||||
await expect(harness.controller.uninstall()).resolves.toMatchObject({
|
||||
state: "not-installed",
|
||||
});
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
"rolls back cleanly and still updates other targets when ~/.gemini is unwritable",
|
||||
async () => {
|
||||
const geminiHome = path.dirname(path.dirname(harness.targets.antigravityDir));
|
||||
await mkdir(geminiHome, { recursive: true });
|
||||
await chmod(geminiHome, 0o000);
|
||||
try {
|
||||
await expect(
|
||||
harness.controller.save({ mode: "custom", skills: ["paseo"] }),
|
||||
).rejects.toThrow();
|
||||
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([[], [], [], []]);
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
await expect(harness.controller.status()).resolves.toMatchObject({
|
||||
state: "not-installed",
|
||||
selection: { mode: "all" },
|
||||
});
|
||||
} finally {
|
||||
await chmod(geminiHome, 0o755);
|
||||
}
|
||||
|
||||
// Install v1 everywhere, remove ~/.gemini/config so ~/.gemini (0555) blocks
|
||||
// Antigravity writes with EACCES, then upgrade bundle to v2 and autoUpdate.
|
||||
await harness.controller.install();
|
||||
await rm(path.dirname(harness.targets.antigravityDir), { recursive: true, force: true });
|
||||
for (const name of BUNDLED_SKILLS) {
|
||||
await writeFile(path.join(harness.targets.sourceDir, name, "SKILL.md"), `${name}-v2`);
|
||||
}
|
||||
await chmod(geminiHome, 0o555);
|
||||
try {
|
||||
await expect(harness.controller.autoUpdate()).rejects.toThrow();
|
||||
for (const root of [harness.targets.agentsDir, harness.targets.claudeDir]) {
|
||||
for (const name of BUNDLED_SKILLS) {
|
||||
expect(await readFile(path.join(root, name, "SKILL.md"), "utf8")).toBe(`${name}-v2`);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
await chmod(geminiHome, 0o755);
|
||||
}
|
||||
|
||||
// With ~/.gemini unreadable (0000), uninstall still removes every skill from healthy targets.
|
||||
await chmod(geminiHome, 0o000);
|
||||
try {
|
||||
await expect(harness.controller.uninstall()).rejects.toThrow();
|
||||
expect(await installedSkills(harness.targets.agentsDir)).toEqual([]);
|
||||
expect(await installedSkills(harness.targets.claudeDir)).toEqual([]);
|
||||
} finally {
|
||||
await chmod(geminiHome, 0o755);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it("recovers a pre-upgrade transaction manifest that recorded codex at root index 2", async () => {
|
||||
const previous: SkillSelection = { mode: "custom", skills: ["paseo"] };
|
||||
const next: SkillSelection = { mode: "all" };
|
||||
await harness.controller.save(previous);
|
||||
|
||||
const transactionDir = path.join(
|
||||
path.dirname(harness.targets.agentsDir),
|
||||
".paseo-skills-transaction-legacy-codex-index",
|
||||
);
|
||||
const codexBackup = path.join(transactionDir, "backup", "2", "paseo");
|
||||
await mkdir(path.join(codexBackup, "notes"), { recursive: true });
|
||||
await writeFile(path.join(codexBackup, "notes", "codex.md"), "restored codex note");
|
||||
await writeFile(
|
||||
path.join(transactionDir, "transaction.json"),
|
||||
`${JSON.stringify(
|
||||
{
|
||||
owner: "paseo-skills-transaction",
|
||||
version: 1,
|
||||
phase: "converging",
|
||||
previousSelection: previous,
|
||||
nextSelection: next,
|
||||
entries: [
|
||||
{
|
||||
livePath: path.join(harness.targets.codexDir, "paseo"),
|
||||
kind: "update",
|
||||
backupPath: path.join("backup", "2", "paseo"),
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
)}\n`,
|
||||
);
|
||||
|
||||
await harness.controller.status();
|
||||
|
||||
expect(
|
||||
await readFile(path.join(harness.targets.codexDir, "paseo", "notes", "codex.md"), "utf8"),
|
||||
).toBe("restored codex note");
|
||||
expect(await backupArtifacts(harness.targets)).toEqual([[], [], [], []]);
|
||||
});
|
||||
|
||||
it("serializes startup convergence with an interactive save", async () => {
|
||||
await harness.controller.install();
|
||||
// Startup finds drift it wants to repair while the user narrows the
|
||||
@@ -1397,12 +1214,7 @@ describe("skills controller", () => {
|
||||
]);
|
||||
|
||||
expect(saved.selection).toEqual({ mode: "custom", skills: ["paseo"] });
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([
|
||||
["paseo"],
|
||||
["paseo"],
|
||||
[],
|
||||
["paseo"],
|
||||
]);
|
||||
expect(await installedEverywhere(harness.targets)).toEqual([["paseo"], ["paseo"], []]);
|
||||
expect(await harness.controller.status()).toEqual({
|
||||
state: "up-to-date",
|
||||
ops: [],
|
||||
@@ -1435,7 +1247,6 @@ describe("skills controller", () => {
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
"keep this",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,31 +21,18 @@ function only(...skills: string[]): SkillSelection {
|
||||
return { mode: "custom", skills };
|
||||
}
|
||||
|
||||
interface TestSkillTargets extends SkillTargets {
|
||||
agentsDir: string;
|
||||
claudeDir: string;
|
||||
antigravityDir: string;
|
||||
installDirs: string[];
|
||||
}
|
||||
|
||||
interface Sandbox {
|
||||
root: string;
|
||||
targets: TestSkillTargets;
|
||||
targets: SkillTargets;
|
||||
}
|
||||
|
||||
async function makeSandbox(): Promise<Sandbox> {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "paseo-skills-"));
|
||||
const agentsDir = path.join(root, "home", ".agents", "skills");
|
||||
const claudeDir = path.join(root, "home", ".claude", "skills");
|
||||
const codexDir = path.join(root, "home", ".codex", "skills");
|
||||
const antigravityDir = path.join(root, "home", ".gemini", "config", "skills");
|
||||
const targets: TestSkillTargets = {
|
||||
const targets: SkillTargets = {
|
||||
sourceDir: path.join(root, "bundle"),
|
||||
installDirs: [agentsDir, claudeDir, antigravityDir],
|
||||
agentsDir,
|
||||
claudeDir,
|
||||
codexDir,
|
||||
antigravityDir,
|
||||
agentsDir: path.join(root, "home", ".agents", "skills"),
|
||||
claudeDir: path.join(root, "home", ".claude", "skills"),
|
||||
codexDir: path.join(root, "home", ".codex", "skills"),
|
||||
};
|
||||
await fs.mkdir(targets.sourceDir, { recursive: true });
|
||||
return { root, targets };
|
||||
@@ -76,7 +63,7 @@ async function writeOnDiskSkill(
|
||||
}
|
||||
|
||||
async function writeOnDiskSkillToAllTargets(
|
||||
targets: TestSkillTargets,
|
||||
targets: SkillTargets,
|
||||
name: string,
|
||||
files: Record<string, string>,
|
||||
): Promise<void> {
|
||||
@@ -84,7 +71,6 @@ async function writeOnDiskSkillToAllTargets(
|
||||
writeOnDiskSkill(targets.agentsDir, name, files),
|
||||
writeOnDiskSkill(targets.claudeDir, name, files),
|
||||
writeOnDiskSkill(targets.codexDir, name, files),
|
||||
writeOnDiskSkill(targets.antigravityDir, name, files),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -100,9 +86,9 @@ async function pathExists(p: string): Promise<boolean> {
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
async function installedIn(targets: TestSkillTargets, name: string): Promise<boolean[]> {
|
||||
async function installedIn(targets: SkillTargets, name: string): Promise<boolean[]> {
|
||||
return Promise.all(
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir, targets.antigravityDir].map((dir) =>
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir].map((dir) =>
|
||||
pathExists(path.join(dir, name)),
|
||||
),
|
||||
);
|
||||
@@ -210,10 +196,6 @@ describe("getSkillsStatus", () => {
|
||||
"SKILL.md": "paseo-v1",
|
||||
"hooks/guard.sh": "user guard",
|
||||
});
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "paseo", {
|
||||
"SKILL.md": "paseo-v1",
|
||||
"notes/local.md": "user notes",
|
||||
});
|
||||
|
||||
const status = await getSkillsStatus(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
@@ -230,7 +212,6 @@ describe("getSkillsStatus", () => {
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "paseo", { "SKILL.md": "stale" });
|
||||
await writeOnDiskSkill(sandbox.targets.claudeDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.codexDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkillToAllTargets(sandbox.targets, "paseo-loop", { "SKILL.md": "loop-v1" });
|
||||
|
||||
const status = await getSkillsStatus(sandbox.targets, ALL_SKILLS);
|
||||
@@ -247,8 +228,6 @@ describe("getSkillsStatus", () => {
|
||||
await writeOnDiskSkill(sandbox.targets.claudeDir, "paseo-loop", { "SKILL.md": "loop-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.codexDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.codexDir, "paseo-loop", { "SKILL.md": "loop-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "paseo-loop", { "SKILL.md": "loop-v1" });
|
||||
|
||||
const status = await getSkillsStatus(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
@@ -256,35 +235,6 @@ describe("getSkillsStatus", () => {
|
||||
expect(status.ops).toEqual([{ kind: "update", name: "paseo" }]);
|
||||
});
|
||||
|
||||
it("returns drift when Antigravity is missing or stale", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "paseo-loop", { "SKILL.md": "loop-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.claudeDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.claudeDir, "paseo-loop", { "SKILL.md": "loop-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "paseo", { "SKILL.md": "stale" });
|
||||
|
||||
const status = await getSkillsStatus(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
expect(status.state).toBe("drift");
|
||||
expect(status.ops).toEqual([
|
||||
{ kind: "update", name: "paseo" },
|
||||
{ kind: "add", name: "paseo-loop" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns not-installed when only user-personal skills exist in Antigravity", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "my-agy-skill", {
|
||||
"SKILL.md": "user-agy",
|
||||
});
|
||||
|
||||
const status = await getSkillsStatus(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
expect(status.state).toBe("not-installed");
|
||||
expect(status.installed).toEqual([]);
|
||||
});
|
||||
|
||||
it("returns drift with add ops for the bundled skills missing from disk", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await writeOnDiskSkillToAllTargets(sandbox.targets, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
@@ -312,7 +262,6 @@ describe("getSkillsStatus", () => {
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "paseo", { "SKILL.md": "stale" });
|
||||
await writeOnDiskSkill(sandbox.targets.claudeDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.codexDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "paseo", { "SKILL.md": "paseo-v1" });
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "paseo-chat", { "SKILL.md": "chat-old" });
|
||||
|
||||
const status = await getSkillsStatus(sandbox.targets, ALL_SKILLS);
|
||||
@@ -350,14 +299,9 @@ describe("custom skill selection", () => {
|
||||
available: ["paseo", "paseo-advisor", "paseo-loop"],
|
||||
installed: ["paseo", "paseo-loop"],
|
||||
});
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([true, true, false, true]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-loop")).toEqual([true, true, false, true]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-advisor")).toEqual([
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
]);
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([true, true, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-loop")).toEqual([true, true, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-advisor")).toEqual([false, false, false]);
|
||||
});
|
||||
|
||||
it("reports up-to-date while an unselected bundled skill is absent", async () => {
|
||||
@@ -379,14 +323,9 @@ describe("custom skill selection", () => {
|
||||
const status = await installSkills(sandbox.targets, only("paseo"));
|
||||
|
||||
expect(status.state).toBe("up-to-date");
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([true, true, false, true]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-loop")).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-advisor")).toEqual([
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
]);
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([true, true, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-loop")).toEqual([false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-advisor")).toEqual([false, false, false]);
|
||||
});
|
||||
|
||||
it("reports a delete op for a deselected skill before it is applied", async () => {
|
||||
@@ -400,21 +339,12 @@ describe("custom skill selection", () => {
|
||||
|
||||
it("leaves unrelated user skills untouched", async () => {
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "unslop", { "SKILL.md": "user-unslop" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "custom-agy", {
|
||||
"SKILL.md": "user-agy",
|
||||
});
|
||||
|
||||
await installSkills(sandbox.targets, only("paseo"));
|
||||
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.agentsDir, "unslop", "SKILL.md"), "utf-8"),
|
||||
).toBe("user-unslop");
|
||||
expect(
|
||||
await fs.readFile(
|
||||
path.join(sandbox.targets.antigravityDir, "custom-agy", "SKILL.md"),
|
||||
"utf-8",
|
||||
),
|
||||
).toBe("user-agy");
|
||||
});
|
||||
|
||||
it("treats an empty custom selection as no managed skills installed", async () => {
|
||||
@@ -428,8 +358,8 @@ describe("custom skill selection", () => {
|
||||
available: ["paseo", "paseo-advisor", "paseo-loop"],
|
||||
installed: [],
|
||||
});
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-loop")).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-loop")).toEqual([false, false, false]);
|
||||
});
|
||||
|
||||
it("ignores selected names that the bundle does not ship", async () => {
|
||||
@@ -441,7 +371,7 @@ describe("custom skill selection", () => {
|
||||
available: ["paseo", "paseo-advisor", "paseo-loop"],
|
||||
installed: ["paseo"],
|
||||
});
|
||||
expect(await installedIn(sandbox.targets, "not-a-skill")).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "not-a-skill")).toEqual([false, false, false]);
|
||||
});
|
||||
|
||||
it("still deletes legacy skill names that are not selectable", async () => {
|
||||
@@ -451,12 +381,7 @@ describe("custom skill selection", () => {
|
||||
|
||||
await installSkills(sandbox.targets, only("paseo"));
|
||||
|
||||
expect(await installedIn(sandbox.targets, "paseo-orchestrator")).toEqual([
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-orchestrator")).toEqual([false, false, false]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -471,12 +396,9 @@ describe("installSkills / updateSkills", () => {
|
||||
await fs.rm(sandbox.root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("installs into shared, Claude, and Antigravity roots without duplicating Codex discovery", async () => {
|
||||
it("installs into shared and Claude roots without duplicating Codex discovery", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, "unslop", { "SKILL.md": "user-unslop" });
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "custom-agy", {
|
||||
"SKILL.md": "user-agy",
|
||||
});
|
||||
|
||||
const status = await installSkills(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
@@ -487,25 +409,15 @@ describe("installSkills / updateSkills", () => {
|
||||
installed: ["paseo", "paseo-loop"],
|
||||
});
|
||||
for (const name of ["paseo", "paseo-loop"]) {
|
||||
const expected = name === "paseo" ? "paseo-v1" : "loop-v1";
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.agentsDir, name, "SKILL.md"), "utf-8"),
|
||||
).toBe(expected);
|
||||
).toBe(name === "paseo" ? "paseo-v1" : "loop-v1");
|
||||
expect(await pathExists(path.join(sandbox.targets.codexDir, name, "SKILL.md"))).toBe(false);
|
||||
expect(await pathExists(path.join(sandbox.targets.claudeDir, name))).toBe(true);
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.antigravityDir, name, "SKILL.md"), "utf-8"),
|
||||
).toBe(expected);
|
||||
}
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.agentsDir, "unslop", "SKILL.md"), "utf-8"),
|
||||
).toBe("user-unslop");
|
||||
expect(
|
||||
await fs.readFile(
|
||||
path.join(sandbox.targets.antigravityDir, "custom-agy", "SKILL.md"),
|
||||
"utf-8",
|
||||
),
|
||||
).toBe("user-agy");
|
||||
});
|
||||
|
||||
it("retires unchanged managed Codex copies while preserving personal files", async () => {
|
||||
@@ -557,23 +469,14 @@ describe("installSkills / updateSkills", () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ alias: "codex", target: "agents", expected: [true, true, true, true] },
|
||||
{ alias: "codex", target: "claude", expected: [true, true, true, true] },
|
||||
{ alias: "claude", target: "codex", expected: [true, true, true, true] },
|
||||
{ alias: "codex", target: "antigravity", expected: [true, true, true, true] },
|
||||
{ alias: "antigravity", target: "codex", expected: [true, true, true, true] },
|
||||
{ alias: "antigravity", target: "agents", expected: [true, true, false, true] },
|
||||
{ alias: "antigravity", target: "claude", expected: [true, true, false, true] },
|
||||
{ alias: "codex", target: "agents" },
|
||||
{ alias: "codex", target: "claude" },
|
||||
{ alias: "claude", target: "codex" },
|
||||
] as const)(
|
||||
"keeps installed skills when the $alias root links to the $target root",
|
||||
async ({ alias, target, expected }) => {
|
||||
async ({ alias, target }) => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
const rootOf = {
|
||||
agents: "agentsDir",
|
||||
claude: "claudeDir",
|
||||
codex: "codexDir",
|
||||
antigravity: "antigravityDir",
|
||||
} as const;
|
||||
const rootOf = { agents: "agentsDir", claude: "claudeDir", codex: "codexDir" } as const;
|
||||
const aliasRoot = sandbox.targets[rootOf[alias]];
|
||||
const targetRoot = sandbox.targets[rootOf[target]];
|
||||
await fs.mkdir(targetRoot, { recursive: true });
|
||||
@@ -585,36 +488,12 @@ describe("installSkills / updateSkills", () => {
|
||||
|
||||
expect(installed.state).toBe("up-to-date");
|
||||
expect(updated.state).toBe("up-to-date");
|
||||
expect((await fs.lstat(aliasRoot)).isSymbolicLink()).toBe(true);
|
||||
for (const name of ["paseo", "paseo-loop"]) {
|
||||
expect(await installedIn(sandbox.targets, name)).toEqual([...expected]);
|
||||
expect(await installedIn(sandbox.targets, name)).toEqual([true, true, true]);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it("keeps an installed skill when its Antigravity directory links to the shared copy", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await fs.mkdir(path.join(sandbox.targets.agentsDir, "paseo"), { recursive: true });
|
||||
await fs.mkdir(sandbox.targets.antigravityDir, { recursive: true });
|
||||
await fs.symlink(
|
||||
path.join(sandbox.targets.agentsDir, "paseo"),
|
||||
path.join(sandbox.targets.antigravityDir, "paseo"),
|
||||
"dir",
|
||||
);
|
||||
|
||||
const installed = await installSkills(sandbox.targets, ALL_SKILLS);
|
||||
const updated = await autoUpdateInstalledSkills(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
expect(installed.state).toBe("up-to-date");
|
||||
expect(updated.state).toBe("up-to-date");
|
||||
expect(
|
||||
(await fs.lstat(path.join(sandbox.targets.antigravityDir, "paseo"))).isSymbolicLink(),
|
||||
).toBe(true);
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.antigravityDir, "paseo", "SKILL.md"), "utf8"),
|
||||
).toBe("paseo-v1");
|
||||
});
|
||||
|
||||
it("keeps an installed skill when its Codex directory links to the shared copy", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await fs.mkdir(path.join(sandbox.targets.agentsDir, "paseo"), { recursive: true });
|
||||
@@ -725,15 +604,6 @@ describe("installSkills / updateSkills", () => {
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.claudeDir, "paseo-loop", "SKILL.md"), "utf-8"),
|
||||
).toBe("loop-v1");
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.antigravityDir, "paseo", "SKILL.md"), "utf-8"),
|
||||
).toBe("paseo-v1");
|
||||
expect(
|
||||
await fs.readFile(
|
||||
path.join(sandbox.targets.antigravityDir, "paseo-loop", "SKILL.md"),
|
||||
"utf-8",
|
||||
),
|
||||
).toBe("loop-v1");
|
||||
});
|
||||
|
||||
it("auto-updates drifted installed skills", async () => {
|
||||
@@ -756,9 +626,6 @@ describe("installSkills / updateSkills", () => {
|
||||
"utf-8",
|
||||
),
|
||||
).toBe("user guard");
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.antigravityDir, "paseo", "SKILL.md"), "utf-8"),
|
||||
).toBe("paseo-v1");
|
||||
});
|
||||
|
||||
it("does not auto-install skills on a clean machine", async () => {
|
||||
@@ -775,7 +642,7 @@ describe("installSkills / updateSkills", () => {
|
||||
available: ["paseo", "paseo-loop"],
|
||||
installed: [],
|
||||
});
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo")).toEqual([false, false, false]);
|
||||
});
|
||||
|
||||
it("is idempotent — running install twice keeps state at up-to-date", async () => {
|
||||
@@ -800,51 +667,24 @@ describe("uninstallSkills", () => {
|
||||
await fs.rm(sandbox.root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("removes every Paseo skill from all targets and preserves user dirs and symlinks", async () => {
|
||||
it("removes every Paseo skill from all three targets and preserves user dirs", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
await installSkills(sandbox.targets, ALL_SKILLS);
|
||||
for (const name of ["unslop", "tdd", "devbox"]) {
|
||||
await writeOnDiskSkill(sandbox.targets.agentsDir, name, { "SKILL.md": `user-${name}` });
|
||||
}
|
||||
await writeOnDiskSkill(sandbox.targets.antigravityDir, "user-agy-skill", {
|
||||
"SKILL.md": "user-agy",
|
||||
});
|
||||
const linkedSource = path.join(sandbox.root, "external-user-skill");
|
||||
await writeFiles(linkedSource, { "SKILL.md": "linked-user-skill" });
|
||||
await fs.symlink(
|
||||
linkedSource,
|
||||
path.join(sandbox.targets.antigravityDir, "linked-user-skill"),
|
||||
"dir",
|
||||
);
|
||||
|
||||
const status = await uninstallSkills(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
expect(status.state).toBe("not-installed");
|
||||
for (const name of ["paseo", "paseo-loop", ...LEGACY_SKILL_NAMES]) {
|
||||
expect(await installedIn(sandbox.targets, name)).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, name)).toEqual([false, false, false]);
|
||||
}
|
||||
for (const name of ["unslop", "tdd", "devbox"]) {
|
||||
expect(
|
||||
await fs.readFile(path.join(sandbox.targets.agentsDir, name, "SKILL.md"), "utf-8"),
|
||||
).toBe(`user-${name}`);
|
||||
}
|
||||
expect(
|
||||
await fs.readFile(
|
||||
path.join(sandbox.targets.antigravityDir, "user-agy-skill", "SKILL.md"),
|
||||
"utf-8",
|
||||
),
|
||||
).toBe("user-agy");
|
||||
expect(
|
||||
(
|
||||
await fs.lstat(path.join(sandbox.targets.antigravityDir, "linked-user-skill"))
|
||||
).isSymbolicLink(),
|
||||
).toBe(true);
|
||||
expect(
|
||||
await fs.readFile(
|
||||
path.join(sandbox.targets.antigravityDir, "linked-user-skill", "SKILL.md"),
|
||||
"utf-8",
|
||||
),
|
||||
).toBe("linked-user-skill");
|
||||
});
|
||||
|
||||
it("is a no-op when nothing is installed", async () => {
|
||||
@@ -855,13 +695,12 @@ describe("uninstallSkills", () => {
|
||||
expect(status.state).toBe("not-installed");
|
||||
});
|
||||
|
||||
it("cleans up legacy skill names that linger in agents, claude, codex, and antigravity", async () => {
|
||||
it("cleans up legacy skill names that linger in agents, claude, and codex", async () => {
|
||||
await writeCurrentBundle(sandbox.targets.sourceDir);
|
||||
for (const dir of [
|
||||
sandbox.targets.agentsDir,
|
||||
sandbox.targets.claudeDir,
|
||||
sandbox.targets.codexDir,
|
||||
sandbox.targets.antigravityDir,
|
||||
]) {
|
||||
await writeOnDiskSkill(dir, "paseo-chat", { "SKILL.md": "chat-old" });
|
||||
}
|
||||
@@ -869,6 +708,6 @@ describe("uninstallSkills", () => {
|
||||
const status = await uninstallSkills(sandbox.targets, ALL_SKILLS);
|
||||
|
||||
expect(status.state).toBe("not-installed");
|
||||
expect(await installedIn(sandbox.targets, "paseo-chat")).toEqual([false, false, false, false]);
|
||||
expect(await installedIn(sandbox.targets, "paseo-chat")).toEqual([false, false, false]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,12 +35,8 @@ export interface SkillsStatus {
|
||||
|
||||
export interface SkillTargets {
|
||||
sourceDir: string;
|
||||
/**
|
||||
* Ordered active install roots. Append new roots to the end so transaction
|
||||
* backup indices remain stable across daemon upgrades.
|
||||
*/
|
||||
installDirs: readonly string[];
|
||||
/** Legacy dedicated Codex root, retired on sync unless it aliases an install root. */
|
||||
agentsDir: string;
|
||||
claudeDir: string;
|
||||
codexDir: string;
|
||||
}
|
||||
|
||||
@@ -167,11 +163,13 @@ export async function getSkillsStatus(
|
||||
): Promise<SkillsStatus> {
|
||||
const available = await listBundledSkills(targets.sourceDir);
|
||||
const names = managedSkillNames(available);
|
||||
const [bundle, codexDisk, ...disks] = await Promise.all([
|
||||
const [bundle, agentsDisk, claudeDisk, codexDisk] = await Promise.all([
|
||||
hashSkills(targets.sourceDir, available),
|
||||
hashSkills(targets.agentsDir, names),
|
||||
hashSkills(targets.claudeDir, names),
|
||||
hashSkills(targets.codexDir, names),
|
||||
...targets.installDirs.map((root) => hashSkills(root, names)),
|
||||
]);
|
||||
const disks = [agentsDisk, claudeDisk];
|
||||
const desired = resolveDesiredSkills(selection, available);
|
||||
const ops = diff(bundle, disks, names, desired);
|
||||
for (const name of codexDisk.keys()) {
|
||||
@@ -205,7 +203,8 @@ async function applySkills(
|
||||
if (writes.length > 0) {
|
||||
await syncSkills({
|
||||
sourceDir: targets.sourceDir,
|
||||
installDirs: targets.installDirs,
|
||||
agentsDir: targets.agentsDir,
|
||||
claudeDir: targets.claudeDir,
|
||||
codexDir: targets.codexDir,
|
||||
skillNames: writes,
|
||||
});
|
||||
@@ -214,7 +213,8 @@ async function applySkills(
|
||||
for (const op of status.ops) {
|
||||
if (op.kind !== "delete") continue;
|
||||
await removeSkill(op.name, {
|
||||
installDirs: targets.installDirs,
|
||||
agentsDir: targets.agentsDir,
|
||||
claudeDir: targets.claudeDir,
|
||||
codexDir: targets.codexDir,
|
||||
});
|
||||
}
|
||||
@@ -259,21 +259,12 @@ export async function uninstallSkills(
|
||||
selection: SkillSelection,
|
||||
): Promise<SkillsStatus> {
|
||||
const available = await listBundledSkills(targets.sourceDir);
|
||||
let hasError = false;
|
||||
let firstError: unknown = null;
|
||||
for (const name of managedSkillNames(available)) {
|
||||
try {
|
||||
await removeSkill(name, {
|
||||
installDirs: targets.installDirs,
|
||||
codexDir: targets.codexDir,
|
||||
});
|
||||
} catch (error) {
|
||||
if (!hasError) {
|
||||
hasError = true;
|
||||
firstError = error;
|
||||
}
|
||||
}
|
||||
await removeSkill(name, {
|
||||
agentsDir: targets.agentsDir,
|
||||
claudeDir: targets.claudeDir,
|
||||
codexDir: targets.codexDir,
|
||||
});
|
||||
}
|
||||
if (hasError) throw firstError;
|
||||
return getSkillsStatus(targets, selection);
|
||||
}
|
||||
|
||||
@@ -45,11 +45,8 @@ describe("orchestration skill paths", () => {
|
||||
const home = os.homedir();
|
||||
|
||||
expect(resolveSkillTargets()).toMatchObject({
|
||||
installDirs: [
|
||||
path.join(home, ".agents", "skills"),
|
||||
path.join(home, ".claude", "skills"),
|
||||
path.join(home, ".gemini", "config", "skills"),
|
||||
],
|
||||
agentsDir: path.join(home, ".agents", "skills"),
|
||||
claudeDir: path.join(home, ".claude", "skills"),
|
||||
codexDir: path.join(home, ".codex", "skills"),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,13 +17,8 @@ export function resolveBundledSkillsDir(moduleUrl: string | URL = import.meta.ur
|
||||
export function resolveSkillTargets(home: string = os.homedir()): SkillTargets {
|
||||
return {
|
||||
sourceDir: resolveBundledSkillsDir(),
|
||||
// Append new install roots to the end — transaction backups reference roots
|
||||
// by index, so existing positions must remain stable across upgrades.
|
||||
installDirs: [
|
||||
path.join(home, ".agents", "skills"),
|
||||
path.join(home, ".claude", "skills"),
|
||||
path.join(home, ".gemini", "config", "skills"),
|
||||
],
|
||||
agentsDir: path.join(home, ".agents", "skills"),
|
||||
claudeDir: path.join(home, ".claude", "skills"),
|
||||
codexDir: path.join(home, ".codex", "skills"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ interface Sandbox {
|
||||
agentsDir: string;
|
||||
claudeDir: string;
|
||||
codexDir: string;
|
||||
antigravityDir: string;
|
||||
installDirs: string[];
|
||||
}
|
||||
|
||||
async function makeSandbox(): Promise<Sandbox> {
|
||||
@@ -20,10 +18,8 @@ async function makeSandbox(): Promise<Sandbox> {
|
||||
const agentsDir = path.join(root, "home", ".agents", "skills");
|
||||
const claudeDir = path.join(root, "home", ".claude", "skills");
|
||||
const codexDir = path.join(root, "home", ".codex", "skills");
|
||||
const antigravityDir = path.join(root, "home", ".gemini", "config", "skills");
|
||||
const installDirs = [agentsDir, claudeDir, antigravityDir];
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
return { root, sourceDir, agentsDir, claudeDir, codexDir, antigravityDir, installDirs };
|
||||
return { root, sourceDir, agentsDir, claudeDir, codexDir };
|
||||
}
|
||||
|
||||
async function writeBundleSkill(
|
||||
@@ -61,7 +57,8 @@ describe("syncSkills", () => {
|
||||
|
||||
const result = await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
@@ -78,11 +75,6 @@ describe("syncSkills", () => {
|
||||
"utf-8",
|
||||
);
|
||||
expect(claudeContent).toBe("new paseo content");
|
||||
const antigravityContent = await fs.readFile(
|
||||
path.join(sandbox.antigravityDir, "paseo", "SKILL.md"),
|
||||
"utf-8",
|
||||
);
|
||||
expect(antigravityContent).toBe("new paseo content");
|
||||
await expect(fs.stat(path.join(sandbox.codexDir, "paseo", "SKILL.md"))).rejects.toMatchObject({
|
||||
code: "ENOENT",
|
||||
});
|
||||
@@ -96,7 +88,8 @@ describe("syncSkills", () => {
|
||||
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo-committee"],
|
||||
});
|
||||
@@ -122,15 +115,6 @@ describe("syncSkills", () => {
|
||||
expect(await fs.readFile(path.join(claudeSkillDir, "references", "roles.md"), "utf-8")).toBe(
|
||||
"roles content",
|
||||
);
|
||||
|
||||
const antigravitySkillDir = path.join(sandbox.antigravityDir, "paseo-committee");
|
||||
expect((await fs.lstat(antigravitySkillDir)).isDirectory()).toBe(true);
|
||||
expect(await fs.readFile(path.join(antigravitySkillDir, "SKILL.md"), "utf-8")).toBe(
|
||||
"committee content",
|
||||
);
|
||||
expect(
|
||||
await fs.readFile(path.join(antigravitySkillDir, "references", "roles.md"), "utf-8"),
|
||||
).toBe("roles content");
|
||||
});
|
||||
|
||||
it("leaves on-disk skills not in the bundle untouched", async () => {
|
||||
@@ -138,21 +122,16 @@ describe("syncSkills", () => {
|
||||
const customSkill = path.join(sandbox.agentsDir, "user-custom-skill");
|
||||
await fs.mkdir(customSkill, { recursive: true });
|
||||
await fs.writeFile(path.join(customSkill, "SKILL.md"), "user content");
|
||||
const antigravityCustomSkill = path.join(sandbox.antigravityDir, "user-antigravity-skill");
|
||||
await fs.mkdir(antigravityCustomSkill, { recursive: true });
|
||||
await fs.writeFile(path.join(antigravityCustomSkill, "SKILL.md"), "antigravity user content");
|
||||
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
|
||||
expect(await fs.readFile(path.join(customSkill, "SKILL.md"), "utf-8")).toBe("user content");
|
||||
expect(await fs.readFile(path.join(antigravityCustomSkill, "SKILL.md"), "utf-8")).toBe(
|
||||
"antigravity user content",
|
||||
);
|
||||
});
|
||||
|
||||
it("removes stale files previously written to managed skill dirs", async () => {
|
||||
@@ -164,7 +143,8 @@ describe("syncSkills", () => {
|
||||
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
@@ -174,7 +154,8 @@ describe("syncSkills", () => {
|
||||
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
@@ -182,12 +163,6 @@ describe("syncSkills", () => {
|
||||
expect(await fs.readFile(path.join(onDiskSkill, "SKILL.md"), "utf-8")).toBe("new");
|
||||
await expect(fs.access(path.join(onDiskSkill, "references", "stale.md"))).rejects.toThrow();
|
||||
await expect(fs.access(path.join(onDiskSkill, "references"))).rejects.toThrow();
|
||||
const antigravitySkill = path.join(sandbox.antigravityDir, "paseo");
|
||||
expect(await fs.readFile(path.join(antigravitySkill, "SKILL.md"), "utf-8")).toBe("new");
|
||||
await expect(
|
||||
fs.access(path.join(antigravitySkill, "references", "stale.md")),
|
||||
).rejects.toThrow();
|
||||
await expect(fs.access(path.join(antigravitySkill, "references"))).rejects.toThrow();
|
||||
});
|
||||
|
||||
it("preserves user-added files in managed skill dirs", async () => {
|
||||
@@ -197,14 +172,11 @@ describe("syncSkills", () => {
|
||||
await fs.writeFile(path.join(onDiskSkill, "SKILL.md"), "old");
|
||||
await fs.writeFile(path.join(onDiskSkill, "my-context.md"), "user context");
|
||||
await fs.writeFile(path.join(onDiskSkill, "references", "notes.md"), "user notes");
|
||||
const antigravitySkill = path.join(sandbox.antigravityDir, "paseo");
|
||||
await fs.mkdir(path.join(antigravitySkill, "references"), { recursive: true });
|
||||
await fs.writeFile(path.join(antigravitySkill, "SKILL.md"), "old");
|
||||
await fs.writeFile(path.join(antigravitySkill, "my-context.md"), "antigravity user context");
|
||||
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
@@ -216,10 +188,6 @@ describe("syncSkills", () => {
|
||||
expect(await fs.readFile(path.join(onDiskSkill, "references", "notes.md"), "utf-8")).toBe(
|
||||
"user notes",
|
||||
);
|
||||
expect(await fs.readFile(path.join(antigravitySkill, "SKILL.md"), "utf-8")).toBe("new");
|
||||
expect(await fs.readFile(path.join(antigravitySkill, "my-context.md"), "utf-8")).toBe(
|
||||
"antigravity user context",
|
||||
);
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
@@ -240,39 +208,8 @@ describe("syncSkills", () => {
|
||||
await expect(
|
||||
syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
}),
|
||||
).rejects.toThrow("Cannot sync through symbolic link");
|
||||
|
||||
expect(await fs.readFile(path.join(onDiskSkill, "SKILL.md"), "utf-8")).toBe("old skill");
|
||||
expect(await fs.readFile(path.join(externalReferences, "guide.md"), "utf-8")).toBe(
|
||||
"external guide",
|
||||
);
|
||||
expect((await fs.lstat(path.join(onDiskSkill, "references"))).isSymbolicLink()).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"rejects managed paths that would write through a symlink in Antigravity",
|
||||
async () => {
|
||||
await writeBundleSkill(sandbox.sourceDir, "paseo", {
|
||||
"SKILL.md": "new skill",
|
||||
"references/guide.md": "new guide",
|
||||
});
|
||||
const onDiskSkill = path.join(sandbox.antigravityDir, "paseo");
|
||||
const externalReferences = path.join(sandbox.root, "external-antigravity-references");
|
||||
await fs.mkdir(onDiskSkill, { recursive: true });
|
||||
await fs.mkdir(externalReferences, { recursive: true });
|
||||
await fs.writeFile(path.join(onDiskSkill, "SKILL.md"), "old skill");
|
||||
await fs.writeFile(path.join(externalReferences, "guide.md"), "external guide");
|
||||
await fs.symlink(externalReferences, path.join(onDiskSkill, "references"), "dir");
|
||||
|
||||
await expect(
|
||||
syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
}),
|
||||
@@ -294,7 +231,8 @@ describe("syncSkills", () => {
|
||||
|
||||
const first = await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
@@ -302,7 +240,8 @@ describe("syncSkills", () => {
|
||||
|
||||
const second = await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
@@ -316,7 +255,8 @@ describe("syncSkills", () => {
|
||||
const errors: Array<{ name: string; error: unknown }> = [];
|
||||
const result = await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo", "paseo-removed"],
|
||||
onSkillError: (name, error) => errors.push({ name, error }),
|
||||
@@ -338,7 +278,8 @@ describe("syncSkills", () => {
|
||||
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo", "paseo-deprecated"],
|
||||
});
|
||||
@@ -352,7 +293,8 @@ describe("syncSkills", () => {
|
||||
const errors: string[] = [];
|
||||
const result = await syncSkills({
|
||||
sourceDir: missingSourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
onSkillError: (skillName) => errors.push(skillName),
|
||||
@@ -371,7 +313,8 @@ describe("syncSkills", () => {
|
||||
const errors: string[] = [];
|
||||
const result = await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
onSkillError: (skillName) => errors.push(skillName),
|
||||
@@ -393,30 +336,32 @@ describe("removeSkill", () => {
|
||||
await fs.rm(sandbox.root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("removes the skill from all targets when present", async () => {
|
||||
it("removes the skill from all three targets when present", async () => {
|
||||
await writeBundleSkill(sandbox.sourceDir, "paseo", { "SKILL.md": "content" });
|
||||
await syncSkills({
|
||||
sourceDir: sandbox.sourceDir,
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
skillNames: ["paseo"],
|
||||
});
|
||||
|
||||
await removeSkill("paseo", {
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
});
|
||||
|
||||
await expect(fs.access(path.join(sandbox.agentsDir, "paseo"))).rejects.toThrow();
|
||||
await expect(fs.access(path.join(sandbox.claudeDir, "paseo"))).rejects.toThrow();
|
||||
await expect(fs.access(path.join(sandbox.codexDir, "paseo"))).rejects.toThrow();
|
||||
await expect(fs.access(path.join(sandbox.antigravityDir, "paseo"))).rejects.toThrow();
|
||||
});
|
||||
|
||||
it("does not throw when targets are missing", async () => {
|
||||
await expect(
|
||||
removeSkill("does-not-exist", {
|
||||
installDirs: sandbox.installDirs,
|
||||
agentsDir: sandbox.agentsDir,
|
||||
claudeDir: sandbox.claudeDir,
|
||||
codexDir: sandbox.codexDir,
|
||||
}),
|
||||
).resolves.toBeUndefined();
|
||||
|
||||
@@ -4,7 +4,8 @@ import path from "node:path";
|
||||
|
||||
export interface SkillSyncOptions {
|
||||
sourceDir: string;
|
||||
installDirs: readonly string[];
|
||||
agentsDir: string;
|
||||
claudeDir: string;
|
||||
codexDir: string;
|
||||
skillNames: readonly string[];
|
||||
onSkillError?: (skillName: string, error: unknown) => void;
|
||||
@@ -170,29 +171,20 @@ async function syncDirectoryFiles(srcDir: string, dstDir: string): Promise<numbe
|
||||
}
|
||||
|
||||
export interface RemoveSkillTargets {
|
||||
installDirs: readonly string[];
|
||||
agentsDir: string;
|
||||
claudeDir: string;
|
||||
codexDir: string;
|
||||
}
|
||||
|
||||
export async function removeSkill(skillName: string, targets: RemoveSkillTargets): Promise<void> {
|
||||
const paths = [...targets.installDirs, targets.codexDir].map((root) =>
|
||||
path.join(root, skillName),
|
||||
);
|
||||
let hasError = false;
|
||||
let firstError: unknown = null;
|
||||
const paths = [
|
||||
path.join(targets.agentsDir, skillName),
|
||||
path.join(targets.claudeDir, skillName),
|
||||
path.join(targets.codexDir, skillName),
|
||||
];
|
||||
for (const p of paths) {
|
||||
try {
|
||||
await fs.rm(p, { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
// If an ancestor is a regular file, no skill directory can exist below it.
|
||||
if ((error as NodeJS.ErrnoException).code === "ENOTDIR") continue;
|
||||
if (!hasError) {
|
||||
hasError = true;
|
||||
firstError = error;
|
||||
}
|
||||
}
|
||||
await fs.rm(p, { recursive: true, force: true });
|
||||
}
|
||||
if (hasError) throw firstError;
|
||||
}
|
||||
|
||||
async function isSameDirectory(a: string, b: string): Promise<boolean> {
|
||||
@@ -202,7 +194,7 @@ async function isSameDirectory(a: string, b: string): Promise<boolean> {
|
||||
|
||||
/**
|
||||
* Codex also discovers .agents/skills, so its dedicated copy is a leftover. When
|
||||
* the Codex skill directory resolves to an active install target, it is that
|
||||
* the Codex skill directory resolves to the shared or Claude copy, it is that
|
||||
* copy, and retiring it would delete the install.
|
||||
*/
|
||||
export async function isLegacyCodexCopy(
|
||||
@@ -210,7 +202,7 @@ export async function isLegacyCodexCopy(
|
||||
targets: RemoveSkillTargets,
|
||||
): Promise<boolean> {
|
||||
const codexSkillDir = path.join(targets.codexDir, skillName);
|
||||
for (const root of targets.installDirs) {
|
||||
for (const root of [targets.agentsDir, targets.claudeDir]) {
|
||||
if (await isSameDirectory(codexSkillDir, path.join(root, skillName))) return false;
|
||||
}
|
||||
return true;
|
||||
@@ -242,8 +234,6 @@ async function retireManagedSkill(dstDir: string): Promise<number> {
|
||||
export async function syncSkills(options: SkillSyncOptions): Promise<SkillSyncResult> {
|
||||
let changedFiles = 0;
|
||||
let processedSkills = 0;
|
||||
let hasError = false;
|
||||
let firstError: unknown = null;
|
||||
|
||||
for (const skillName of options.skillNames) {
|
||||
const bundleSkillDir = path.join(options.sourceDir, skillName);
|
||||
@@ -251,47 +241,28 @@ export async function syncSkills(options: SkillSyncOptions): Promise<SkillSyncRe
|
||||
const bundleStat = await fs.stat(bundleSkillDir).catch(() => null);
|
||||
if (!bundleStat?.isDirectory()) continue;
|
||||
|
||||
let skillFailed = false;
|
||||
let skillError: unknown = null;
|
||||
try {
|
||||
changedFiles += await syncDirectoryFiles(
|
||||
bundleSkillDir,
|
||||
path.join(options.agentsDir, skillName),
|
||||
);
|
||||
|
||||
// Attempt every install root for every skill before throwing so one
|
||||
// unwritable target does not stop updates from reaching healthy targets.
|
||||
for (const installDir of options.installDirs) {
|
||||
try {
|
||||
changedFiles += await syncDirectoryFiles(bundleSkillDir, path.join(installDir, skillName));
|
||||
} catch (error) {
|
||||
if (!skillFailed) {
|
||||
skillFailed = true;
|
||||
skillError = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
changedFiles += await syncDirectoryFiles(
|
||||
bundleSkillDir,
|
||||
path.join(options.claudeDir, skillName),
|
||||
);
|
||||
|
||||
if (!skillFailed) {
|
||||
try {
|
||||
// Retain user edits to the old dedicated Codex copy.
|
||||
if (await isLegacyCodexCopy(skillName, options)) {
|
||||
changedFiles += await retireManagedSkill(path.join(options.codexDir, skillName));
|
||||
}
|
||||
} catch (error) {
|
||||
skillFailed = true;
|
||||
skillError = error;
|
||||
// Retain user edits to the old dedicated Codex copy.
|
||||
if (await isLegacyCodexCopy(skillName, options)) {
|
||||
changedFiles += await retireManagedSkill(path.join(options.codexDir, skillName));
|
||||
}
|
||||
}
|
||||
|
||||
if (skillFailed) {
|
||||
if (options.onSkillError) {
|
||||
options.onSkillError(skillName, skillError);
|
||||
} else if (!hasError) {
|
||||
hasError = true;
|
||||
firstError = skillError;
|
||||
}
|
||||
} else {
|
||||
processedSkills++;
|
||||
} catch (error) {
|
||||
if (!options.onSkillError) throw error;
|
||||
options.onSkillError(skillName, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasError) throw firstError;
|
||||
|
||||
return { changedFiles, processedSkills };
|
||||
}
|
||||
|
||||
@@ -128,28 +128,13 @@ function selectionsEqual(left: SkillSelection, right: SkillSelection): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordered roots for transaction capture and recovery. Pre-0.17 manifests
|
||||
* recorded `[agents, claude, codex]` at indices 0–2, so `codexDir` stays at
|
||||
* index 2 and newer install roots follow at index 3+.
|
||||
*/
|
||||
function skillRoots(targets: SkillTargets): string[] {
|
||||
const [agentsDir, claudeDir, ...additionalInstallDirs] = targets.installDirs;
|
||||
return [
|
||||
...(agentsDir ? [agentsDir] : []),
|
||||
...(claudeDir ? [claudeDir] : []),
|
||||
targets.codexDir,
|
||||
...additionalInstallDirs,
|
||||
];
|
||||
}
|
||||
|
||||
async function validateEntries(
|
||||
targets: SkillTargets,
|
||||
transactionDir: string,
|
||||
entries: CapturedDirectory[],
|
||||
): Promise<boolean> {
|
||||
const names = new Set(await listManagedSkillNames(targets.sourceDir));
|
||||
const roots = skillRoots(targets);
|
||||
const roots = [targets.agentsDir, targets.claudeDir, targets.codexDir];
|
||||
return entries.every((entry) => {
|
||||
const rootIndex = roots.findIndex((root) => path.dirname(entry.livePath) === root);
|
||||
if (rootIndex === -1) return false;
|
||||
@@ -424,10 +409,6 @@ async function restore(
|
||||
continue;
|
||||
}
|
||||
const liveInfo = await lstat(entry.livePath).catch(() => null);
|
||||
// An add entry with no backup and no readable live path wrote nothing here
|
||||
// (absent, under a file, or under an unreadable parent). Skipping avoids
|
||||
// failing rollback with ENOTDIR/EACCES and leaving a stuck transaction.
|
||||
if (liveInfo === null && backup === null) continue;
|
||||
if (liveInfo !== null && !(await isDirectory(entry.livePath))) {
|
||||
// Add/update rollback has the same conflict state as delete rollback. A
|
||||
// recreated file or file symlink belongs to the external writer; preserve
|
||||
@@ -460,7 +441,11 @@ async function restore(
|
||||
}
|
||||
|
||||
function transactionParents(targets: SkillTargets): string[] {
|
||||
return [...new Set(skillRoots(targets).map((root) => path.dirname(root)))];
|
||||
return [
|
||||
...new Set(
|
||||
[targets.agentsDir, targets.claudeDir, targets.codexDir].map((root) => path.dirname(root)),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,7 +493,7 @@ export async function beginSkillsTransaction(
|
||||
nextSelection: SkillSelection,
|
||||
ops: readonly SkillOp[],
|
||||
): Promise<SkillsTransaction> {
|
||||
const roots = skillRoots(targets);
|
||||
const roots = [targets.agentsDir, targets.claudeDir, targets.codexDir];
|
||||
const seenRoots = new Set<string>();
|
||||
const uniqueRoots: Array<{ root: string; rootIndex: number }> = [];
|
||||
for (const [rootIndex, root] of roots.entries()) {
|
||||
|
||||
@@ -1089,3 +1089,31 @@ describe("speech provider config normalization", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.each([
|
||||
["goose", "acp"],
|
||||
["/opt/bin/goose", "acp"],
|
||||
])(
|
||||
"migrates the legacy goose entry and preserves command overrides (%s %s)",
|
||||
(binary, subcommand) => {
|
||||
const command = [binary, subcommand];
|
||||
const overrides = {
|
||||
enabled: false,
|
||||
label: "My goose",
|
||||
env: { GOOSE_PROVIDER: "openai" },
|
||||
models: [{ id: "primary", label: "Primary" }],
|
||||
additionalModels: [{ id: "secondary", label: "Secondary" }],
|
||||
};
|
||||
const parsed = PersistedConfigSchema.parse({
|
||||
agents: {
|
||||
providers: {
|
||||
goose: { ...overrides, extends: "acp", description: "Old description", command },
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(parsed.agents?.providers?.goose).toEqual({
|
||||
...overrides,
|
||||
...(command[0] === "goose" ? {} : { command }),
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@@ -199,16 +199,32 @@ function isLegacyProviderEntry(value: unknown): boolean {
|
||||
}
|
||||
|
||||
function normalizeAgentProviders(value: unknown): unknown {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
||||
return value;
|
||||
if (!isConfigRecord(value)) return value;
|
||||
|
||||
let rawProviders = value;
|
||||
const goose = configRecord(value.goose);
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once legacy configs have migrated.
|
||||
if (goose?.extends === "acp") {
|
||||
const { extends: _base, description: _description, command, ...overrides } = goose;
|
||||
const usesDefaultCommand =
|
||||
Array.isArray(command) &&
|
||||
command.length === 2 &&
|
||||
command[0] === "goose" &&
|
||||
command[1] === "acp";
|
||||
rawProviders = {
|
||||
...value,
|
||||
goose: {
|
||||
...overrides,
|
||||
...(command !== undefined && !usesDefaultCommand ? { command } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const rawProviders = value as Record<string, unknown>;
|
||||
const hasLegacyEntries = Object.values(rawProviders).some((entry) =>
|
||||
isLegacyProviderEntry(entry),
|
||||
);
|
||||
if (!hasLegacyEntries) {
|
||||
return value;
|
||||
return rawProviders;
|
||||
}
|
||||
|
||||
const legacyEntries: Record<string, unknown> = {};
|
||||
@@ -224,7 +240,7 @@ function normalizeAgentProviders(value: unknown): unknown {
|
||||
|
||||
const parsedLegacyEntries = AgentProviderRuntimeSettingsMapSchema.safeParse(legacyEntries);
|
||||
if (!parsedLegacyEntries.success) {
|
||||
return value;
|
||||
return rawProviders;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -9,6 +9,7 @@ export const builtinPlugins = [
|
||||
"copilot-usage-source",
|
||||
"cursor-usage-source",
|
||||
"fx-provider",
|
||||
"goose-provider",
|
||||
"grok-usage-source",
|
||||
"hoplite-provider",
|
||||
"kimi-usage-source",
|
||||
|
||||
@@ -2214,6 +2214,8 @@ export class VoiceAssistantWebSocketServer {
|
||||
hopliteProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("hoplite"),
|
||||
// COMPAT(fxProvider): added after v0.15.3, remove after 2027-05-09 once host floor includes the bundled adapter.
|
||||
fxProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("fx"),
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once host floor includes the bundled adapter.
|
||||
gooseProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("goose"),
|
||||
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
|
||||
importSessionWorkspaceTarget: true,
|
||||
// COMPAT(importSessionSearch): added in v0.7.3, remove gate after 2027-03-02.
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 5.9 KiB |
@@ -89,6 +89,7 @@ import {
|
||||
PiIcon,
|
||||
} from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { PaseoHubMark } from "~/components/paseo-brand";
|
||||
import {
|
||||
MobileChat,
|
||||
MobileDiff,
|
||||
@@ -515,6 +516,7 @@ function TurnkeySection() {
|
||||
description={t("landing.runAnywhere.teamsDescription")}
|
||||
ctaHref={localize("/hub")}
|
||||
ctaLabel={t("landing.runAnywhere.teamsCta")}
|
||||
ctaIcon={PASEO_HUB_CTA_ICON}
|
||||
showIntegrationIcons
|
||||
/>
|
||||
</div>
|
||||
@@ -523,12 +525,15 @@ function TurnkeySection() {
|
||||
);
|
||||
}
|
||||
|
||||
const PASEO_HUB_CTA_ICON = <PaseoHubMark className="h-4 w-4 shrink-0" />;
|
||||
|
||||
function TurnkeyExtensionCard({
|
||||
icon: Icon,
|
||||
title,
|
||||
description,
|
||||
ctaHref,
|
||||
ctaLabel,
|
||||
ctaIcon,
|
||||
showIntegrationIcons = false,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
@@ -536,6 +541,7 @@ function TurnkeyExtensionCard({
|
||||
description: string;
|
||||
ctaHref: string;
|
||||
ctaLabel: string;
|
||||
ctaIcon?: React.ReactNode;
|
||||
showIntegrationIcons?: boolean;
|
||||
}) {
|
||||
return (
|
||||
@@ -545,6 +551,7 @@ function TurnkeyExtensionCard({
|
||||
href={ctaHref}
|
||||
className="inline-flex items-center gap-1.5 rounded-full bg-foreground px-2.5 py-1.5 text-xs text-background transition-colors hover:bg-foreground/90"
|
||||
>
|
||||
{ctaIcon}
|
||||
{ctaLabel}
|
||||
<ArrowRight className="h-3.5 w-3.5" />
|
||||
</a>
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
// Exact SVG paths from packages/app/src/components/icons/
|
||||
|
||||
import { OpenCodeIcon as OpenCodeBrandIcon, PiIcon as PiBrandIcon } from "../agent-icons";
|
||||
import { PaseoMark as CanonicalPaseoMark } from "../paseo-brand";
|
||||
|
||||
/** The Paseo brand swirl — public/logo.svg, drawn as a small sidebar avatar mark. */
|
||||
/** The Paseo butterfly mark, drawn as a small sidebar avatar or tool-call mark. */
|
||||
export function PaseoMark({ size = 13, className }: { size?: number; className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 700 700"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
className={className}
|
||||
>
|
||||
<path d="M291.495 91.399C333.897 104.892 379.155 135.075 416.229 173.191C453.389 211.394 484.429 259.725 495.708 311.251C497.555 319.693 498.865 328.216 499.586 336.776C509.755 326.554 519.867 317.815 529.89 311.547C540.647 304.821 553.808 299.297 568.641 299.785C584.29 300.299 597.395 307.326 607.747 317.632C632.173 341.947 629.612 372.898 619.872 397.936C610.185 422.833 591.557 447.826 572.732 469.124C553.591 490.78 532.713 510.308 516.779 524.318C508.775 531.355 501.936 537.073 497.07 541.052C494.635 543.043 492.689 544.603 491.334 545.679C490.657 546.217 490.126 546.635 489.756 546.926C489.571 547.071 489.425 547.184 489.321 547.265C489.269 547.305 489.227 547.338 489.196 547.362C489.181 547.374 489.168 547.385 489.157 547.393C489.153 547.397 489.147 547.401 489.144 547.403C489.134 547.4 488.837 547.06 473.001 528.499L489.135 547.411C478.157 555.911 462.033 554.334 453.122 543.89C444.213 533.448 445.887 518.094 456.861 509.592C456.863 509.591 456.865 509.588 456.869 509.586C456.88 509.577 456.902 509.561 456.933 509.536C456.997 509.487 457.101 509.404 457.245 509.292C457.533 509.066 457.979 508.715 458.569 508.247C459.749 507.31 461.506 505.901 463.742 504.073C468.216 500.414 474.589 495.088 482.073 488.508C497.114 475.284 516.315 457.282 533.578 437.75C551.157 417.862 565.26 398.01 571.859 381.048C578.403 364.227 575.681 356.302 570.724 351.367C568.928 349.579 567.744 348.902 567.267 348.676C566.888 348.496 566.811 348.52 566.804 348.52C566.605 348.513 563.971 348.537 557.953 352.3C545.161 360.299 528.815 377.492 506.807 403.867C494.927 418.106 481.871 434.435 467.547 451.957C463.709 457.28 459.503 462.538 454.91 467.717L454.702 467.549C420.808 508.347 380.37 553.856 332.335 593.848C301.853 619.226 262.656 622.597 228.642 614.743C194.834 606.936 162.658 587.448 142.217 561.686C108.054 518.631 100.57 469.801 108.223 427.836C115.56 387.606 137.391 351.005 166.502 331.557C161.248 315.813 156.813 299.49 153.519 283.013C142.593 228.368 143.239 167.031 174.28 119.619C186.922 100.31 205.846 89.1535 227.387 85.2773C248.1 81.5504 270.278 84.648 291.495 91.399ZM378.642 206.356C345.773 172.563 307.463 147.917 275.208 137.654C259.096 132.527 246.171 131.514 236.828 133.195C228.314 134.727 222.227 138.497 217.721 145.38C196.712 177.468 193.858 224.004 203.82 273.827C206.532 287.394 210.127 300.834 214.345 313.817C236.45 310.276 260.156 311.463 281.22 317.11C319.621 327.403 357.501 355.419 357.501 405.654C357.501 435.255 339.111 465.136 307.278 473.815C273.211 483.103 238.854 464.822 213.105 427.541C203.716 413.947 194.443 397.766 185.947 379.89C174.028 392.223 163.08 411.953 158.673 436.118C153.128 466.518 158.514 501.286 183.085 532.253C195.993 548.522 217.742 562.031 240.771 567.349C263.594 572.619 284.147 569.24 298.664 557.154C349.383 514.927 390.709 466.547 426.366 422.952C448.879 390.86 453.195 356.06 445.578 321.265C436.703 280.718 411.425 240.06 378.642 206.356ZM306.296 405.722C306.296 384.769 292.223 370.736 267.284 364.051C256.012 361.03 244.156 360.087 233.095 360.771C240.361 375.935 248.168 389.513 255.897 400.704C275.647 429.298 289.989 427.822 293.247 426.934C298.737 425.437 306.296 418.161 306.296 405.722Z" />
|
||||
</svg>
|
||||
);
|
||||
return <CanonicalPaseoMark width={size} height={size} className={className} />;
|
||||
}
|
||||
|
||||
/** GitHub mark for the toolbar and PR panel. */
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
// Small shared bits for the mobile mockups. The Paseo butterfly mark is the
|
||||
// app icon (packages/website/public/favicon.svg) with the black plate dropped,
|
||||
// so it can be tinted and placed on any tile. Tile fills are the app's identity
|
||||
// Small shared bits for the mobile mockups. Tile fills are the app's identity
|
||||
// palette — packages/app/src/styles/identity-colors.ts — surfaced as
|
||||
// `--color-mock-tile-*` tokens in styles.css.
|
||||
|
||||
const BUTTERFLY_D =
|
||||
"M291.495 91.399C333.897 104.892 379.155 135.075 416.229 173.191C453.389 211.394 484.429 259.725 495.708 311.251C497.555 319.693 498.865 328.216 499.586 336.776C509.755 326.554 519.867 317.815 529.89 311.547C540.647 304.821 553.808 299.297 568.641 299.785C584.29 300.299 597.395 307.326 607.747 317.632C632.173 341.947 629.612 372.898 619.872 397.936C610.185 422.833 591.557 447.826 572.732 469.124C553.591 490.78 532.713 510.308 516.779 524.318C508.775 531.355 501.936 537.073 497.07 541.052C494.635 543.043 492.689 544.603 491.334 545.679C490.657 546.217 490.126 546.635 489.756 546.926C489.571 547.071 489.425 547.184 489.321 547.265C489.269 547.305 489.227 547.338 489.196 547.362C489.181 547.374 489.168 547.385 489.157 547.393C489.153 547.397 489.147 547.401 489.144 547.403C489.134 547.4 488.837 547.06 473.001 528.499L489.135 547.411C478.157 555.911 462.033 554.334 453.122 543.89C444.213 533.448 445.887 518.094 456.861 509.592C456.863 509.591 456.865 509.588 456.869 509.586C456.88 509.577 456.902 509.561 456.933 509.536C456.997 509.487 457.101 509.404 457.245 509.292C457.533 509.066 457.979 508.715 458.569 508.247C459.749 507.31 461.506 505.901 463.742 504.073C468.216 500.414 474.589 495.088 482.073 488.508C497.114 475.284 516.315 457.282 533.578 437.75C551.157 417.862 565.26 398.01 571.859 381.048C578.403 364.227 575.681 356.302 570.724 351.367C568.928 349.579 567.744 348.902 567.267 348.676C566.888 348.496 566.811 348.52 566.804 348.52C566.605 348.513 563.971 348.537 557.953 352.3C545.161 360.299 528.815 377.492 506.807 403.867C494.927 418.106 481.871 434.435 467.547 451.957C463.709 457.28 459.503 462.538 454.91 467.717L454.702 467.549C420.808 508.347 380.37 553.856 332.335 593.848C301.853 619.226 262.656 622.597 228.642 614.743C194.834 606.936 162.658 587.448 142.217 561.686C108.054 518.631 100.57 469.801 108.223 427.836C115.56 387.606 137.391 351.005 166.502 331.557C161.248 315.813 156.813 299.49 153.519 283.013C142.593 228.368 143.239 167.031 174.28 119.619C186.922 100.31 205.846 89.1535 227.387 85.2773C248.1 81.5504 270.278 84.648 291.495 91.399ZM378.642 206.356C345.773 172.563 307.463 147.917 275.208 137.654C259.096 132.527 246.171 131.514 236.828 133.195C228.314 134.727 222.227 138.497 217.721 145.38C196.712 177.468 193.858 224.004 203.82 273.827C206.532 287.394 210.127 300.834 214.345 313.817C236.45 310.276 260.156 311.463 281.22 317.11C319.621 327.403 357.501 355.419 357.501 405.654C357.501 435.255 339.111 465.136 307.278 473.815C273.211 483.103 238.854 464.822 213.105 427.541C203.716 413.947 194.443 397.766 185.947 379.89C174.028 392.223 163.08 411.953 158.673 436.118C153.128 466.518 158.514 501.286 183.085 532.253C195.993 548.522 217.742 562.031 240.771 567.349C263.594 572.619 284.147 569.24 298.664 557.154C349.383 514.927 390.709 466.547 426.366 422.952C448.879 390.86 453.195 356.06 445.578 321.265C436.703 280.718 411.425 240.06 378.642 206.356ZM306.296 405.722C306.296 384.769 292.223 370.736 267.284 364.051C256.012 361.03 244.156 360.087 233.095 360.771C240.361 375.935 248.168 389.513 255.897 400.704C275.647 429.298 289.989 427.822 293.247 426.934C298.737 425.437 306.296 418.161 306.296 405.722Z";
|
||||
import { PaseoMark as CanonicalPaseoMark } from "../../paseo-brand";
|
||||
|
||||
export function PaseoMark({ size = 20, className }: { size?: number; className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 700 700"
|
||||
fill="currentColor"
|
||||
className={className}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path transform="translate(350,350) scale(1.05) translate(-350,-350)" d={BUTTERFLY_D} />
|
||||
</svg>
|
||||
);
|
||||
return <CanonicalPaseoMark width={size} height={size} className={className} />;
|
||||
}
|
||||
|
||||
/** A hashed identity tile — one letter on a muted identity fill. */
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { HubLockup, PaseoHubLockup, PaseoHubMark, PaseoLockup, PaseoMark } from "./paseo-brand";
|
||||
|
||||
const REPO_ROOT = path.resolve(import.meta.dirname, "../../../..");
|
||||
const BRAND_ROOT = path.join(REPO_ROOT, "assets/brand");
|
||||
const WEBSITE_PUBLIC = path.join(REPO_ROOT, "packages/website/public");
|
||||
|
||||
function extractPathData(svg: string): string[] {
|
||||
return [...svg.matchAll(/\bd="([^"]+)"/g)].map((m) => m[1]);
|
||||
}
|
||||
|
||||
describe("paseo brand assets", () => {
|
||||
it("renders canonical Paseo and Paseo Hub marks with currentColor", () => {
|
||||
const paseoHtml = renderToStaticMarkup(<PaseoMark className="h-6 w-6" />);
|
||||
const hubHtml = renderToStaticMarkup(<PaseoHubMark className="h-6 w-6" />);
|
||||
const canonicalPaseo = readFileSync(path.join(BRAND_ROOT, "marks/paseo-white.svg"), "utf8");
|
||||
const canonicalHub = readFileSync(path.join(BRAND_ROOT, "marks/paseo-hub-white.svg"), "utf8");
|
||||
|
||||
expect(paseoHtml).toContain('viewBox="0 0 700 700"');
|
||||
expect(paseoHtml).toContain('stroke="currentColor"');
|
||||
expect(paseoHtml).toContain('stroke-width="50"');
|
||||
expect(extractPathData(paseoHtml)).toEqual(extractPathData(canonicalPaseo));
|
||||
|
||||
expect(hubHtml).toContain('viewBox="0 0 700 700"');
|
||||
expect(hubHtml).toContain('stroke="currentColor"');
|
||||
expect(hubHtml).toContain('stroke-width="50"');
|
||||
expect(extractPathData(hubHtml)).toEqual(extractPathData(canonicalHub));
|
||||
});
|
||||
|
||||
it("renders canonical Paseo, Paseo Hub, and Hub lockups at shared 144-unit height", () => {
|
||||
const cases = [
|
||||
{ Component: PaseoLockup, file: "lockups/paseo-white.svg", width: 580 },
|
||||
{ Component: PaseoHubLockup, file: "lockups/paseo-hub-white.svg", width: 842 },
|
||||
{ Component: HubLockup, file: "lockups/hub-white.svg", width: 461 },
|
||||
];
|
||||
|
||||
for (const { Component, file, width } of cases) {
|
||||
const html = renderToStaticMarkup(<Component className="h-6 w-auto" />);
|
||||
const canonical = readFileSync(path.join(BRAND_ROOT, file), "utf8");
|
||||
|
||||
expect(html).toContain(`viewBox="0 0 ${width} 144"`);
|
||||
expect(html).toContain(`width="${width}"`);
|
||||
expect(html).toContain('height="144"');
|
||||
expect(html).toContain('stroke="currentColor"');
|
||||
expect(html).toContain('fill="currentColor"');
|
||||
expect(extractPathData(html)).toEqual(extractPathData(canonical));
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps public/logo.svg and public/favicon.svg aligned with assets/brand", () => {
|
||||
const canonicalPaseo = readFileSync(path.join(BRAND_ROOT, "marks/paseo-white.svg"), "utf8");
|
||||
const publicLogo = readFileSync(path.join(WEBSITE_PUBLIC, "logo.svg"), "utf8");
|
||||
const publicFavicon = readFileSync(path.join(WEBSITE_PUBLIC, "favicon.svg"), "utf8");
|
||||
|
||||
expect(publicLogo).toBe(canonicalPaseo);
|
||||
expect(publicFavicon).toContain('<rect width="700" height="700" rx="156" fill="#000000"');
|
||||
expect(extractPathData(publicFavicon)).toEqual(extractPathData(canonicalPaseo));
|
||||
});
|
||||
|
||||
it("ships a multi-size favicon.ico with 48, 32, and 16px entries", () => {
|
||||
const ico = readFileSync(path.join(WEBSITE_PUBLIC, "favicon.ico"));
|
||||
expect(ico.readUInt16LE(0)).toBe(0);
|
||||
expect(ico.readUInt16LE(2)).toBe(1);
|
||||
const count = ico.readUInt16LE(4);
|
||||
const sizes: number[] = [];
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
sizes.push(ico[6 + i * 16] || 256);
|
||||
}
|
||||
expect(sizes).toEqual([48, 32, 16]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,154 @@
|
||||
// Canonical Paseo and Paseo Hub brand marks and lockups, sourced directly from
|
||||
// `assets/brand/` (see `assets/brand/README.md`).
|
||||
|
||||
import type * as React from "react";
|
||||
import hubLockupSvg from "../../../../assets/brand/lockups/hub-white.svg?raw";
|
||||
import paseoHubLockupSvg from "../../../../assets/brand/lockups/paseo-hub-white.svg?raw";
|
||||
import paseoLockupSvg from "../../../../assets/brand/lockups/paseo-white.svg?raw";
|
||||
import paseoHubMarkSvg from "../../../../assets/brand/marks/paseo-hub-white.svg?raw";
|
||||
import paseoMarkSvg from "../../../../assets/brand/marks/paseo-white.svg?raw";
|
||||
|
||||
interface ParsedMark {
|
||||
width: number;
|
||||
height: number;
|
||||
viewBox: string;
|
||||
path: string;
|
||||
strokeWidth: number;
|
||||
}
|
||||
|
||||
interface ParsedLockup extends ParsedMark {
|
||||
wordmarkPath: string;
|
||||
}
|
||||
|
||||
function readAttr(tag: string, name: string, source: string): string {
|
||||
const match = tag.match(new RegExp(`${name}="([^"]+)"`));
|
||||
if (!match) {
|
||||
throw new Error(`Missing ${name} attribute in canonical brand SVG (${source})`);
|
||||
}
|
||||
return match[1];
|
||||
}
|
||||
|
||||
function parseSvgHeader(svg: string, source: string) {
|
||||
const svgTag = svg.match(/<svg\b[^>]*>/)?.[0];
|
||||
if (!svgTag) {
|
||||
throw new Error(`Missing <svg> root in canonical brand SVG (${source})`);
|
||||
}
|
||||
const paths = [...svg.matchAll(/<path\b[^>]*\/?>/g)].map((m) => m[0]);
|
||||
return {
|
||||
width: Number(readAttr(svgTag, "width", source)),
|
||||
height: Number(readAttr(svgTag, "height", source)),
|
||||
viewBox: readAttr(svgTag, "viewBox", source),
|
||||
paths,
|
||||
};
|
||||
}
|
||||
|
||||
function parseMark(svg: string, source: string): ParsedMark {
|
||||
const { width, height, viewBox, paths } = parseSvgHeader(svg, source);
|
||||
if (paths.length !== 1) {
|
||||
throw new Error(`Expected 1 path in brand mark SVG (${source}), found ${paths.length}`);
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
viewBox,
|
||||
path: readAttr(paths[0], "d", source),
|
||||
strokeWidth: Number(readAttr(paths[0], "stroke-width", source)),
|
||||
};
|
||||
}
|
||||
|
||||
function parseLockup(svg: string, source: string): ParsedLockup {
|
||||
const { width, height, viewBox, paths } = parseSvgHeader(svg, source);
|
||||
if (paths.length !== 2) {
|
||||
throw new Error(`Expected 2 paths in brand lockup SVG (${source}), found ${paths.length}`);
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
viewBox,
|
||||
path: readAttr(paths[0], "d", source),
|
||||
strokeWidth: Number(readAttr(paths[0], "stroke-width", source)),
|
||||
wordmarkPath: readAttr(paths[1], "d", source),
|
||||
};
|
||||
}
|
||||
|
||||
const PASEO_MARK = parseMark(paseoMarkSvg, "marks/paseo-white.svg");
|
||||
const PASEO_HUB_MARK = parseMark(paseoHubMarkSvg, "marks/paseo-hub-white.svg");
|
||||
const PASEO_LOCKUP = parseLockup(paseoLockupSvg, "lockups/paseo-white.svg");
|
||||
const PASEO_HUB_LOCKUP = parseLockup(paseoHubLockupSvg, "lockups/paseo-hub-white.svg");
|
||||
const HUB_LOCKUP = parseLockup(hubLockupSvg, "lockups/hub-white.svg");
|
||||
|
||||
function BrandMark({ asset, props }: { asset: ParsedMark; props: React.SVGProps<SVGSVGElement> }) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={asset.width}
|
||||
height={asset.height}
|
||||
viewBox={asset.viewBox}
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d={asset.path}
|
||||
stroke="currentColor"
|
||||
strokeWidth={asset.strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function BrandLockup({
|
||||
asset,
|
||||
props,
|
||||
}: {
|
||||
asset: ParsedLockup;
|
||||
props: React.SVGProps<SVGSVGElement>;
|
||||
}) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={asset.width}
|
||||
height={asset.height}
|
||||
viewBox={asset.viewBox}
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d={asset.path}
|
||||
stroke="currentColor"
|
||||
strokeWidth={asset.strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path d={asset.wordmarkPath} fill="currentColor" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/** Canonical Paseo butterfly mark (700x700 viewBox, stroked with currentColor). */
|
||||
export function PaseoMark(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandMark asset={PASEO_MARK} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo Hub five-petal flower mark (700x700 viewBox, stroked with currentColor). */
|
||||
export function PaseoHubMark(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandMark asset={PASEO_HUB_MARK} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo lockup (butterfly mark at 94% optical scale + Plus Jakarta Sans SemiBold). */
|
||||
export function PaseoLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandLockup asset={PASEO_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo Hub lockup (flower mark + Plus Jakarta Sans SemiBold). */
|
||||
export function PaseoHubLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandLockup asset={PASEO_HUB_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Hub lockup (flower mark + "Hub"), used where Paseo is already on screen. */
|
||||
export function HubLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandLockup asset={HUB_LOCKUP} props={props} />;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { PLUGINS_LINKED } from "~/plugins/launch";
|
||||
import "~/styles.css";
|
||||
import { DiscordIcon, GitHubIcon } from "~/components/brand-icons";
|
||||
import { LanguageSelector } from "~/components/language-selector";
|
||||
import { PaseoLockup } from "~/components/paseo-brand";
|
||||
import { useLocalizePath } from "~/i18n";
|
||||
import { useStars } from "~/routes/__root";
|
||||
|
||||
@@ -14,9 +15,12 @@ export function SiteHeader() {
|
||||
const { stars } = useStars();
|
||||
return (
|
||||
<header className="flex flex-col items-center gap-4 md:flex-row md:justify-between">
|
||||
<a href={localize("/")} className="flex items-center gap-3">
|
||||
<img src="/logo.svg" alt="Paseo" className="w-6 h-6" />
|
||||
<span className="text-lg font-medium">Paseo</span>
|
||||
<a
|
||||
href={localize("/")}
|
||||
aria-label="Paseo"
|
||||
className="inline-flex items-center text-foreground"
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</a>
|
||||
<div className="flex flex-wrap items-center justify-center gap-4">
|
||||
{PLUGINS_LINKED && (
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { buildDocsNavTree, getDoc, getDocs } from "~/docs";
|
||||
import { splitLocalePath, useLocale, useLocalizePath } from "~/i18n";
|
||||
import { LanguageSelector } from "~/components/language-selector";
|
||||
import { PaseoLockup } from "~/components/paseo-brand";
|
||||
import "~/styles.css";
|
||||
|
||||
export const Route = createFileRoute("/{-$locale}/docs")({
|
||||
@@ -35,9 +36,12 @@ function DocsLayout() {
|
||||
{/* Mobile header */}
|
||||
<header className="lg:hidden sticky top-0 z-50 bg-background border-b border-border">
|
||||
<div className="flex items-center justify-between p-4">
|
||||
<Link to={localize("/")} className="flex items-center gap-3">
|
||||
<img src="/logo.svg" alt="Paseo" className="w-6 h-6" />
|
||||
<span className="text-lg font-medium">Paseo</span>
|
||||
<Link
|
||||
to={localize("/")}
|
||||
aria-label="Paseo"
|
||||
className="inline-flex items-center text-foreground"
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</Link>
|
||||
<div className="flex items-center gap-3">
|
||||
<LanguageSelector />
|
||||
@@ -63,9 +67,12 @@ function DocsLayout() {
|
||||
{/* Desktop sidebar */}
|
||||
<aside className="hidden lg:block sticky top-0 h-screen w-60 shrink-0 border-r border-border p-6 overflow-y-auto">
|
||||
<div className="flex items-center justify-between gap-3 mb-8">
|
||||
<Link to={localize("/")} className="flex items-center gap-3">
|
||||
<img src="/logo.svg" alt="Paseo" className="w-6 h-6" />
|
||||
<span className="text-lg font-medium">Paseo</span>
|
||||
<Link
|
||||
to={localize("/")}
|
||||
aria-label="Paseo"
|
||||
className="inline-flex items-center text-foreground"
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</Link>
|
||||
<LanguageSelector />
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
PiIcon,
|
||||
} from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { HubLockup, PaseoHubLockup, PaseoHubMark } from "~/components/paseo-brand";
|
||||
import { AGENT_PAGES } from "~/data/agent-pages";
|
||||
import { FAQItem } from "~/components/faq-item";
|
||||
import { SiteShell } from "~/components/site-shell";
|
||||
@@ -63,7 +64,10 @@ function Hub() {
|
||||
const { plans } = Route.useLoaderData();
|
||||
return (
|
||||
<SiteShell width="default">
|
||||
<h1 className="text-3xl font-medium tracking-tight mb-4">{t("hub.title")}</h1>
|
||||
<h1 className="mb-5">
|
||||
<PaseoHubLockup className="h-9 md:h-10 w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.title")}</span>
|
||||
</h1>
|
||||
<p className="text-lg text-white/70 leading-relaxed max-w-2xl">{t("hub.intro")}</p>
|
||||
<p className="text-white/40 text-sm mt-3">{t("hub.runIt")}</p>
|
||||
|
||||
@@ -379,7 +383,7 @@ function DemoMessage({
|
||||
<div className="flex gap-3">
|
||||
<div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.06]">
|
||||
{bot ? (
|
||||
<img src="/logo.svg" alt="" className="h-4 w-4" />
|
||||
<PaseoHubMark className="h-5 w-5 text-white" />
|
||||
) : (
|
||||
<span className="text-xs font-medium text-white/60">M</span>
|
||||
)}
|
||||
@@ -478,8 +482,11 @@ function Shape() {
|
||||
<Connector label={t("hub.shape.webhooks")} />
|
||||
|
||||
<div className="w-full max-w-xs rounded-xl border border-white/20 bg-white/[0.06] px-6 py-5 text-center">
|
||||
<p className="font-medium">{t("hub.shape.hub")}</p>
|
||||
<p className="text-xs text-muted-foreground mt-1">{t("hub.shape.hubHosting")}</p>
|
||||
<p className="flex justify-center">
|
||||
<HubLockup className="h-[22px] w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.shape.hub")}</span>
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground mt-1.5">{t("hub.shape.hubHosting")}</p>
|
||||
</div>
|
||||
|
||||
<Connector label={t("hub.shape.sameRpcs")} />
|
||||
|
||||
@@ -2,3 +2,8 @@ declare module "*.md?raw" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.svg?raw" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
@@ -65,9 +65,46 @@ it("discovers the resolved account and maps the CLI's quota buckets", async () =
|
||||
expect(await source.fetch(accounts[0]!.input)).toMatchObject({
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "gemini-5h", usedPct: 75, remainingPct: 25, resetsAt: "2026-11-19T14:25:08Z" },
|
||||
{ id: "gemini-weekly", usedPct: expect.closeTo(30), summary: true },
|
||||
{ id: "disabled", usedPct: null, remainingPct: null },
|
||||
{
|
||||
id: "gemini-5h",
|
||||
shortLabel: "5h",
|
||||
usedPct: 75,
|
||||
remainingPct: 25,
|
||||
resetsAt: "2026-11-19T14:25:08Z",
|
||||
},
|
||||
{ id: "gemini-weekly", shortLabel: "wk", usedPct: expect.closeTo(30), summary: true },
|
||||
{ id: "disabled", shortLabel: "wk", usedPct: null, remainingPct: null },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("uses compact group and period shorthands when multiple groups are reported", async () => {
|
||||
const directory = await mkdtemp(path.join(tmpdir(), "paseo-antigravity-usage-"));
|
||||
directories.push(directory);
|
||||
const cli = path.join(directory, "cli.cjs");
|
||||
await writeFile(
|
||||
cli,
|
||||
`
|
||||
console.log(JSON.stringify({ status: 'SUCCESS', command: { name: 'usage', data: { groups: [
|
||||
{ name: 'Gemini Models', buckets: [
|
||||
{ id: 'gemini-weekly', name: 'Weekly Limit Remaining', window: 'weekly', remaining_fraction: 0.9 },
|
||||
{ id: 'gemini-5h', name: 'Five Hour Limit Remaining', window: '5h', remaining_fraction: 0.8 }
|
||||
] },
|
||||
{ name: 'Claude and GPT models', buckets: [
|
||||
{ id: '3p-weekly', name: 'Weekly Limit Remaining', window: 'weekly', remaining_fraction: 1 }
|
||||
] }
|
||||
] } } }));
|
||||
`,
|
||||
);
|
||||
const launch = { command: process.execPath, args: [cli, "acp"], env: { HOME: directory } };
|
||||
const source = new Usage().registration();
|
||||
const [account] = await source.discover({ kind: "global", launch });
|
||||
expect(await source.fetch(account!.input)).toMatchObject({
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "gemini-weekly", shortLabel: "Gemini wk" },
|
||||
{ id: "gemini-5h", shortLabel: "Gemini 5h" },
|
||||
{ id: "3p-weekly", shortLabel: "Claude and GPT wk" },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,6 +48,28 @@ function accountKey(env: ProviderLaunch["env"]): string {
|
||||
);
|
||||
}
|
||||
|
||||
function shortWindow(window: string): string {
|
||||
const trimmed = window.trim();
|
||||
const normalized = trimmed.toLowerCase();
|
||||
if (normalized === "weekly") return "wk";
|
||||
if (normalized === "monthly") return "mo";
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
function shortGroupName(name: string): string {
|
||||
return name
|
||||
.trim()
|
||||
.replace(/\s+models$/i, "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function formatShortLabel(groupName: string, window: string, includeGroup: boolean): string {
|
||||
const period = shortWindow(window);
|
||||
if (!includeGroup) return period;
|
||||
const scope = shortGroupName(groupName);
|
||||
return scope ? `${scope} ${period}` : period;
|
||||
}
|
||||
|
||||
export class Usage {
|
||||
private readonly launches = new Map<string, ProviderLaunch>();
|
||||
|
||||
@@ -94,7 +116,9 @@ export class Usage {
|
||||
throw new Error(data.error || data.response || `agy usage returned ${data.status}`);
|
||||
}
|
||||
if (!data.command) throw new Error("agy did not return usage data");
|
||||
const windows = data.command.data.groups.flatMap((group) =>
|
||||
const groups = data.command.data.groups;
|
||||
const includeGroup = groups.length > 1;
|
||||
const windows = groups.flatMap((group) =>
|
||||
group.buckets.flatMap((bucket) => {
|
||||
if (!bucket.disabled && bucket.remaining_fraction == null) return [];
|
||||
const used = bucket.disabled ? null : (1 - bucket.remaining_fraction!) * 100;
|
||||
@@ -102,7 +126,7 @@ export class Usage {
|
||||
windowFromUsedPct({
|
||||
id: bucket.id,
|
||||
label: `${group.name} · ${bucket.name}${bucket.disabled ? " · Disabled" : ""}`,
|
||||
shortLabel: `${group.name} ${bucket.window}`,
|
||||
shortLabel: formatShortLabel(group.name, bucket.window, includeGroup),
|
||||
summary: !bucket.disabled && bucket.window === "weekly",
|
||||
utilizationPct: used,
|
||||
resetsAt: bucket.disabled ? null : bucket.reset_time,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="M20.9093 19.3861L19.5185 18.2413C18.7624 17.619 18.1189 16.8713 17.6157 16.0313C16.9205 14.8706 15.9599 13.8912 14.8133 13.1735L14.2533 12.8475C14.0614 12.7141 13.9276 12.5062 13.9086 12.2716C13.8963 12.1204 13.9326 11.9852 14.0171 11.8662C14.3087 11.4553 15.896 9.74698 16.1722 9.51845C16.528 9.22442 16.9243 8.97987 17.2921 8.69986C17.3443 8.66 17.3968 8.62035 17.4485 8.57989C17.4503 8.57808 17.4529 8.57668 17.4545 8.57508C17.5725 8.48195 17.6838 8.383 17.7724 8.26563C18.2036 7.76631 18.195 7.3443 18.195 7.3443C18.195 7.3443 18.1954 7.3439 18.1956 7.3437C18.1497 7.23133 17.9847 6.88163 17.6492 6.71759C17.9458 6.71178 18.2805 6.82294 18.4323 6.97156C18.6148 6.68534 18.7328 6.49967 18.9162 6.18762C18.9599 6.11352 18.9831 5.97652 18.8996 5.89981C18.8996 5.89981 18.8992 5.89981 18.8988 5.89981C18.8988 5.89981 18.8988 5.8994 18.8988 5.899C18.8972 5.8974 18.8952 5.8962 18.8936 5.8946C18.892 5.893 18.891 5.89119 18.8892 5.88939C18.8892 5.88939 18.8888 5.88939 18.8884 5.88939C18.8884 5.88939 18.8884 5.88899 18.8884 5.88859C18.885 5.88518 18.8812 5.88258 18.8776 5.87938C18.8754 5.87717 18.8736 5.87457 18.8716 5.87217C18.8692 5.87016 18.8665 5.86836 18.8643 5.86616C18.8609 5.86275 18.8587 5.85855 18.8551 5.85534C18.8551 5.85534 18.8545 5.85514 18.8543 5.85534C18.8543 5.85534 18.8543 5.85494 18.8543 5.85454C18.8527 5.85294 18.8507 5.85174 18.8491 5.85013C18.8475 5.84853 18.8463 5.84653 18.8447 5.84493C18.8447 5.84493 18.8441 5.84473 18.8439 5.84493C18.8439 5.84493 18.8439 5.84453 18.8439 5.84413C18.7672 5.7606 18.6302 5.78384 18.5561 5.8275C18.1503 6.06625 17.7555 6.32322 17.3996 6.54855C17.3996 6.54855 16.9778 6.53973 16.4783 6.97116C16.3607 7.05989 16.2618 7.17125 16.1688 7.28902C16.167 7.29082 16.1654 7.29322 16.164 7.29503C16.1234 7.3465 16.0837 7.39898 16.0441 7.45145C15.7639 7.81939 15.5195 8.21556 15.2255 8.57128C14.9971 8.84768 13.2887 10.4348 12.8777 10.7264C12.7587 10.8109 12.6237 10.8474 12.4723 10.835C12.2379 10.8161 12.0298 10.6821 11.8965 10.4903L11.5704 9.93024C10.8527 8.78318 9.87332 7.82299 8.71264 7.12778C7.87262 6.62466 7.12514 5.98092 6.50264 5.22503L5.35778 3.83421C5.3013 3.76571 5.19314 3.77693 5.15268 3.85585C5.02249 4.10941 4.77393 4.64479 4.58346 5.36483C4.57885 5.38186 4.58286 5.39988 4.59407 5.4135C4.83082 5.69952 5.37901 6.32983 6.03196 6.863C6.07742 6.90005 6.04017 6.97336 5.98369 6.95774C5.42047 6.80432 4.87288 6.55796 4.46308 6.34805C4.42964 6.33103 4.38918 6.35226 4.38437 6.38951C4.32068 6.89985 4.30425 7.46027 4.37155 8.05112C4.37355 8.07035 4.38577 8.08697 4.4036 8.09479C4.87088 8.29808 5.61816 8.59311 6.40269 8.78078C6.45958 8.7944 6.45777 8.87632 6.40029 8.88733C5.78941 9.0023 5.14968 9.02794 4.62973 9.02113C4.59327 9.02073 4.56643 9.05518 4.57625 9.09023C4.6806 9.45896 4.822 9.8339 5.00847 10.2115C5.08559 10.3811 5.16951 10.5475 5.25944 10.7104C5.27486 10.7382 5.3047 10.7548 5.33655 10.7534C5.76577 10.7324 6.28452 10.6871 6.80608 10.595C6.89501 10.5794 6.94268 10.6964 6.86757 10.7466C6.51345 10.9834 6.13571 11.1873 5.7844 11.3551C5.73733 11.3777 5.72211 11.4378 5.75315 11.4797C5.96186 11.7625 6.19139 12.0301 6.44075 12.2794C6.44075 12.2794 7.66853 13.5441 7.70198 13.6432C8.41841 12.9096 9.59612 12.0964 10.8966 11.3864C9.15488 12.8036 8.18387 13.8499 7.69517 14.4444L7.35447 14.9225C7.17742 15.1708 7.02379 15.4346 6.89541 15.7112C6.46579 16.6356 5.75756 18.5051 5.75756 18.5051C5.70328 18.6515 5.74754 18.7959 5.84168 18.89C5.84388 18.8922 5.84609 18.8944 5.84849 18.8964C5.85069 18.8986 5.8527 18.901 5.8549 18.9032C5.94924 18.9976 6.09345 19.0416 6.23986 18.9874C6.23986 18.9874 8.10897 18.2791 9.03371 17.8495C9.31031 17.7211 9.57429 17.5673 9.82245 17.3905L10.349 17.0153C10.6278 16.8166 11.0096 16.8483 11.2517 17.0904L12.4655 18.3042C12.7148 18.5535 12.9824 18.7831 13.2652 18.9918C13.3073 19.0226 13.3672 19.0076 13.3898 18.9605C13.5579 18.6094 13.7618 18.2313 13.9983 17.8774C14.0486 17.8022 14.1657 17.8501 14.1499 17.9388C14.0576 18.4606 14.0127 18.9794 13.9915 19.4084C13.9899 19.44 14.0067 19.4701 14.0345 19.4855C14.1972 19.5756 14.3636 19.6595 14.5335 19.7364C14.911 19.9229 15.2862 20.0645 15.6547 20.1687C15.6897 20.1785 15.7242 20.1516 15.7238 20.1152C15.7168 19.595 15.7424 18.9553 15.8576 18.3446C15.8684 18.2869 15.9503 18.2851 15.9641 18.3422C16.1516 19.127 16.4466 19.8742 16.6501 20.3413C16.6579 20.3591 16.6744 20.3712 16.6938 20.3734C17.2847 20.4407 17.8451 20.4242 18.3554 20.3606C18.3929 20.3559 18.4141 20.3155 18.3969 20.2818C18.187 19.872 17.9406 19.3241 17.7872 18.7612C17.7718 18.7046 17.8449 18.6675 17.8819 18.713C18.4151 19.3659 19.0454 19.9141 19.3314 20.1508C19.345 20.1621 19.3633 20.1659 19.3801 20.1615C20.1003 19.9712 20.6357 19.7226 20.8891 19.5922C20.968 19.5518 20.9792 19.4436 20.9107 19.3871L20.9093 19.3861Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
@@ -0,0 +1,7 @@
|
||||
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
||||
import { createGooseProvider } from "./server/provider.js";
|
||||
|
||||
export default function contribute(server: PluginServerContext) {
|
||||
server.registerProvider(createGooseProvider());
|
||||
return () => {};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "id": "goose-provider", "requirements": { "paseo": ">=0.17.0" } }
|
||||
@@ -0,0 +1,135 @@
|
||||
import type { AcpConfigureContext, AcpRequest } from "@getpaseo/plugin/server/acp";
|
||||
import type { ProviderCatalog, ProviderConfigState } from "@getpaseo/plugin/server/provider";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { gooseModels } from "./models.js";
|
||||
|
||||
const routerModel = "anthropic/claude-sonnet-4.5";
|
||||
const baseCatalog: ProviderCatalog = {
|
||||
models: [{ id: routerModel, label: "Sonnet" }],
|
||||
modes: [],
|
||||
defaultModel: routerModel,
|
||||
};
|
||||
|
||||
const configuredProviders: AcpRequest = async (method, params) => {
|
||||
if (method === "_goose/unstable/providers/list") {
|
||||
expect(params).toEqual({ providerIds: [] });
|
||||
return {
|
||||
entries: [
|
||||
{
|
||||
providerId: "openrouter",
|
||||
providerName: "OpenRouter",
|
||||
configured: true,
|
||||
models: [{ id: routerModel, name: "Sonnet" }],
|
||||
},
|
||||
{
|
||||
providerId: "openai",
|
||||
providerName: "OpenAI",
|
||||
configured: true,
|
||||
models: [{ id: "gpt-4o", name: "GPT-4o" }],
|
||||
},
|
||||
{
|
||||
providerId: "anthropic",
|
||||
providerName: "Anthropic",
|
||||
configured: false,
|
||||
models: [{ id: "sonnet", name: "Sonnet" }],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
expect(method).toBe("_goose/unstable/config/read");
|
||||
if (params && typeof params === "object" && "key" in params) {
|
||||
if (params.key === "GOOSE_PROVIDER") return { value: "openrouter" };
|
||||
if (params.key === "GOOSE_MODEL") return { value: routerModel };
|
||||
}
|
||||
throw new Error("Unexpected config key");
|
||||
};
|
||||
|
||||
function configContext(request = configuredProviders) {
|
||||
const writes: Array<[string, unknown]> = [];
|
||||
const context: AcpConfigureContext = {
|
||||
sessionId: "goose-session",
|
||||
request,
|
||||
config: {
|
||||
async read() {
|
||||
return {};
|
||||
},
|
||||
async set(id, value) {
|
||||
writes.push([id, value]);
|
||||
},
|
||||
},
|
||||
catalog: () => baseCatalog,
|
||||
apply: async () => {},
|
||||
};
|
||||
return { context, writes };
|
||||
}
|
||||
|
||||
describe("goose model transformer", () => {
|
||||
it("lists configured providers and keeps slash-delimited model IDs intact", async () => {
|
||||
const { context } = configContext();
|
||||
expect(await gooseModels.discover(baseCatalog, context)).toEqual({
|
||||
...baseCatalog,
|
||||
models: [
|
||||
{ id: `openrouter/${routerModel}`, label: "Sonnet", description: "OpenRouter" },
|
||||
{ id: "openai/gpt-4o", label: "GPT-4o", description: "OpenAI" },
|
||||
],
|
||||
defaultModel: `openrouter/${routerModel}`,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the base catalog when the RPC is unavailable", async () => {
|
||||
const { context } = configContext(async () => {
|
||||
throw new Error("Method not found");
|
||||
});
|
||||
expect(await gooseModels.discover(baseCatalog, context)).toBe(baseCatalog);
|
||||
});
|
||||
|
||||
it("keeps the base catalog when no providers are configured", async () => {
|
||||
const { context } = configContext(async () => ({ entries: [] }));
|
||||
expect(await gooseModels.discover(baseCatalog, context)).toBe(baseCatalog);
|
||||
});
|
||||
|
||||
it("sets the provider before the model and preserves slashes in the model", async () => {
|
||||
const { context, writes } = configContext();
|
||||
const result = await gooseModels.configure(
|
||||
{ target: "model", value: `openrouter/${routerModel}` },
|
||||
context,
|
||||
);
|
||||
expect(result).toBe("handled");
|
||||
expect(writes).toEqual([
|
||||
["provider", "openrouter"],
|
||||
["model", routerModel],
|
||||
]);
|
||||
});
|
||||
|
||||
it.each(["gpt-4o", routerModel])("passes the legacy model %s through", async (value) => {
|
||||
const { context, writes } = configContext();
|
||||
expect(await gooseModels.configure({ target: "model", value }, context)).toBe("pass");
|
||||
expect(writes).toEqual([]);
|
||||
});
|
||||
|
||||
function snapshotFor(provider: string): ProviderConfigState {
|
||||
return {
|
||||
model: routerModel,
|
||||
models: baseCatalog.models,
|
||||
modes: [],
|
||||
thinkingOptions: [],
|
||||
settings: [
|
||||
{ type: "select", id: "provider", label: "Provider", value: provider, options: [] },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
it("namespaces models in a snapshot for an explicit provider", () => {
|
||||
const snapshot = snapshotFor("openrouter");
|
||||
expect(gooseModels.config(snapshot)).toEqual({
|
||||
...snapshot,
|
||||
model: `openrouter/${routerModel}`,
|
||||
models: [{ id: `openrouter/${routerModel}`, label: "Sonnet" }],
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the snapshot unchanged while goose Default is selected", () => {
|
||||
const snapshot = snapshotFor("goose");
|
||||
expect(gooseModels.config(snapshot)).toBe(snapshot);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import type { AcpRequest, AcpTransformer } from "@getpaseo/plugin/server/acp";
|
||||
import { z } from "zod";
|
||||
|
||||
const inventorySchema = z.object({
|
||||
entries: z.array(
|
||||
z.object({
|
||||
providerId: z.string(),
|
||||
providerName: z.string(),
|
||||
configured: z.boolean(),
|
||||
models: z.array(z.object({ id: z.string(), name: z.string() })),
|
||||
}),
|
||||
),
|
||||
});
|
||||
const configValueSchema = z.object({ value: z.string().min(1) });
|
||||
|
||||
async function configuredProviders(request: AcpRequest) {
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once supported goose versions have this RPC.
|
||||
const response = await request("_goose/unstable/providers/list", { providerIds: [] }).catch(
|
||||
() => null,
|
||||
);
|
||||
const inventory = inventorySchema.safeParse(response);
|
||||
return inventory.success ? inventory.data.entries.filter((entry) => entry.configured) : [];
|
||||
}
|
||||
|
||||
async function readDefault(request: AcpRequest, key: "GOOSE_PROVIDER" | "GOOSE_MODEL") {
|
||||
const response = await request("_goose/unstable/config/read", { key }).catch(() => null);
|
||||
const parsed = configValueSchema.safeParse(response);
|
||||
return parsed.success ? parsed.data.value : undefined;
|
||||
}
|
||||
|
||||
export const gooseModels = {
|
||||
async discover(catalog, { request }) {
|
||||
const providers = await configuredProviders(request);
|
||||
if (providers.length === 0) return catalog;
|
||||
|
||||
const models = providers.flatMap((provider) =>
|
||||
provider.models.map((model) => ({
|
||||
id: `${provider.providerId}/${model.id}`,
|
||||
label: model.name,
|
||||
description: provider.providerName,
|
||||
})),
|
||||
);
|
||||
if (models.length === 0) return catalog;
|
||||
|
||||
const [providerId, modelId] = await Promise.all([
|
||||
readDefault(request, "GOOSE_PROVIDER"),
|
||||
readDefault(request, "GOOSE_MODEL"),
|
||||
]);
|
||||
return {
|
||||
...catalog,
|
||||
models,
|
||||
defaultModel: providerId && modelId ? `${providerId}/${modelId}` : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
async configure(change, { config, request }) {
|
||||
if (change.target !== "model" || !change.value) return "pass";
|
||||
const separator = change.value.indexOf("/");
|
||||
if (separator <= 0) return "pass";
|
||||
|
||||
const providerId = change.value.slice(0, separator);
|
||||
const providers = await configuredProviders(request);
|
||||
if (!providers.some((provider) => provider.providerId === providerId)) return "pass";
|
||||
|
||||
await config.set("provider", providerId);
|
||||
await config.set("model", change.value.slice(separator + 1));
|
||||
return "handled";
|
||||
},
|
||||
|
||||
config(state) {
|
||||
const provider = state.settings?.find((setting) => setting.id === "provider");
|
||||
if (provider?.type !== "select" || !provider.value || provider.value === "goose") {
|
||||
return state;
|
||||
}
|
||||
const namespace = (modelId: string) => `${provider.value}/${modelId}`;
|
||||
return {
|
||||
...state,
|
||||
model: state.model === undefined ? undefined : namespace(state.model),
|
||||
models: state.models.map((model) => ({ ...model, id: namespace(model.id) })),
|
||||
};
|
||||
},
|
||||
} satisfies AcpTransformer;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { runAcpProvider } from "@getpaseo/plugin/server/acp";
|
||||
import type { ProviderRegistration } from "@getpaseo/plugin/server/provider";
|
||||
import { gooseModels } from "./models.js";
|
||||
|
||||
export function createGooseProvider(): ProviderRegistration {
|
||||
return {
|
||||
requiresConfiguration: true,
|
||||
...runAcpProvider({
|
||||
id: "goose",
|
||||
label: "goose",
|
||||
description: "A local, extensible, open source AI agent that automates engineering tasks",
|
||||
icon: "icon.svg",
|
||||
command: ["goose", "acp"],
|
||||
transformers: [gooseModels],
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -572,7 +572,12 @@ export default function contribute(server: PluginServerContext) {
|
||||
The shim owns the ACP process, capability mapping, session lifecycle, prompts, permissions, and
|
||||
timeline conversion. Do not copy that machinery into the plugin.
|
||||
|
||||
Use `transformers` only for vendor differences ACP cannot describe. Validate vendor payloads with
|
||||
Use `transformers` for vendor differences ACP cannot describe. The
|
||||
[goose model transformer](https://github.com/getpaseo/paseo/blob/main/plugins/goose-provider/server/models.ts)
|
||||
uses `context.request` to read the agent's model inventory and `config` to prefix session model IDs
|
||||
with the active provider. See the [ACP adapter reference](/docs/plugins/reference#providers).
|
||||
|
||||
Validate vendor payloads with
|
||||
Zod and leave malformed or unrelated values unchanged:
|
||||
|
||||
```ts
|
||||
|
||||
@@ -472,7 +472,12 @@ export default function contribute(server: PluginServerContext) {
|
||||
|
||||
适配层负责 ACP 进程、能力映射、会话生命周期、提示词、权限和时间线转换。不要把这些机制复制到插件中。
|
||||
|
||||
只在 ACP 无法描述厂商差异时使用 `transformers`。用 Zod 校验厂商负载,并让格式错误或无关的值保持不变:
|
||||
使用 `transformers` 处理 ACP 无法描述的厂商差异。
|
||||
[goose 模型转换器](https://github.com/getpaseo/paseo/blob/main/plugins/goose-provider/server/models.ts)
|
||||
使用 `context.request` 读取 Agent 的模型列表,并使用 `config` 为会话的模型 ID 添加当前 Provider 前缀。
|
||||
参见 [ACP 适配器参考](/docs/plugins/reference#providers)。
|
||||
|
||||
用 Zod 校验厂商负载,并让格式错误或无关的值保持不变:
|
||||
|
||||
```ts
|
||||
import type { AcpTransformer } from "@getpaseo/plugin/server/acp";
|
||||
|
||||
@@ -433,7 +433,14 @@ Paseo refreshes an agent by closing its current provider session and opening it
|
||||
configuration and persistence. Providers re-read external state during `session.open`.
|
||||
|
||||
Use `runAcpProvider()` from `@getpaseo/plugin/server/acp` to adapt a command-backed ACP. Add transformer
|
||||
hooks only for a vendor's discovery, configuration, notification, or tool-call differences.
|
||||
hooks for vendor behavior. See [Adapt an ACP agent](/docs/plugins/providers#adapt-an-acp-agent).
|
||||
|
||||
In `discover` and `configure`, call `context.request(method, params)` to send an ACP extension
|
||||
request. The promise returns a JSON value or rejects with the agent's JSON-RPC error.
|
||||
|
||||
Use `config(state, context)` to return the configuration snapshot that Paseo displays.
|
||||
Paseo calls this synchronous hook for initial, notification, and committed configuration snapshots.
|
||||
Use `configure` to send changes to the agent.
|
||||
|
||||
`ProviderRegistration.icon` is a file path relative to the plugin directory, such as `icon.svg`.
|
||||
It must resolve inside that directory to a regular file that follows the
|
||||
|
||||
@@ -363,7 +363,14 @@ Provider 选项是一个记录,即 `session.open` 中的 `ProviderSessionConfi
|
||||
|
||||
Paseo 刷新 Agent 的方式是关闭它当前的 Provider 会话,再用当前的配置和持久化值打开它。Provider 在 `session.open` 期间重新读取外部状态。
|
||||
|
||||
使用 `@getpaseo/plugin/server/acp` 中的 `runAcpProvider()` 适配一个基于命令的 ACP。只针对厂商在发现、配置、通知或工具调用方面的差异添加转换器钩子。
|
||||
使用 `@getpaseo/plugin/server/acp` 中的 `runAcpProvider()` 适配一个基于命令的 ACP。使用转换器钩子处理厂商特有的行为。参见[适配 ACP Agent](/docs/plugins/providers#adapt-an-acp-agent)。
|
||||
|
||||
在 `discover` 和 `configure` 中,调用 `context.request(method, params)` 发送 ACP 扩展请求。
|
||||
Promise 返回 JSON 值,或以 Agent 的 JSON-RPC 错误拒绝。
|
||||
|
||||
使用 `config(state, context)` 返回 Paseo 显示的配置快照。
|
||||
Paseo 在会话就绪、收到配置通知或提交配置更改时调用此同步钩子。
|
||||
使用 `configure` 向 Agent 发送更改。
|
||||
|
||||
`ProviderRegistration.icon` 是相对于插件目录的文件路径,例如 `icon.svg`。它必须解析到该目录内一个遵循 [SVG 图标规则](#svg-rules)的普通文件。Paseo 在插件启动时读取并校验该文件;这个字符串从不是内联 SVG 或 URL。
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ To add one, open **Settings → Hosts → your host → Providers**, select **+
|
||||
- [Gajae Code](https://gajae-code.com), subscription-based coding agent with plan-before-mutation workflows.
|
||||
- [Gemini CLI](https://geminicli.com), Google's official Gemini CLI.
|
||||
- [GLM Agent](https://github.com/stefandevo/glm-acp-agent), Zhipu AI's GLM coding agent.
|
||||
- [goose](https://block.github.io/goose/), Block's local open-source AI agent.
|
||||
- [goose](https://block.github.io/goose/), Block's local open-source AI agent. Paseo lists models from all providers configured in goose when goose supports model inventory discovery.
|
||||
- [Grok](https://docs.x.ai/build/overview), xAI's Grok Build agentic coding CLI.
|
||||
- [Hermes Agent](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp), Nous Research's self-improving agent.
|
||||
- [Junie](https://junie.jetbrains.com/docs/junie-cli-acp.html), JetBrains' coding agent.
|
||||
|
||||
@@ -49,7 +49,7 @@ Paseo 可以运行任何使用 [Agent Client Protocol](https://agentclientprotoc
|
||||
- [Gajae Code](https://gajae-code.com):订阅制编程 Agent,采用先规划再修改的工作流。
|
||||
- [Gemini CLI](https://geminicli.com):Google 官方的 Gemini CLI。
|
||||
- [GLM Agent](https://github.com/stefandevo/glm-acp-agent):智谱 AI 的 GLM 编程 Agent。
|
||||
- [goose](https://block.github.io/goose/):Block 的本地开源 AI Agent。
|
||||
- [goose](https://block.github.io/goose/):Block 的本地开源 AI Agent。如果 goose 支持发现模型清单,Paseo 会列出 goose 中所有已配置 Provider 的模型。
|
||||
- [Grok](https://docs.x.ai/build/overview):xAI 的 Grok Build Agent 编程 CLI。
|
||||
- [Hermes Agent](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp):Nous Research 的自我改进型 Agent。
|
||||
- [Junie](https://junie.jetbrains.com/docs/junie-cli-acp.html):JetBrains 的编程 Agent。
|
||||
|
||||