源码快照 @ 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
@@ -0,0 +1,83 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
groupAgentExternalPromptEntryInsertions,
|
||||
resolveAgentExternalPromptEntries,
|
||||
type AgentExternalPromptEntryResolver
|
||||
} from "./agentExternalPromptEntries";
|
||||
|
||||
describe("agentExternalPromptEntries", () => {
|
||||
it("preserves source order while separating references from prepared files", () => {
|
||||
const files = [
|
||||
new File(["a"], "a.txt"),
|
||||
new File([], "docs"),
|
||||
new File(["b"], "b.txt")
|
||||
];
|
||||
const resolver: AgentExternalPromptEntryResolver = () => [
|
||||
{ sourceIndex: 0, disposition: "prepare" },
|
||||
{
|
||||
sourceIndex: 1,
|
||||
disposition: "reference",
|
||||
reference: {
|
||||
displayName: "docs",
|
||||
kind: "folder",
|
||||
path: "/workspace/docs"
|
||||
}
|
||||
},
|
||||
{ sourceIndex: 2, disposition: "prepare" }
|
||||
];
|
||||
|
||||
expect(resolveAgentExternalPromptEntries(files, resolver)).toEqual([
|
||||
{ file: files[0], disposition: "prepare", sourceIndex: 0 },
|
||||
{
|
||||
disposition: "reference",
|
||||
reference: {
|
||||
displayName: "docs",
|
||||
kind: "folder",
|
||||
path: "/workspace/docs"
|
||||
},
|
||||
sourceIndex: 1
|
||||
},
|
||||
{ file: files[2], disposition: "prepare", sourceIndex: 2 }
|
||||
]);
|
||||
});
|
||||
|
||||
it("fails closed to preparation when host resolution is malformed", () => {
|
||||
const files = [new File(["a"], "a.txt"), new File(["b"], "b.txt")];
|
||||
|
||||
expect(
|
||||
resolveAgentExternalPromptEntries(files, () => [
|
||||
{
|
||||
sourceIndex: 0,
|
||||
disposition: "reference",
|
||||
reference: { kind: "file", path: "" }
|
||||
},
|
||||
{ sourceIndex: 0, disposition: "prepare" }
|
||||
])
|
||||
).toEqual([
|
||||
{ file: files[0], disposition: "prepare", sourceIndex: 0 },
|
||||
{ file: files[1], disposition: "prepare", sourceIndex: 1 }
|
||||
]);
|
||||
});
|
||||
|
||||
it("groups only adjacent preparation entries so mixed insertion order stays stable", () => {
|
||||
const files = [
|
||||
new File(["a"], "a.txt"),
|
||||
new File(["b"], "b.txt"),
|
||||
new File(["c"], "c.txt")
|
||||
];
|
||||
const reference = { kind: "folder" as const, path: "/workspace/docs" };
|
||||
|
||||
expect(
|
||||
groupAgentExternalPromptEntryInsertions([
|
||||
{ disposition: "prepare", file: files[0]!, sourceIndex: 0 },
|
||||
{ disposition: "prepare", file: files[1]!, sourceIndex: 1 },
|
||||
{ disposition: "reference", reference, sourceIndex: 2 },
|
||||
{ disposition: "prepare", file: files[2]!, sourceIndex: 3 }
|
||||
])
|
||||
).toEqual([
|
||||
{ disposition: "prepare", files: [files[0], files[1]] },
|
||||
{ disposition: "reference", reference },
|
||||
{ disposition: "prepare", files: [files[2]] }
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user