ruth is created from a ruth archetype that runs sonnet
This commit is contained in:
parent
aff8cf629d
commit
5233259b3b
1 changed files with 236 additions and 115 deletions
|
|
@ -1,15 +1,14 @@
|
|||
// The setup assistant: its "is ruth missing" check and the permissions it
|
||||
// creates her with. Run by `npm test`.
|
||||
// The setup assistant: its "is ruth missing" check and the archetype it
|
||||
// creates her from. Run by `npm test`.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { RUTH_ARCHETYPE, ruthIsMissing } from "../src/shell/ruth-missing.ts";
|
||||
import {
|
||||
RUTH_EXTRA_PERMISSIONS,
|
||||
ruthIsMissing,
|
||||
} from "../src/shell/ruth-missing.ts";
|
||||
import {
|
||||
initialSelection,
|
||||
requestPermissions,
|
||||
} from "../src/pages/CreateAgentPermissions.ts";
|
||||
findArchetype,
|
||||
prefill,
|
||||
requestArchetype,
|
||||
} from "../src/pages/CreateAgentArchetype.ts";
|
||||
import { requestPermissions } from "../src/pages/CreateAgentPermissions.ts";
|
||||
|
||||
const answering =
|
||||
(body, ok = true) =>
|
||||
|
|
@ -58,27 +57,44 @@ test("anything but a clear answer is not missing", async () => {
|
|||
);
|
||||
});
|
||||
|
||||
// The assistant's create form sends `manage_root_agent`, `logs` and `metrics` with
|
||||
// the default set, so a new ruth holds them from her first start; the default
|
||||
// alone does not.
|
||||
test("the assistant creates ruth with manage_root_agent, logs and metrics", () => {
|
||||
const defaults = ["messaging", "meta", "inbox", "execution"];
|
||||
const all = [
|
||||
const defaults = ["messaging", "meta", "inbox", "execution"];
|
||||
const listed = [
|
||||
{ source: "hyperhive", name: "reviewer", description: "reviews" },
|
||||
{
|
||||
source: "hyperhive",
|
||||
name: "ruth",
|
||||
description: "manager",
|
||||
permissions: [...defaults, "manage_root_agent", "logs", "metrics"],
|
||||
inference: { model: "sonnet" },
|
||||
},
|
||||
];
|
||||
|
||||
// The assistant's form opens on the `ruth` archetype, so a new ruth is sent
|
||||
// with the archetype's permissions and model; the default alone has no
|
||||
// `manage_root_agent`.
|
||||
test("the assistant creates ruth from the ruth archetype", () => {
|
||||
const ruth = findArchetype(listed, RUTH_ARCHETYPE);
|
||||
assert.equal(ruth?.name, "ruth");
|
||||
const filled = prefill(ruth, defaults);
|
||||
assert.deepEqual(requestPermissions(filled.permissions, defaults), [
|
||||
...defaults,
|
||||
"web_tools",
|
||||
"manage_root_agent",
|
||||
"logs",
|
||||
"metrics",
|
||||
];
|
||||
assert.deepEqual(
|
||||
requestPermissions(
|
||||
initialSelection(all, defaults, RUTH_EXTRA_PERMISSIONS),
|
||||
defaults,
|
||||
),
|
||||
[...defaults, "manage_root_agent", "logs", "metrics"],
|
||||
);
|
||||
]);
|
||||
assert.equal(filled.inference.model, "sonnet");
|
||||
assert.deepEqual(requestArchetype(ruth), {
|
||||
source: "hyperhive",
|
||||
name: "ruth",
|
||||
});
|
||||
});
|
||||
|
||||
test("a swarm that does not list the ruth archetype gives none to pick", () => {
|
||||
assert.equal(findArchetype([listed[0]], RUTH_ARCHETYPE), undefined);
|
||||
assert.equal(findArchetype([], RUTH_ARCHETYPE), undefined);
|
||||
// Same name from another source is not hers.
|
||||
assert.equal(
|
||||
requestPermissions(initialSelection(all, defaults, []), defaults),
|
||||
findArchetype([{ ...listed[1], source: "elsewhere" }], RUTH_ARCHETYPE),
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue