ai-agentmanager 1.23.0 → 1.25.0

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.
package/src/server.js CHANGED
@@ -14,7 +14,7 @@ import { Backlog } from './backlog.js';
14
14
  import { Races } from './races.js';
15
15
  import { Review } from './review.js';
16
16
  import { Teams } from './teams.js';
17
- import { Assistant } from './assistant.js';
17
+ import { Assistant, FEATURES, featuresOf } from './assistant.js';
18
18
  import { Cleanup } from './cleanup.js';
19
19
  import { Landing } from './landing.js';
20
20
  import { Autopilot } from './autopilot.js';
@@ -40,6 +40,7 @@ import * as remote from './remote.js';
40
40
  import * as service from './service.js';
41
41
  import { jiraView, saveJira } from './jira.js';
42
42
  import { ProposedIssues, issuesMarkdown } from './issues.js';
43
+ import { MyActions } from './actions.js';
43
44
  import { designsMarkdown } from './designs.js';
44
45
  import { Reviews, reviewDraft, reviewMarkdown } from './reviews.js';
45
46
  import { CONTAINER_ENGINES, buildImage, claudeToken, dockerStatus, isBuilding, saveSecrets } from './container.js';
@@ -92,6 +93,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
92
93
  const manager = new AgentManager({ store, config, plugins });
93
94
  const backlog = new Backlog({ manager, store, config });
94
95
  const proposed = new ProposedIssues({ store, manager });
96
+ const myActions = new MyActions({ store, manager });
95
97
  const reviews = new Reviews({ manager, store, log: (m) => console.log(`[agentmgr] ${m}`) });
96
98
  const races = new Races({ manager, store });
97
99
  const review = new Review({ manager });
@@ -297,6 +299,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
297
299
  const list = (Array.isArray(intents) ? intents : [intent]).map((i) => String(i ?? '').trim()).filter(Boolean);
298
300
  // Agents the assistant's own session starts: its limits apply, and they are marked as its.
299
301
  const extra = assistant.admit(req.headers['x-agentmgr-agent'], list, opts);
302
+ if (extra.startedBy) proposed.refuseSetAside(list);
300
303
  const created = manager.createMany(list, { ...opts, ...extra });
301
304
  if (!extra.startedBy) repeats.record(created.map((a) => ({ text: a.intent, projectKey: projectOf(store.get(a.id) ?? a).key })));
302
305
  if (extra.startedBy) {
@@ -786,15 +789,36 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
786
789
  api.get('/codemap', wrap((req) => manager.codeMap(req.query.project ? String(req.query.project) : null)));
787
790
  // Issues agents work on, for the summary; ?group=you|agent|done and ?format=markdown to paste.
788
791
  api.get('/issues', wrap(async (req) => {
789
- const v = await manager.issues(proposed.waiting());
792
+ // ?fresh=1 (the ↻ button) asks Jira again for the issues assigned to you.
793
+ if (req.query.fresh === '1') manager.assignedAt = 0;
794
+ manager.jiraOff = !featuresOf(config).jira;
795
+ const v = await manager.issues(proposed.listed(), proposed.actions);
790
796
  const group = req.query.group ? String(req.query.group) : null;
791
- const rows = group && group !== 'all' ? v.rows.filter((r) => r.group === group) : v.rows;
797
+ // "all" is everything still on the list: removed ones only when asked for.
798
+ const rows = !group ? v.rows : group === 'all' ? v.rows.filter((r) => r.group !== 'removed') : v.rows.filter((r) => r.group === group);
792
799
  return req.query.format === 'markdown' ? { markdown: issuesMarkdown(rows) } : { ...v, rows };
793
800
  }));
794
801
  // Issues proposed for agents (the assistant, when you pick): start the ticked ones, or dismiss them.
795
802
  api.post('/issues/proposed', wrap((req) => proposed.add({ ...req.body, by: req.headers['x-agentmgr-agent'] ? 'assistant' : 'you' })));
796
803
  api.post('/issues/start', wrap((req) => proposed.start(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [])));
797
804
  api.post('/issues/dismiss', wrap((req) => proposed.dismiss(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [])));
805
+ // My actions: what's asked of you in Slack and meeting notes (the assistant adds them).
806
+ api.get('/actions', wrap(() => ({ rows: myActions.rows(), features: featuresOf(config) })));
807
+ api.post('/actions', wrap((req) => myActions.add({ ...req.body, by: req.headers['x-agentmgr-agent'] ? 'assistant' : 'you' })));
808
+ api.post('/actions/set', wrap((req) => myActions.set(Array.isArray(req.body?.ids) ? req.body.ids.map(String) : [], String(req.body?.state ?? ''), { project: req.body?.project ?? null })));
809
+ api.post('/actions/:id/discuss', wrap((req) => myActions.discuss(req.params.id, `node ${JSON.stringify(path.join(__dirname, '..', 'bin', 'agentmgr.js'))}`)));
810
+ // The parts you use: Jira, Slack, meeting notes. Off hides its list and the assistant skips it.
811
+ api.get('/features', wrap(() => ({ features: featuresOf(config), me: assistant.settings.me })));
812
+ api.put('/features', wrap((req) => {
813
+ const next = {};
814
+ for (const k of Object.keys(FEATURES)) if (typeof req.body?.features?.[k] === 'boolean') next[k] = req.body.features[k];
815
+ config.features = { ...config.features, ...next };
816
+ saveConfig({ features: config.features });
817
+ if (typeof req.body?.me === 'string') saveConfig({ assistant: assistant.update({ me: req.body.me.trim() }) });
818
+ return { features: featuresOf(config), me: assistant.settings.me };
819
+ }));
820
+ // Your action on issues: assign (starts an agent from the proposal), skip, done, remove, or null to clear.
821
+ api.post('/issues/action', wrap((req) => proposed.setAction(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [], req.body?.action ?? null)));
798
822
  // Design docs of all agents; the same ?group= and ?format=markdown.
799
823
  api.get('/designs', wrap((req) => {
800
824
  const v = manager.designs();