agents-relay 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +2 -1
  3. package/dist/dashboard.js +1 -1
  4. package/dist/relayd.js +2 -2
  5. package/dist/store.js +24 -9
  6. package/package.json +19 -4
  7. package/.github/workflows/publish.yml +0 -91
  8. package/AGENTS.md +0 -16
  9. package/docs/agent-network.md +0 -34
  10. package/docs/architecture.md +0 -120
  11. package/docs/autonomous-objective-jobs.md +0 -121
  12. package/docs/example.md +0 -30
  13. package/docs/github-app-rate-limit.md +0 -124
  14. package/docs/service.md +0 -43
  15. package/pack.json +0 -326
  16. package/scripts/npm-version.mjs +0 -11
  17. package/src/adapters.ts +0 -231
  18. package/src/cli.ts +0 -324
  19. package/src/continuation.ts +0 -6
  20. package/src/dashboard.ts +0 -421
  21. package/src/events.ts +0 -25
  22. package/src/github-auth.ts +0 -35
  23. package/src/github-webhook.ts +0 -37
  24. package/src/markers.ts +0 -33
  25. package/src/planner.ts +0 -150
  26. package/src/pool.ts +0 -87
  27. package/src/reconciler.ts +0 -235
  28. package/src/registry.ts +0 -35
  29. package/src/relayd.ts +0 -137
  30. package/src/scheduler.ts +0 -27
  31. package/src/store.ts +0 -526
  32. package/src/types.ts +0 -45
  33. package/src/usage.ts +0 -385
  34. package/src/workspace.ts +0 -62
  35. package/test/adapters.test.js +0 -303
  36. package/test/autonomous.test.js +0 -119
  37. package/test/core.test.js +0 -363
  38. package/test/dashboard.test.js +0 -178
  39. package/test/github-auth.test.js +0 -51
  40. package/test/github-webhook.test.js +0 -21
  41. package/test/service.test.js +0 -116
  42. package/test/store.test.js +0 -390
  43. package/test/usage.test.js +0 -88
  44. package/test/workspace.test.js +0 -95
  45. package/tsconfig.json +0 -4
