源码快照 @ 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,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
agentGUISharedAgentAllowsModel,
|
||||
agentGUISharedAgentAllowsPolicy,
|
||||
agentGUISharedAgentUnavailableReason,
|
||||
normalizeAgentGUISharedAgentAccess
|
||||
} from "./sharedAgentAccess";
|
||||
|
||||
describe("shared Agent access projection", () => {
|
||||
const access = {
|
||||
grantId: " grant-1 ",
|
||||
ownerUserId: " owner-1 ",
|
||||
ownerOnline: true,
|
||||
auditRequired: true,
|
||||
costQuota: {
|
||||
currency: " usd ",
|
||||
remainingMicros: 250_000,
|
||||
limitMicros: 1_000_000
|
||||
},
|
||||
allowedModels: [
|
||||
{ modelPlanId: " plan-1 ", model: " model-a " },
|
||||
{ modelPlanId: "plan-1", model: "model-a" }
|
||||
],
|
||||
policyPermissions: {
|
||||
consult: true,
|
||||
review: true,
|
||||
delegate: false,
|
||||
upgrade: false
|
||||
}
|
||||
} as const;
|
||||
|
||||
it("normalizes model, cost, and policy restrictions without credentials", () => {
|
||||
expect(normalizeAgentGUISharedAgentAccess(access)).toMatchObject({
|
||||
grantId: "grant-1",
|
||||
ownerUserId: "owner-1",
|
||||
costQuota: {
|
||||
currency: "USD",
|
||||
remainingMicros: 250_000,
|
||||
limitMicros: 1_000_000
|
||||
},
|
||||
allowedModels: [{ modelPlanId: "plan-1", model: "model-a" }]
|
||||
});
|
||||
expect(agentGUISharedAgentAllowsModel(access, "plan-1", "model-a")).toBe(
|
||||
true
|
||||
);
|
||||
expect(agentGUISharedAgentAllowsModel(access, "plan-1", "model-b")).toBe(
|
||||
false
|
||||
);
|
||||
expect(
|
||||
agentGUISharedAgentAllowsModel(
|
||||
{ ...access, allowedModels: [{ model: "model-a" }] },
|
||||
"another-compatible-plan",
|
||||
"model-a"
|
||||
)
|
||||
).toBe(true);
|
||||
expect(agentGUISharedAgentAllowsPolicy(access, "delegate")).toBe(false);
|
||||
expect(agentGUISharedAgentAllowsPolicy(access, "review")).toBe(true);
|
||||
});
|
||||
|
||||
it("disables new calls when the Owner cost allowance is exhausted", () => {
|
||||
expect(
|
||||
agentGUISharedAgentUnavailableReason({
|
||||
...access,
|
||||
costQuota: { currency: "USD", remainingMicros: 0 }
|
||||
})
|
||||
).toBe("share_cost_limit_exhausted");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user