agent 1.7.0 + contracts 1.23.0: a demo scenario seeds whatever the church has installed

- contracts 1.23.0: the seed-scenario job (church, scenario, optional adminEmail; 45 minutes),
  SEED_SCENARIO_JOB_MIN_AGENT 1.7.0.
- agent 1.7.0: seed-scenario -> `crosscode demo <church> --scenario <s>`; seed-demo for
  accounts and app, and --scenario passed on to every product.
- crosscode script: `crosscode demo <church> --scenario <s>` loads the scenario on every product
  the church has here (Accounts, Events, the Website, the App), skipping the rest; every
  installed release checked first; the first failure stops the rest and names what's out of
  step (loaded / skipped in the report). `crosscode demo <church> app` says the App's demo comes
  with App 1.0.0.
- Docs: HANDOVER, APP-1.0-PLAN, VERSIONS, CHANGELOG, agent What's New.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 16:25:31 +02:00
co-authored by Claude Opus 5.5
parent 7391f97cfa
commit 2e8e4c04ca
17 changed files with 408 additions and 42 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/contracts",
"version": "1.22.0",
"version": "1.23.0",
"description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads",
"license": "UNLICENSED",
"type": "commonjs",
+115
View File
@@ -914,6 +914,121 @@
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"schema": {
"type": "string",
"const": "crosscode.agent-job/1"
},
"id": {
"type": "string",
"pattern": "^job_[A-Za-z0-9_-]{8,64}$"
},
"serverId": {
"type": "string",
"pattern": "^srv_[A-Za-z0-9_-]{8,64}$"
},
"config": {
"anyOf": [
{
"type": "object",
"properties": {
"alg": {
"type": "string",
"const": "x25519-hkdf-sha256-aes-256-gcm"
},
"epk": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{43}$"
},
"iv": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{16}$"
},
"ciphertext": {
"type": "string",
"maxLength": 200000,
"pattern": "^[A-Za-z0-9_-]+$"
}
},
"required": [
"alg",
"epk",
"iv",
"ciphertext"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"notBefore": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
},
"expiresAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
},
"signature": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{86}$"
},
"type": {
"type": "string",
"const": "seed-scenario"
},
"args": {
"type": "object",
"properties": {
"church": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]{1,30}$"
},
"scenario": {
"type": "string",
"enum": [
"heritage-parish",
"heritage-city",
"bold-youth",
"bold-plant",
"community-family",
"community-town",
"clean-modern",
"clean-campus"
]
},
"adminEmail": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
}
},
"required": [
"church",
"scenario"
],
"additionalProperties": false
}
},
"required": [
"schema",
"id",
"serverId",
"notBefore",
"expiresAt",
"signature",
"type",
"args"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
@@ -25,6 +25,7 @@
"adopt-undo",
"restart",
"seed-demo",
"seed-scenario",
"env-read",
"env-set",
"export",
+16 -2
View File
@@ -203,6 +203,9 @@ export const SEED_APP_DEMO_MIN_AGENT = "1.7.0";
/** 1.21.0: the first agent that runs `seed-demo` for Accounts and with a `scenario` (passed on as `--scenario`). */
export const SEED_SCENARIO_MIN_AGENT = "1.7.0";
/** 1.23.0: the first agent that runs `seed-scenario` jobs (a whole scenario on whatever the church has installed). */
export const SEED_SCENARIO_JOB_MIN_AGENT = "1.7.0";
/** The first agent that runs a product's `seed-demo` jobs. */
export const SEED_DEMO_MIN_AGENT_BY_PRODUCT: Record<DemoProduct, string> = {
events: SEED_DEMO_MIN_AGENT, website: SEED_WEBSITE_DEMO_MIN_AGENT, app: SEED_APP_DEMO_MIN_AGENT, accounts: SEED_SCENARIO_MIN_AGENT,
@@ -305,6 +308,17 @@ export const jobArgsSchemas = {
ctx.addIssue({ code: "custom", path: ["profile"], message: `the ${a.scenario} scenario loads ${demoScenario(a.scenario).profiles[product]} in ${DEMO_PRODUCT_NAMES[product]}` });
}
}),
/**
* 1.23.0: `crosscode demo <church> --scenario <s> [--admin-email <email>] --json`: a whole demo
* scenario in one job, on **every product the church has on that server**, in
* `DEMO_SCENARIO_ORDER` (Accounts first); products it doesn't have are skipped, so a demo client
* with only Accounts and the Website gets both. The script checks every installed product's
* release (`DEMO_SCENARIO_MIN_VERSIONS`) before changing anything, and stops at the first
* failure, naming the products now out of step. The report's `result`: `loaded` and `skipped`
* (products, space-separated). `adminEmail`: Events' account kept, as in `seed-demo`.
* Agent 1.7.0+ (`SEED_SCENARIO_JOB_MIN_AGENT`).
*/
"seed-scenario": z.strictObject({ church: shortNameSchema, scenario: demoScenarioSchema, adminEmail: z.email().max(254).optional() }),
/**
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only
* whether they're set). The report's `result` is an {@link envReadResultSchema}.
@@ -380,7 +394,7 @@ export const CENTRAL_JOB_TYPES: readonly JobType[] = ["check-ports", "status", "
/** Time limits per job type, in minutes (§3). A job past it is stopped and reported as failed. */
export const JOB_TIME_LIMIT_MINUTES: Record<JobType, number> = {
install: 30, "add-product": 30, deploy: 20, adopt: 30, "adopt-undo": 15, restart: 5, "seed-demo": 15, "env-read": 2, "env-set": 20, export: 20,
install: 30, "add-product": 30, deploy: 20, adopt: 30, "adopt-undo": 15, restart: 5, "seed-demo": 15, "seed-scenario": 45, "env-read": 2, "env-set": 20, export: 20,
uninstall: 20, purge: 10, "update-agent": 15, "check-ports": 2, status: 3,
"frp-read": 2, "frp-write": 5, "probe-ports": 2,
};
@@ -425,7 +439,7 @@ function jobOf<T extends JobType>(type: T) {
}
export const agentJobSchema = z.discriminatedUnion("type", [
jobOf("install"), jobOf("add-product"), jobOf("deploy"), jobOf("adopt"), jobOf("adopt-undo"), jobOf("restart"), jobOf("seed-demo"),
jobOf("install"), jobOf("add-product"), jobOf("deploy"), jobOf("adopt"), jobOf("adopt-undo"), jobOf("restart"), jobOf("seed-demo"), jobOf("seed-scenario"),
jobOf("env-read"), jobOf("env-set"), jobOf("export"), jobOf("uninstall"), jobOf("purge"), jobOf("update-agent"), jobOf("check-ports"), jobOf("status"),
jobOf("frp-read"), jobOf("frp-write"), jobOf("probe-ports"),
]);
+17
View File
@@ -230,6 +230,23 @@ describe("demo scenarios (1.21.0)", () => {
});
});
describe("seed-scenario jobs (1.23.0)", () => {
const args = (a: Record<string, unknown>) => agent.jobArgsSchemas["seed-scenario"].safeParse(a).success;
it("takes a church and a scenario (the products are whatever the church has installed)", () => {
expect(args({ church: "demo2", scenario: "community-family" })).toBe(true);
expect(args({ church: "demo2", scenario: "community-family", adminEmail: "jane@hope.test" })).toBe(true);
expect(args({ church: "demo2", scenario: "nowhere" })).toBe(false);
expect(args({ church: "demo2" })).toBe(false);
expect(args({ church: "demo2", scenario: "bold-youth", products: ["website"] })).toBe(false);
expect(args({ church: "demo2", scenario: "bold-youth", adminEmail: "x; rm -rf /" })).toBe(false);
expect(agent.JOB_TYPES).toContain("seed-scenario");
expect(agent.CENTRAL_JOB_TYPES).not.toContain("seed-scenario");
expect(agent.JOB_TIME_LIMIT_MINUTES["seed-scenario"]).toBeGreaterThanOrEqual(agent.JOB_TIME_LIMIT_MINUTES["seed-demo"] * 3);
expect(agent.SEED_SCENARIO_JOB_MIN_AGENT).toBe("1.7.0");
});
});
describe("env-read and env-set jobs (1.12.0)", () => {
const set = (a: Record<string, unknown>) => agent.jobArgsSchemas["env-set"].safeParse({ church: "hope", product: "events", file: "backend/.env", set: {}, unset: [], restart: true, ...a });
it("read one product", () => {