@@ -1,95 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import { execFile } from 'node:child_process';
3
- import { mkdtemp, mkdir, rm } from 'node:fs/promises';
4
- import { promisify } from 'node:util';
5
- import { join } from 'node:path';
6
- import { tmpdir } from 'node:os';
7
- import test from 'node:test';
8
- import { marker, JOB_MARKER } from '../dist/markers.js';
9
- import { aggregateManagedGitHubJobs } from '../dist/pool.js';
10
- import { discoverGitRepositories, discoverWorkspaceRepositories, githubRepositoryFromRemote } from '../dist/workspace.js';
11
-
12
- const exec = promisify(execFile);
13
- const now = () => new Date().toISOString();
14
- const job = (id, repository, prNumber) => ({ id, title: id, prNumber, repository, state: 'OPEN', continuation: null, createdAt: now(), updatedAt: now(), tasks: undefined });
15
-
16
- test('workspace discovery finds nested git checkouts and GitHub origins', async () => {
17
- const root = await mkdtemp(join(tmpdir(), 'agents-relay-workspace-'));
18
- try {
19
- const repo = join(root, 'neo');
20
- const nested = join(root, 'group', 'agents-relay');
21
- await mkdir(nested, { recursive: true });
22
- for (const [path, remote] of [[repo, 'git@github.com:lalalic/neo.git'], [nested, 'https://github.com/lalalic/agents-relay.git']]) {
23
- await exec('git', ['init', '-q', path]);
24
- await exec('git', ['-C', path, 'remote', 'add', 'origin', remote]);
25
- }
26
- assert.deepEqual(await discoverGitRepositories(root), [nested, repo]);
27
- assert.deepEqual(await discoverWorkspaceRepositories(root), [{ path: nested, repository: 'lalalic/agents-relay' }, { path: repo, repository: 'lalalic/neo' }]);
28
- } finally { await rm(root, { recursive: true, force: true }); }
29
- });
30
-
31
- test('workspace repository parsing ignores non-GitHub remotes', () => {
32
- assert.equal(githubRepositoryFromRemote('git@gitlab.com:someone/project.git'), null);
33
- assert.equal(githubRepositoryFromRemote('ssh://git@github.com/lalalic/neo.git'), 'lalalic/neo');
34
- });
35
-
36
- test('managed job aggregation spans repositories', async () => {
37
- const jobs = { 'lalalic/neo': job('neo-job', 'lalalic/neo', 20), 'lalalic/agents-relay': job('relay-job', 'lalalic/agents-relay', 28) };
38
- const client = { request: async path => { throw new Error(`unexpected REST ${path}`); }, graphql: async (_query, variables={}) => {
39
- const repository = `${variables.owner}/${variables.name}`;
40
- const root = jobs[repository];
41
- if (!root) throw new Error(`unexpected ${repository}`);
42
- return {repository:{open:{nodes:[{number:root.prNumber,body:'',state:'OPEN',isDraft:false,merged:false,mergedAt:null,closedAt:null,comments:{nodes:[{author:{login:'bot'},body:marker(JOB_MARKER,root)}]}}],pageInfo:{hasNextPage:false,endCursor:null}},recentClosed:{nodes:[]}}};
43
- } };
44
- const result = await aggregateManagedGitHubJobs(client, ['lalalic/neo', 'lalalic/agents-relay'], new Set(['bot']));
45
- assert.deepEqual(result.map(item => item.job.id).sort(), ['neo-job', 'relay-job']);
46
- });
47
-
48
-
49
- test('workspace discovery deduplicates multiple checkouts of the same GitHub repository', async () => {
50
- const root = await mkdtemp(join(tmpdir(), 'agents-relay-workspace-dedupe-'));
51
- try {
52
- const primary = join(root, 'neo');
53
- const worktree = join(root, '.worktrees', 'neo-feature');
54
- const backup = join(root, '.backup', 'neo-old');
55
- for (const path of [primary, worktree, backup]) {
56
- await mkdir(path, { recursive: true });
57
- await exec('git', ['init', '-q', path]);
58
- await exec('git', ['-C', path, 'remote', 'add', 'origin', 'git@github.com:lalalic/neo.git']);
59
- }
60
- assert.deepEqual(await discoverWorkspaceRepositories(root), [{ path: primary, repository: 'lalalic/neo' }]);
61
- } finally { await rm(root, { recursive: true, force: true }); }
62
- });
63
-
64
- test('managed job aggregation deduplicates duplicate repository inputs', async () => {
65
- let pullLists = 0;
66
- const rootJob = job('relay-job', 'lalalic/agents-relay', 28);
67
- const client = { request: async path => { throw new Error(`unexpected REST ${path}`); }, graphql: async () => {
68
- pullLists += 1;
69
- return {repository:{open:{nodes:[{number:28,body:'',state:'OPEN',isDraft:false,merged:false,mergedAt:null,closedAt:null,comments:{nodes:[{author:{login:'bot'},body:marker(JOB_MARKER,rootJob)}]}}],pageInfo:{hasNextPage:false,endCursor:null}},recentClosed:{nodes:[]}}};
70
- } };
71
- const result = await aggregateManagedGitHubJobs(client, ['lalalic/agents-relay', 'lalalic/agents-relay'], new Set(['bot']));
72
- assert.equal(pullLists, 1);
73
- assert.deepEqual(result.map(item => item.job.id), ['relay-job']);
74
- });
75
-
76
-
77
- test('managed job discovery paginates all open PRs but bounds closed history', async () => {
78
- const openA = job('open-a', 'lalalic/agents-relay', 30);
79
- const openB = job('open-b', 'lalalic/agents-relay', 29);
80
- const closed = { ...job('closed', 'lalalic/agents-relay', 28), state: 'COMPLETED' };
81
- let calls = 0;
82
- const node = (root, state='OPEN') => ({number:root.prNumber,body:'',state,isDraft:false,merged:state==='CLOSED',mergedAt:state==='CLOSED'?now():null,closedAt:state==='CLOSED'?now():null,comments:{nodes:[{author:{login:'bot'},body:marker(JOB_MARKER,root)}]}});
83
- const client = { request: async path => { throw new Error(`unexpected REST ${path}`); }, graphql: async (query, variables={}) => {
84
- calls += 1;
85
- if (!variables.cursor) {
86
- assert.match(query, /recentClosed:pullRequests\(first:20,states:CLOSED/);
87
- return {repository:{open:{nodes:[node(openA)],pageInfo:{hasNextPage:true,endCursor:'next'}},recentClosed:{nodes:[node(closed,'CLOSED')]}}};
88
- }
89
- assert.doesNotMatch(query, /recentClosed:/);
90
- return {repository:{open:{nodes:[node(openB)],pageInfo:{hasNextPage:false,endCursor:null}}}};
91
- } };
92
- const result = await aggregateManagedGitHubJobs(client, ['lalalic/agents-relay'], new Set(['bot']));
93
- assert.equal(calls, 2);
94
- assert.deepEqual(result.map(item => item.job.id), ['open-a', 'open-b', 'closed']);
95
- });
package/tsconfig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "outDir": "dist", "rootDir": "src", "strict": true, "noImplicitAny": true, "esModuleInterop": true, "skipLibCheck": true, "lib": ["ES2022", "DOM"] },
3
- "include": ["src/**/*.ts"]
4
- }