源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
commit
2ed3415fb7
8018 files changed
+1936476
No files matched your search
+86
@@ -0,0 +1,86 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { AgentGUIProviderSkillOption } from "../../../model/agentGuiNodeTypes";
|
||||
import {
|
||||
projectConnectorComposerItems,
|
||||
projectConnectorPaletteItem,
|
||||
projectConnectorSelectionItems
|
||||
} from "./connectorPresentation";
|
||||
|
||||
function connector(
|
||||
connectorKey: string,
|
||||
status: AgentGUIProviderSkillOption["status"]
|
||||
): AgentGUIProviderSkillOption {
|
||||
return {
|
||||
connectorKey,
|
||||
kind: "connector",
|
||||
name: `Connector ${connectorKey}`,
|
||||
sourceKind: "connector",
|
||||
status,
|
||||
trigger: `/${connectorKey}`
|
||||
};
|
||||
}
|
||||
|
||||
describe("connector presentation projection", () => {
|
||||
it("projects only identified connectors and keeps authorization separate from draft selection", () => {
|
||||
expect(
|
||||
projectConnectorComposerItems(
|
||||
[
|
||||
{ name: "Ordinary skill", sourceKind: "personal", trigger: "$skill" },
|
||||
connector("github", "available"),
|
||||
connector("notion", "authRequired"),
|
||||
{ ...connector("", "setupRequired"), connectorKey: " " }
|
||||
],
|
||||
["github"]
|
||||
)
|
||||
).toEqual([
|
||||
expect.objectContaining({
|
||||
connectorKey: "github",
|
||||
selected: true,
|
||||
status: "connected"
|
||||
}),
|
||||
expect.objectContaining({
|
||||
connectorKey: "notion",
|
||||
selected: false,
|
||||
status: "authorization_required"
|
||||
})
|
||||
]);
|
||||
});
|
||||
|
||||
it("projects draft labels and palette status from the authoritative option", () => {
|
||||
const notion = {
|
||||
...connector("notion", "unsupported"),
|
||||
iconUrl: "/notion.png",
|
||||
name: "Notion"
|
||||
};
|
||||
|
||||
expect(
|
||||
projectConnectorSelectionItems(
|
||||
[{ connectorKey: "notion" }, { connectorKey: "missing" }],
|
||||
[notion]
|
||||
)
|
||||
).toEqual([
|
||||
{ connectorKey: "notion", iconUrl: "/notion.png", name: "Notion" },
|
||||
{ connectorKey: "missing", iconUrl: undefined, name: "missing" }
|
||||
]);
|
||||
expect(
|
||||
projectConnectorPaletteItem(notion, "notion", "Workspace search")
|
||||
).toEqual({
|
||||
connectorKey: "notion",
|
||||
description: "Workspace search",
|
||||
iconUrl: "/notion.png",
|
||||
label: "notion",
|
||||
status: "unsupported"
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves the stopped runtime state for the composer switch", () => {
|
||||
expect(
|
||||
projectConnectorComposerItems([connector("linear", "disabled")])
|
||||
).toEqual([
|
||||
expect.objectContaining({
|
||||
connectorKey: "linear",
|
||||
status: "disabled"
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
import type {
|
||||
ConnectorComposerItem,
|
||||
ConnectorPaletteItemModel,
|
||||
ConnectorSelectionItem
|
||||
} from "@tutti-os/connector-renderer/ui";
|
||||
import type {
|
||||
AgentComposerDraftConnector,
|
||||
AgentGUIProviderSkillOption
|
||||
} from "../../../model/agentGuiNodeTypes";
|
||||
|
||||
export function isConnectorOption(
|
||||
option: AgentGUIProviderSkillOption
|
||||
): boolean {
|
||||
return option.sourceKind === "connector" || option.kind === "connector";
|
||||
}
|
||||
|
||||
export function projectConnectorComposerItems(
|
||||
options: readonly AgentGUIProviderSkillOption[],
|
||||
selectedConnectorKeys: readonly string[] = []
|
||||
): ConnectorComposerItem[] {
|
||||
const items: ConnectorComposerItem[] = [];
|
||||
const selectedKeys = new Set(
|
||||
selectedConnectorKeys
|
||||
.map((connectorKey) => connectorKey.trim())
|
||||
.filter(Boolean)
|
||||
);
|
||||
for (const option of options) {
|
||||
if (!isConnectorOption(option)) {
|
||||
continue;
|
||||
}
|
||||
const connectorKey = option.connectorKey?.trim() ?? "";
|
||||
if (!connectorKey) {
|
||||
continue;
|
||||
}
|
||||
items.push({
|
||||
connectorKey,
|
||||
description: option.description,
|
||||
iconUrl: option.iconUrl,
|
||||
installedAtUnixMs: option.installedAtUnixMs,
|
||||
name: option.name,
|
||||
selected: selectedKeys.has(connectorKey),
|
||||
status:
|
||||
option.status === "available"
|
||||
? "connected"
|
||||
: option.status === "disabled"
|
||||
? "disabled"
|
||||
: option.status === "authRequired"
|
||||
? "authorization_required"
|
||||
: "setup_required"
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
export function projectConnectorSelectionItems(
|
||||
drafts: readonly AgentComposerDraftConnector[],
|
||||
options: readonly AgentGUIProviderSkillOption[]
|
||||
): ConnectorSelectionItem[] {
|
||||
return drafts.map(({ connectorKey }) => {
|
||||
const option = options.find((skill) => skill.connectorKey === connectorKey);
|
||||
return {
|
||||
connectorKey,
|
||||
iconUrl: option?.iconUrl,
|
||||
name: option?.name.trim() || connectorKey
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function projectConnectorPaletteItem(
|
||||
option: AgentGUIProviderSkillOption,
|
||||
label: string,
|
||||
description?: string
|
||||
): ConnectorPaletteItemModel | null {
|
||||
if (!isConnectorOption(option)) {
|
||||
return null;
|
||||
}
|
||||
const connectorKey = option.connectorKey?.trim() ?? "";
|
||||
if (!connectorKey) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
connectorKey,
|
||||
description,
|
||||
iconUrl: option.iconUrl,
|
||||
label,
|
||||
status:
|
||||
option.status === "unsupported"
|
||||
? "unsupported"
|
||||
: option.status === "available"
|
||||
? "connected"
|
||||
: "setup_required"
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user