Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fixtures/extension-pong/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"license": "MIT",
"engines": {
"agentage": ">=0.2.0 <0.21.0"
"agentage": ">=0.2.0 <0.22.0"
},
"agentage": {
"id": "pong",
Expand Down
2 changes: 1 addition & 1 deletion fixtures/extension-probe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"license": "MIT",
"engines": {
"agentage": ">=0.2.0 <0.21.0"
"agentage": ">=0.2.0 <0.22.0"
},
"agentage": {
"id": "probe",
Expand Down
19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"prepublishOnly": "npm run verify"
},
"dependencies": {
"@agentage/apphost": "0.2.1",
"@agentage/extension": "0.20.3",
"@agentage/apphost": "0.3.0",
"@agentage/extension": "0.21.0",
"@electric-sql/pglite": "^0.5.16",
"@tailwindcss/postcss": "^4.3.5",
"chalk": "^6.0.0",
Expand Down
31 changes: 27 additions & 4 deletions src/core/kit-bundle.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { readFileSync, realpathSync } from 'node:fs';
import { cpSync, readFileSync, realpathSync } from 'node:fs';
import { createRequire } from 'node:module';
import { dirname } from 'node:path';
import { check } from '@agentage/extension/tool';
import { describe, expect, it } from 'vitest';
import { fixture, test, type ConfigDir } from '../test/config-dir.js';
import { cliGate, fits } from './installer/compat.js';
import { kitVersion } from './kit-version.js';

Expand All @@ -11,9 +13,9 @@ const apphostJson = createRequire(import.meta.url).resolve('@agentage/apphost/pa

// The desktop and the deployed app host show one shell: the shell package that apphost serves.
describe('the bundled kit', () => {
it('is 0.20.3, and a kit-shaped ^0.20.0 range fits the cli', () => {
expect(kitVersion()).toBe('0.20.3');
expect(fits({ engine: '^0.20.0', kit: true }, cliGate())).toBe(true);
it('is 0.21.0, and a kit-shaped ^0.21.0 range fits the cli', () => {
expect(kitVersion()).toBe('0.21.0');
expect(fits({ engine: '^0.21.0', kit: true }, cliGate())).toBe(true);
});

// One kit in the tree: the daemon (apphost) runs the children on the kit the cli bundles.
Expand All @@ -30,3 +32,24 @@ describe('the bundled kit', () => {
expect(shell.indexOf('className:"ib inboxbtn"', foot)).toBeGreaterThan(foot);
});
});

// `extension check` runs this kit: an extension on engines.agentage ^0.21 passes its stack rule.
describe('the stack rule of the bundled kit', () => {
const stackOf = async (dir: ConfigDir, engine: string): Promise<string[]> => {
cpSync(fixture('probe'), dir.at('probe'), { recursive: true });
const pkg = dir.json('probe/package.json');
const dependencies = { '@agentage/extension': `${engine}.0` };
dir.write('probe/package.json', { ...pkg, engines: { agentage: engine }, dependencies });
const report = await check(dir.at('probe'));
expect(report.rules).toContain('stack');
return report.problems.filter((p) => p.rule === 'stack').map((p) => p.problem);
};

test('passes engines.agentage ^0.21 with kit ^0.21.0', async ({ dir }) => {
expect(await stackOf(dir, '^0.21')).toEqual([]);
});

test('refuses engines.agentage ^0.22, the next kit minor', async ({ dir }) => {
expect(await stackOf(dir, '^0.22')).toContain('kit 0.21.0 is outside engines.agentage ^0.22');
});
});