agent-tasks 1.9.22 → 1.9.23
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/agent-desk-plugin.json +1 -1
- package/dist/index.js +42 -126
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/agent-desk-plugin.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,144 +3,60 @@
|
|
|
3
3
|
// agent-tasks — MCP server entry point
|
|
4
4
|
//
|
|
5
5
|
// Pipeline-driven task management for AI coding agents.
|
|
6
|
-
// Communicates via JSON-RPC 2.0 over stdio (Model Context Protocol)
|
|
6
|
+
// Communicates via JSON-RPC 2.0 over stdio (Model Context Protocol) through
|
|
7
|
+
// agent-common's startMcpServer. formatResult appends a pipeline-instructions
|
|
8
|
+
// footer so AI clients are reminded of the stage lifecycle.
|
|
7
9
|
// =============================================================================
|
|
8
|
-
import {
|
|
10
|
+
import { startMcpServer } from 'agent-common';
|
|
9
11
|
import { createContext } from './context.js';
|
|
10
12
|
import { readPackageMeta } from './package-meta.js';
|
|
11
13
|
import { tools, createToolHandler } from './transport/mcp.js';
|
|
12
14
|
import { startDashboard } from './server.js';
|
|
13
15
|
const DASHBOARD_PORT = parseInt(process.env.AGENT_TASKS_PORT ?? '3422', 10);
|
|
14
16
|
const SERVER_INFO = readPackageMeta();
|
|
15
|
-
const CAPABILITIES = { tools: {} };
|
|
16
17
|
const INSTRUCTIONS = process.env.AGENT_TASKS_INSTRUCTIONS !== '0'
|
|
17
18
|
? '\n\n---\nPIPELINE: Tasks flow through stages: backlog → spec → plan → implement → test → review → done. ' +
|
|
18
19
|
'Always advance tasks through stages (task_advance). Attach artifacts at each stage (task_add_artifact). ' +
|
|
19
20
|
'Use task_next to pick up unblocked work. Add comments (task_comment) to discuss decisions.'
|
|
20
21
|
: '';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.catch((err) => {
|
|
38
|
-
process.stderr.write('[agent-tasks] Dashboard start failed: ' +
|
|
39
|
-
(err instanceof Error ? err.message : String(err)) +
|
|
40
|
-
'\n');
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function makeToolResponse(id, result) {
|
|
44
|
-
const text = JSON.stringify(result, null, 2) + INSTRUCTIONS;
|
|
45
|
-
return {
|
|
46
|
-
jsonrpc: '2.0',
|
|
47
|
-
id,
|
|
48
|
-
result: { content: [{ type: 'text', text }] },
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function makeToolError(id, err) {
|
|
52
|
-
return {
|
|
53
|
-
jsonrpc: '2.0',
|
|
54
|
-
id,
|
|
55
|
-
result: {
|
|
56
|
-
content: [
|
|
57
|
-
{
|
|
58
|
-
type: 'text',
|
|
59
|
-
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
isError: true,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function handleRequest(request) {
|
|
67
|
-
const { method, params, id } = request;
|
|
68
|
-
switch (method) {
|
|
69
|
-
case 'initialize':
|
|
70
|
-
tryStartDashboard();
|
|
71
|
-
return {
|
|
72
|
-
jsonrpc: '2.0',
|
|
73
|
-
id,
|
|
74
|
-
result: {
|
|
75
|
-
protocolVersion: '2024-11-05',
|
|
76
|
-
serverInfo: SERVER_INFO,
|
|
77
|
-
capabilities: CAPABILITIES,
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
case 'notifications/initialized':
|
|
81
|
-
return null;
|
|
82
|
-
case 'tools/list':
|
|
83
|
-
return { jsonrpc: '2.0', id, result: { tools } };
|
|
84
|
-
case 'tools/call': {
|
|
85
|
-
const toolName = params.name;
|
|
86
|
-
const toolArgs = params.arguments || {};
|
|
87
|
-
try {
|
|
88
|
-
const result = handleTool(toolName, toolArgs);
|
|
89
|
-
if (result && typeof result === 'object' && 'then' in result) {
|
|
90
|
-
result
|
|
91
|
-
.then((resolved) => writeJsonRpcResponse(makeToolResponse(id, resolved)))
|
|
92
|
-
.catch((err) => writeJsonRpcResponse(makeToolError(id, err)));
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
return makeToolResponse(id, result);
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
return makeToolError(id, err);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
case 'ping':
|
|
102
|
-
return { jsonrpc: '2.0', id, result: {} };
|
|
103
|
-
default:
|
|
104
|
-
return {
|
|
105
|
-
jsonrpc: '2.0',
|
|
106
|
-
id,
|
|
107
|
-
error: { code: -32601, message: `Method not found: ${method}` },
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const stdioReadline = createInterface({ input: process.stdin, terminal: false });
|
|
112
|
-
stdioReadline.on('line', (line) => {
|
|
113
|
-
if (!line.trim())
|
|
114
|
-
return;
|
|
115
|
-
try {
|
|
116
|
-
const request = JSON.parse(line);
|
|
117
|
-
const response = handleRequest(request);
|
|
118
|
-
if (response)
|
|
119
|
-
writeJsonRpcResponse(response);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
writeJsonRpcResponse({
|
|
123
|
-
jsonrpc: '2.0',
|
|
124
|
-
id: null,
|
|
125
|
-
error: { code: -32700, message: 'Parse error' },
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
// --- Graceful shutdown ---
|
|
130
|
-
function cleanup() {
|
|
131
|
-
if (dashboard)
|
|
132
|
-
dashboard.close();
|
|
133
|
-
appContext.close();
|
|
134
|
-
}
|
|
135
|
-
process.on('SIGINT', () => {
|
|
136
|
-
cleanup();
|
|
137
|
-
process.exit(0);
|
|
22
|
+
const appContext = createContext();
|
|
23
|
+
const handleTool = createToolHandler(appContext);
|
|
24
|
+
let dashboard = null;
|
|
25
|
+
let dashboardStarted = false;
|
|
26
|
+
function tryStartDashboard() {
|
|
27
|
+
if (dashboardStarted)
|
|
28
|
+
return;
|
|
29
|
+
dashboardStarted = true;
|
|
30
|
+
startDashboard(appContext, DASHBOARD_PORT)
|
|
31
|
+
.then((dashboardServer) => {
|
|
32
|
+
dashboard = dashboardServer;
|
|
33
|
+
})
|
|
34
|
+
.catch((err) => {
|
|
35
|
+
process.stderr.write('[agent-tasks] Dashboard start failed: ' +
|
|
36
|
+
(err instanceof Error ? err.message : String(err)) +
|
|
37
|
+
'\n');
|
|
138
38
|
});
|
|
139
|
-
process.on('SIGTERM', () => {
|
|
140
|
-
cleanup();
|
|
141
|
-
process.exit(0);
|
|
142
|
-
});
|
|
143
|
-
process.on('exit', cleanup);
|
|
144
39
|
}
|
|
145
|
-
|
|
40
|
+
startMcpServer({
|
|
41
|
+
serverInfo: SERVER_INFO,
|
|
42
|
+
tools,
|
|
43
|
+
handleTool,
|
|
44
|
+
onInitialize: tryStartDashboard,
|
|
45
|
+
formatResult: (result) => JSON.stringify(result, null, 2) + INSTRUCTIONS,
|
|
46
|
+
logLabel: 'agent-tasks',
|
|
47
|
+
});
|
|
48
|
+
function cleanup() {
|
|
49
|
+
if (dashboard)
|
|
50
|
+
dashboard.close();
|
|
51
|
+
appContext.close();
|
|
52
|
+
}
|
|
53
|
+
process.on('SIGINT', () => {
|
|
54
|
+
cleanup();
|
|
55
|
+
process.exit(0);
|
|
56
|
+
});
|
|
57
|
+
process.on('SIGTERM', () => {
|
|
58
|
+
cleanup();
|
|
59
|
+
process.exit(0);
|
|
60
|
+
});
|
|
61
|
+
process.on('exit', cleanup);
|
|
146
62
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA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AAC,GAAG,EAAE,EAAE;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,wCAAwC;YACtC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAClD,IAAI,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED,cAAc,CAAC;IACb,UAAU,EAAE,WAAW;IACvB,KAAK;IACL,UAAU;IACV,YAAY,EAAE,iBAAiB;IAC/B,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,YAAY;IACxE,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAC;AAEH,SAAS,OAAO;IACd,IAAI,SAAS;QAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IACjC,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC;AACD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,EAAE,CAAC;IACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,OAAO,EAAE,CAAC;IACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-tasks",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.23",
|
|
4
4
|
"description": "Pipeline-driven task management for AI coding agents — stages, dependencies, artifacts, and multi-agent claiming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"agent-common": "^1.0.
|
|
51
|
+
"agent-common": "^1.0.3",
|
|
52
52
|
"better-sqlite3": "^12.8.0",
|
|
53
53
|
"morphdom": "^2.7.8",
|
|
54
54
|
"ws": "^8.20.0"
|