Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| The Marketplace adds what g1t doesn't do and connects what you already use: extensions (Mail, Support, CRM, Recruiting, On-call, and bridges to a helpdesk, CRM or ERP you run, all Soon), starter kits, and integrations connected by the workspace or by each person; agents aren't installed there. Agent templates live in Agents, as starting points you configure, at Agents → Templates, and the Marketplace's old agent addresses lead there. The marketplace and agents guides say how. | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import type { AgentTemplate } from "@g1t/contracts"; | |
| 5 | ||
| 6 | import { byDepartment, roleLine, routingWords, startPath, templateListings, templatePath, templatesPath } from "./agent-templates.ts"; | |
| 7 | ||
| 8 | const template = (id: string, title: string, department = "Engineering"): AgentTemplate => ({ | |
| 9 | id, | |
| 10 | display_name: title.split(" ")[0]!, | |
| 11 | handle: id, | |
| 12 | name_ideas: [], | |
| 13 | role: title, | |
| 14 | title, | |
| 15 | department, | |
| 16 | responsibilities: ["Do the work"], | |
| 17 | subagents: [], | |
| 18 | instructions: "", | |
| 19 | personality_preset: "crisp", | |
| 20 | routing: { floor: null, ceiling: null, providers: [], pinned: null }, | |
| 21 | }); | |
| 22 | ||
| 23 | test("templates live under Agents, and starting one opens the new-agent form with it chosen", () => { | |
| 24 | assert.equal(templatesPath("acme"), "/acme/-/agents/templates"); | |
| 25 | assert.equal(templatePath("acme", "qa"), "/acme/-/agents/templates/qa"); | |
| 26 | assert.equal(startPath("acme", "qa"), "/acme/-/agents/new?template=qa"); | |
| 27 | }); | |
| 28 | ||
| 29 | test("a template counts the agents started from it, not archived ones", () => { | |
| 30 | const [eng, qa] = templateListings( | |
| 31 | [template("engineering", "Software Engineer"), template("qa", "QA Engineer")], | |
| 32 | [ | |
| 33 | { id: "a1", handle: "otto", display_name: "Otto", template: "engineering", archived_at: null }, | |
| 34 | { id: "a2", handle: "bolt", display_name: "Bolt", template: "engineering", archived_at: "2026-10-01T00:00:00Z" }, | |
| 35 | { id: "a3", handle: "g1t", display_name: "g1t", template: null, archived_at: null }, | |
| 36 | ], | |
| 37 | ); | |
| 38 | assert.deepEqual(eng!.agents.map((a) => a.handle), ["otto"]); | |
| 39 | assert.equal(qa!.agents.length, 0); | |
| 40 | }); | |
| 41 | ||
| 42 | test("without the agents service, no agent is counted", () => { | |
| 43 | const [eng] = templateListings([template("engineering", "Software Engineer")], null); | |
| 44 | assert.deepEqual(eng!.agents, []); | |
| 45 | }); | |
| 46 | ||
| 47 | test("templates group by department, in the order they come", () => { | |
| 48 | const groups = byDepartment(templateListings([template("a", "A One"), template("b", "B Two", "Sales"), template("c", "C Three"), template("d", "D Four", "")], null)); | |
| 49 | assert.deepEqual( | |
| 50 | groups.map(([department, list]) => [department, list.map((l) => l.template.id)]), | |
| 51 | [ | |
| 52 | ["Engineering", ["a", "c"]], | |
| 53 | ["Sales", ["b"]], | |
| 54 | ["Other", ["d"]], | |
| 55 | ], | |
| 56 | ); | |
| 57 | }); | |
| 58 | ||
| 59 | test("a role and its model limits read as words", () => { | |
| 60 | assert.equal(roleLine({ title: "QA Engineer", department: "Engineering" }), "QA Engineer · Engineering"); | |
| 61 | assert.equal(roleLine({ title: "QA Engineer", department: "" }), "QA Engineer"); | |
| 62 | assert.equal(routingWords({ floor: null, ceiling: null }), "Any model the work needs"); | |
| 63 | assert.equal(routingWords({ floor: "large", ceiling: null }), "Large models or better"); | |
| 64 | assert.equal(routingWords({ floor: null, ceiling: "large" }), "Up to large models"); | |
| 65 | }); |